QoL improvements

This commit is contained in:
Alex
2023-03-27 20:11:32 +03:00
parent 3eb6923374
commit 93afcd2210
59 changed files with 612 additions and 424 deletions

View File

@ -136,6 +136,8 @@ namespace GraphicalUserInterface
{
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-overflow"
void PaintChar(Video::Font *font, ScreenBitmap *Bitmap, char c, uint32_t Color, long *CharCursorX, long *CharCursorY)
{
switch (font->GetInfo().Type)
@ -182,6 +184,7 @@ namespace GraphicalUserInterface
break;
}
}
#pragma GCC diagnostic pop
void DrawString(ScreenBitmap *Bitmap, Rect rect, const char *Text, uint32_t Color)
{

View File

@ -69,15 +69,15 @@ namespace GraphicalUserInterface
this->Buffer->Data = (uint8_t *)this->mem->RequestPages(TO_PAGES(this->Buffer->Size));
memset(this->Buffer->Data, 0, this->Buffer->Size);
NeedRedraw = true;
this->NeedRedraw = true;
}
if (NeedRedraw)
if (this->NeedRedraw)
{
memset(this->Buffer->Data, 0, this->Buffer->Size);
this->OnPaintBackground(e);
this->OnPaintForeground(e);
NeedRedraw = false;
this->NeedRedraw = false;
}
DrawOverBitmap(((Window *)this->ParentWindow)->GetBuffer(), this->Buffer, 0, 0);
}
@ -92,7 +92,7 @@ namespace GraphicalUserInterface
{
debug("Button Hold");
Button->Pressed = true;
NeedRedraw = true;
this->NeedRedraw = true;
}
}
}
@ -114,7 +114,7 @@ namespace GraphicalUserInterface
((void (*)(void))Button->OnClick)();
Button->Pressed = false;
NeedRedraw = true;
this->NeedRedraw = true;
}
}
}
@ -128,12 +128,12 @@ namespace GraphicalUserInterface
if (Button->rect.Contains(e->MouseMove.X, e->MouseMove.Y))
{
Button->Hover = true;
NeedRedraw = true;
this->NeedRedraw = true;
}
else
{
Button->Hover = false;
NeedRedraw = true;
this->NeedRedraw = true;
}
}
}

View File

@ -17,7 +17,7 @@ namespace GraphicalUserInterface
{
Handle WidgetCollection::CreatePanel(Rect rect, uint32_t Color)
{
PanelObject *panel = (PanelObject *)mem->RequestPages(TO_PAGES(sizeof(PanelObject)));
PanelObject *panel = (PanelObject *)this->mem->RequestPages(TO_PAGES(sizeof(PanelObject)));
panel->Handle.Type[0] = 'P';
panel->Handle.Type[1] = 'N';
@ -31,13 +31,13 @@ namespace GraphicalUserInterface
panel->Shadow = false;
Panels.push_back(panel);
NeedRedraw = true;
this->NeedRedraw = true;
return (Handle)panel;
}
Handle WidgetCollection::CreateLabel(Rect rect, const char *Text)
{
LabelObject *label = (LabelObject *)mem->RequestPages(TO_PAGES(sizeof(LabelObject)));
LabelObject *label = (LabelObject *)this->mem->RequestPages(TO_PAGES(sizeof(LabelObject)));
label->Handle.Type[0] = 'L';
label->Handle.Type[1] = 'B';
@ -57,7 +57,7 @@ namespace GraphicalUserInterface
Handle WidgetCollection::CreateButton(Rect rect, const char *Text, uintptr_t OnClick)
{
ButtonObject *button = (ButtonObject *)mem->RequestPages(TO_PAGES(sizeof(ButtonObject)));
ButtonObject *button = (ButtonObject *)this->mem->RequestPages(TO_PAGES(sizeof(ButtonObject)));
button->Handle.Type[0] = 'B';
button->Handle.Type[1] = 'T';
@ -77,7 +77,7 @@ namespace GraphicalUserInterface
button->OnClick = OnClick;
Buttons.push_back(button);
NeedRedraw = true;
this->NeedRedraw = true;
return (Handle)button;
}
@ -88,7 +88,7 @@ namespace GraphicalUserInterface
{
LabelObject *label = (LabelObject *)handle;
strcpy(label->Text, Text);
NeedRedraw = true;
this->NeedRedraw = true;
}
}