mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-29 07:47:59 +00:00
Added SetText()
This commit is contained in:
parent
5257ff662f
commit
b3cbcd474d
@ -81,6 +81,17 @@ namespace GraphicalUserInterface
|
||||
return (Handle)button;
|
||||
}
|
||||
|
||||
void WidgetCollection::SetText(Handle handle, const char *Text)
|
||||
{
|
||||
HandleMeta *meta = (HandleMeta *)handle;
|
||||
if (meta->Type[0] == 'L' && meta->Type[1] == 'B' && meta->Type[2] == 'L')
|
||||
{
|
||||
LabelObject *label = (LabelObject *)handle;
|
||||
strcpy(label->Text, Text);
|
||||
NeedRedraw = true;
|
||||
}
|
||||
}
|
||||
|
||||
WidgetCollection::WidgetCollection(void *ParentWindow)
|
||||
{
|
||||
if (!ParentWindow)
|
||||
|
@ -43,16 +43,23 @@ namespace Recovery
|
||||
RecoveryModeWindow.Height = 100;
|
||||
RecoveryModeWindow.Left = Display->GetBuffer(200)->Width / 2 - RecoveryModeWindow.Width / 2;
|
||||
RecoveryModeWindow.Top = Display->GetBuffer(200)->Height / 2 - RecoveryModeWindow.Height / 2;
|
||||
Window *win = new Window(gui, RecoveryModeWindow, "Recovery Mode");
|
||||
gui->AddWindow(win);
|
||||
Window *RecWin = new Window(gui, RecoveryModeWindow, "Recovery Mode");
|
||||
gui->AddWindow(RecWin);
|
||||
|
||||
WidgetCollection *wdg = new WidgetCollection(win);
|
||||
wdg->CreateLabel({10, 10, 0, 0}, "This is not fully implemented.");
|
||||
wdg->CreateLabel({10, 25, 0, 0}, "All you can do is shutdown/reboot the system.");
|
||||
wdg->CreateButton({10, 50, 90, 20}, "Reboot", (uintptr_t)RebootCommandWrapper);
|
||||
wdg->CreateButton({110, 50, 90, 20}, "Shutdown", (uintptr_t)ShutdownCommandWrapper);
|
||||
WidgetCollection *wdgRecWin = new WidgetCollection(RecWin);
|
||||
GraphicalUserInterface::Handle SchedLblHnd = wdgRecWin->CreateLabel({10, 0, 0, 0}, "Scheduler Ticks: 0");
|
||||
wdgRecWin->CreateLabel({10, 20, 0, 0}, "This is not fully implemented.");
|
||||
wdgRecWin->CreateLabel({10, 40, 0, 0}, "All you can do is shutdown/reboot the system.");
|
||||
wdgRecWin->CreateButton({10, 70, 90, 20}, "Reboot", (uintptr_t)RebootCommandWrapper);
|
||||
wdgRecWin->CreateButton({110, 70, 90, 20}, "Shutdown", (uintptr_t)ShutdownCommandWrapper);
|
||||
RecWin->AddWidget(wdgRecWin);
|
||||
|
||||
win->AddWidget(wdg);
|
||||
char TicksText[128];
|
||||
while (true)
|
||||
{
|
||||
sprintf(TicksText, "Scheduler Ticks: %ld", TaskManager->GetSchedulerTicks());
|
||||
wdgRecWin->SetText(SchedLblHnd, TicksText);
|
||||
}
|
||||
}
|
||||
|
||||
KernelRecovery::~KernelRecovery()
|
||||
|
@ -241,6 +241,8 @@ namespace GraphicalUserInterface
|
||||
Handle CreateProgressBar(Rect rect, const char *Text);
|
||||
Handle CreateContextMenu(Rect rect, const char *Text);
|
||||
|
||||
void SetText(Handle handle, const char *Text);
|
||||
|
||||
WidgetCollection(void /* Window */ *ParentWindow);
|
||||
~WidgetCollection();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user