simplify launcher widgets code

This commit is contained in:
UnknownShadow200 2019-07-29 20:13:23 +10:00
parent aabfab54cf
commit e3eee65df1
4 changed files with 73 additions and 93 deletions

View file

@ -686,6 +686,7 @@ void Entities_DrawShadows(void) {
*#########################################################################################################################*/
struct _TabListData TabList;
/* Removes the names from the names buffer for the given id. */
static void TabList_Delete(EntityID id) {
int i, index;
index = TabList.NameOffsets[id];
@ -695,16 +696,16 @@ static void TabList_Delete(EntityID id) {
StringsBuffer_Remove(&TabList._buffer, index - 2);
StringsBuffer_Remove(&TabList._buffer, index - 3);
/* Indices after this entry need to be shifted down */
for (i = 0; i < TABLIST_MAX_NAMES; i++) {
if (TabList.NameOffsets[i] > index) TabList.NameOffsets[i] -= 3;
}
TabList.NameOffsets[id] = 0;
TabList.GroupRanks[id] = 0;
}
void TabList_Remove(EntityID id) {
TabList_Delete(id);
TabList.NameOffsets[id] = 0;
TabList.GroupRanks[id] = 0;
Event_RaiseInt(&TabListEvents.Removed, id);
}

View file

@ -194,23 +194,19 @@ CC_NOINLINE static void LScreen_Reset(struct LScreen* s) {
*--------------------------------------------------------Widget helpers---------------------------------------------------*
*#########################################################################################################################*/
CC_NOINLINE static void LScreen_Button(struct LScreen* s, struct LButton* w, int width, int height, const char* text) {
String str = String_FromReadonly(text);
LButton_Init(w, &Launcher_TitleFont, width, height);
LButton_SetText(w, &str);
LButton_Init(w, width, height);
LButton_SetConst(w, text);
s->widgets[s->numWidgets++] = (struct LWidget*)w;
}
CC_NOINLINE static void LScreen_Label(struct LScreen* s, struct LLabel* w, const char* text) {
String str = String_FromReadonly(text);
LLabel_Init(w, &Launcher_TextFont);
LLabel_SetText(w, &str);
LLabel_Init(w);
LLabel_SetConst(w, text);
s->widgets[s->numWidgets++] = (struct LWidget*)w;
}
CC_NOINLINE static void LScreen_Input(struct LScreen* s, struct LInput* w, int width, bool password, const char* hintText) {
LInput_Init(w, &Launcher_TextFont, width, 30,
hintText, &Launcher_HintFont);
w->Password = password;
CC_NOINLINE static void LScreen_Input(struct LScreen* s, struct LInput* w, int width, const char* hintText) {
LInput_Init(w, width, 30, hintText);
s->widgets[s->numWidgets++] = (struct LWidget*)w;
}
@ -281,7 +277,6 @@ static void UseModeClassicHax(void* w, int x, int y) { ChooseMode_Click(true, t
static void UseModeClassic(void* w, int x, int y) { ChooseMode_Click(true, false); }
static void ChooseModeScreen_Init(struct LScreen* s_) {
static const String titleText = String_FromConst("Choose game mode");
struct ChooseModeScreen* s = (struct ChooseModeScreen*)s_;
s->lblHelp.Hidden = !s->firstTime;
@ -315,8 +310,8 @@ static void ChooseModeScreen_Init(struct LScreen* s_) {
s->btnClassic.OnClick = UseModeClassic;
s->btnBack.OnClick = SwitchToSettings;
s->lblTitle.Font = Launcher_TitleFont;
LLabel_SetText(&s->lblTitle, &titleText);
s->lblTitle.Font = &Launcher_TitleFont;
LLabel_SetConst(&s->lblTitle, "Choose game mode");
}
static void ChooseModeScreen_Reposition(struct LScreen* s_) {
@ -468,7 +463,7 @@ static void ColoursScreen_Init(struct LScreen* s_) {
s->widgets = s->_widgets;
for (i = 0; i < 5 * 3; i++) {
LScreen_Input(s_, &s->iptColours[i], 55, false, NULL);
LScreen_Input(s_, &s->iptColours[i], 55, NULL);
s->iptColours[i].TextChanged = ColoursScreen_TextChanged;
}
@ -536,11 +531,9 @@ static struct DirectConnectScreen {
struct LWidget* _widgets[6];
} DirectConnectScreen_Instance;
CC_NOINLINE static void DirectConnectScreen_SetStatus(const char* msg) {
String str = String_FromReadonly(msg);
CC_NOINLINE static void DirectConnectScreen_SetStatus(const char* text) {
struct LLabel* w = &DirectConnectScreen_Instance.lblStatus;
LLabel_SetText(w, &str);
LLabel_SetConst(w, text);
LWidget_Redraw(w);
}
@ -616,9 +609,9 @@ static void DirectConnectScreen_Init(struct LScreen* s_) {
if (s->numWidgets) return;
s->widgets = s->_widgets;
LScreen_Input(s_, &s->iptUsername, 330, false, "&gUsername..");
LScreen_Input(s_, &s->iptAddress, 330, false, "&gIP address:Port number..");
LScreen_Input(s_, &s->iptMppass, 330, false, "&gMppass..");
LScreen_Input(s_, &s->iptUsername, 330, "&gUsername..");
LScreen_Input(s_, &s->iptAddress, 330, "&gIP address:Port number..");
LScreen_Input(s_, &s->iptMppass, 330, "&gMppass..");
LScreen_Button(s_, &s->btnConnect, 110, 35, "Connect");
LScreen_Button(s_, &s->btnBack, 80, 35, "Back");
@ -702,20 +695,16 @@ CC_NOINLINE static void MainScreen_Error(struct LWebTask* task, const char* acti
}
static void MainScreen_Login(void* w, int x, int y) {
static const String needUser = String_FromConst("&eUsername required");
static const String needPass = String_FromConst("&ePassword required");
static const String signIn = String_FromConst("&e&eSigning in..");
struct MainScreen* s = &MainScreen_Instance;
String* user = &s->iptUsername.Text;
String* pass = &s->iptPassword.Text;
if (!user->length) {
LLabel_SetText(&s->lblStatus, &needUser);
LLabel_SetConst(&s->lblStatus, "&eUsername required");
LWidget_Redraw(&s->lblStatus); return;
}
if (!pass->length) {
LLabel_SetText(&s->lblStatus, &needPass);
LLabel_SetConst(&s->lblStatus, "&ePassword required");
LWidget_Redraw(&s->lblStatus); return;
}
@ -724,7 +713,7 @@ static void MainScreen_Login(void* w, int x, int y) {
Options_SetSecure("launcher-cc-password", pass, user);
GetTokenTask_Run();
LLabel_SetText(&s->lblStatus, &signIn);
LLabel_SetConst(&s->lblStatus, "&eSigning in..");
LWidget_Redraw(&s->lblStatus);
s->signingIn = true;
}
@ -752,7 +741,6 @@ static void MainScreen_Singleplayer(void* w, int x, int y) {
static void MainScreen_Init(struct LScreen* s_) {
String user, pass; char passBuffer[STRING_SIZE];
static const String update = String_FromConst("&eChecking..");
struct MainScreen* s = (struct MainScreen*)s_;
/* status should reset after user has gone to another menu */
@ -760,8 +748,8 @@ static void MainScreen_Init(struct LScreen* s_) {
if (s->numWidgets) return;
s->widgets = s->_widgets;
LScreen_Input(s_, &s->iptUsername, 280, false, "&gUsername..");
LScreen_Input(s_, &s->iptPassword, 280, true, "&gPassword..");
LScreen_Input(s_, &s->iptUsername, 280, "&gUsername..");
LScreen_Input(s_, &s->iptPassword, 280, "&gPassword..");
LScreen_Button(s_, &s->btnLogin, 100, 35, "Sign in");
LScreen_Label(s_, &s->lblStatus, "");
@ -782,8 +770,9 @@ static void MainScreen_Init(struct LScreen* s_) {
s->btnRegister.OnClick = MainScreen_Register;
/* need to set text here for right size */
s->lblUpdate.Font = Launcher_HintFont;
LLabel_SetText(&s->lblUpdate, &update);
s->lblUpdate.Font = &Launcher_HintFont;
LLabel_SetConst(&s->lblUpdate, "&eChecking..");
s->iptPassword.Password = true;
String_InitArray(pass, passBuffer);
Options_UNSAFE_Get("launcher-cc-username", &user);
@ -836,7 +825,7 @@ static void MainScreen_UnhoverWidget(struct LScreen* s_, struct LWidget* w) {
struct MainScreen* s = (struct MainScreen*)s_;
if (s->signingIn || w != (struct LWidget*)&s->btnResume) return;
LLabel_SetText(&s->lblStatus, &String_Empty);
LLabel_SetConst(&s->lblStatus, "");
LWidget_Redraw(&s->lblStatus);
}
@ -854,9 +843,6 @@ CC_NOINLINE static uint32_t MainScreen_GetVersion(const String* version) {
}
static void MainScreen_TickCheckUpdates(struct MainScreen* s) {
static const String needUpdate = String_FromConst("&aNew release");
static const String upToDate = String_FromConst("&eUp to date");
static const String failed = String_FromConst("&cCheck failed");
static const String currentStr = String_FromConst(GAME_APP_VER);
uint32_t latest, current;
@ -867,9 +853,9 @@ static void MainScreen_TickCheckUpdates(struct MainScreen* s) {
if (CheckUpdateTask.Base.Success) {
latest = MainScreen_GetVersion(&CheckUpdateTask.LatestRelease);
current = MainScreen_GetVersion(&currentStr);
LLabel_SetText(&s->lblUpdate, latest > current ? &needUpdate : &upToDate);
LLabel_SetConst(&s->lblUpdate, latest > current ? "&aNew release" : "&eUp to date");
} else {
LLabel_SetText(&s->lblUpdate, &failed);
LLabel_SetConst(&s->lblUpdate, "&cCheck failed");
}
LWidget_Redraw(&s->lblUpdate);
}
@ -887,7 +873,6 @@ static void MainScreen_TickGetToken(struct MainScreen* s) {
}
static void MainScreen_TickSignIn(struct MainScreen* s) {
static const String fetchMsg = String_FromConst("&eRetrieving servers list..");
if (!SignInTask.Base.Working) return;
LWebTask_Tick(&SignInTask.Base);
if (!SignInTask.Base.Completed) return;
@ -903,7 +888,7 @@ static void MainScreen_TickSignIn(struct MainScreen* s) {
}
FetchServersTask_Run();
LLabel_SetText(&s->lblStatus, &fetchMsg);
LLabel_SetConst(&s->lblStatus, "&eRetrieving servers list..");
LWidget_Redraw(&s->lblStatus);
} else {
MainScreen_Error(&SignInTask.Base, "signing in");
@ -1017,7 +1002,7 @@ static void ResourcesScreen_Init(struct LScreen* s_) {
String_InitArray(str, buffer);
size = Resources_Size / 1024.0f;
s->lblStatus.Font = Launcher_HintFont;
s->lblStatus.Font = &Launcher_HintFont;
String_Format1(&str, "&eDownload size: %f2 megabytes", &size);
LLabel_SetText(&s->lblStatus, &str);
@ -1160,13 +1145,12 @@ static void ServersScreen_Connect(void* w, int x, int y) {
}
static void ServersScreen_Refresh(void* w, int x, int y) {
static const String working = String_FromConst("&eWorking..");
struct LButton* btn;
if (FetchServersTask.Base.Working) return;
FetchServersTask_Run();
btn = &ServersScreen_Instance.btnRefresh;
LButton_SetText(btn, &working);
LButton_SetConst(btn, "&eWorking..");
LWidget_Redraw(btn);
}
@ -1215,8 +1199,8 @@ static void ServersScreen_InitWidgets(struct LScreen* s_) {
struct ServersScreen* s = (struct ServersScreen*)s_;
s->widgets = s->_widgets;
LScreen_Input(s_, &s->iptSearch, 370, false, "&gSearch servers..");
LScreen_Input(s_, &s->iptHash, 475, false, "&gclassicube.net/server/play/...");
LScreen_Input(s_, &s->iptSearch, 370, "&gSearch servers..");
LScreen_Input(s_, &s->iptHash, 475, "&gclassicube.net/server/play/...");
LScreen_Button(s_, &s->btnBack, 110, 30, "Back");
LScreen_Button(s_, &s->btnConnect, 130, 30, "Connect");
@ -1230,7 +1214,7 @@ static void ServersScreen_InitWidgets(struct LScreen* s_) {
s->iptHash.TextChanged = ServersScreen_HashChanged;
s->iptHash.ClipboardFilter = ServersScreen_HashFilter;
LTable_Init(&s->table, &Launcher_TextFont, &s->rowFont);
LTable_Init(&s->table, &s->rowFont);
s->table.Filter = &s->iptSearch.Text;
s->table.SelectedHash = &s->iptHash.Text;
s->table.OnSelectedChanged = ServersScreen_OnSelectedChanged;
@ -1243,7 +1227,7 @@ static void ServersScreen_Init(struct LScreen* s_) {
Drawer2D_MakeFont(&s->rowFont, 11, FONT_STYLE_NORMAL);
if (!s->numWidgets) ServersScreen_InitWidgets(s_);
s->table.RowFont = s->rowFont;
s->table.RowFont = &s->rowFont;
/* also resets hash and filter */
LTable_Reset(&s->table);
@ -1252,8 +1236,6 @@ static void ServersScreen_Init(struct LScreen* s_) {
}
static void ServersScreen_Tick(struct LScreen* s_) {
static const String refresh = String_FromConst("Refresh");
static const String failed = String_FromConst("&cFailed");
struct ServersScreen* s = (struct ServersScreen*)s_;
int count;
LScreen_Tick(s_);
@ -1272,8 +1254,8 @@ static void ServersScreen_Tick(struct LScreen* s_) {
LWidget_Draw(&s->table);
}
LButton_SetText(&s->btnRefresh,
FetchServersTask.Base.Success ? &refresh : &failed);
LButton_SetConst(&s->btnRefresh,
FetchServersTask.Base.Success ? "Refresh" : "&cFailed");
LWidget_Redraw(&s->btnRefresh);
}

View file

@ -116,7 +116,7 @@ static void LButton_Draw(void* widget) {
xOffset = w->Width - w->_TextSize.Width;
yOffset = w->Height - w->_TextSize.Height;
DrawTextArgs_Make(&args, &w->Text, &w->Font, true);
DrawTextArgs_Make(&args, &w->Text, &Launcher_TitleFont, true);
LButton_DrawBackground(w);
LButton_DrawBorder(w);
@ -141,19 +141,17 @@ static struct LWidgetVTABLE lbutton_VTABLE = {
LButton_Hover, LButton_Draw, /* Hover */
NULL, NULL /* Select */
};
void LButton_Init(struct LButton* w, const FontDesc* font, int width, int height) {
void LButton_Init(struct LButton* w, int width, int height) {
w->VTABLE = &lbutton_VTABLE;
w->TabSelectable = true;
w->Font = *font;
w->Width = Display_ScaleX(width);
w->Height = Display_ScaleY(height);
String_InitArray(w->Text, w->_TextBuffer);
}
void LButton_SetText(struct LButton* w, const String* text) {
void LButton_SetConst(struct LButton* w, const char* text) {
struct DrawTextArgs args;
String_Copy(&w->Text, text);
DrawTextArgs_Make(&args, text, &w->Font, true);
w->Text = String_FromReadonly(text);
DrawTextArgs_Make(&args, &w->Text, &Launcher_TitleFont, true);
w->_TextSize = Drawer2D_MeasureText(&args);
}
@ -237,7 +235,7 @@ static void LInput_DrawText(struct LInput* w, struct DrawTextArgs* args) {
Drawer2D_DrawText(&Launcher_Framebuffer, args, w->X + 5, y + 2);
} else {
args->text = String_FromReadonly(w->HintText);
args->font = w->HintFont;
args->font = Launcher_HintFont;
hintHeight = Drawer2D_MeasureText(args).Height;
y = w->Y + (w->Height - hintHeight) / 2;
@ -256,7 +254,7 @@ static void LInput_Draw(void* widget) {
String_InitArray(text, textBuffer);
LInput_GetText(w, &text);
DrawTextArgs_Make(&args, &text, &w->Font, false);
DrawTextArgs_Make(&args, &text, &Launcher_TextFont, false);
size = Drawer2D_MeasureText(&args);
w->Width = max(w->MinWidth, size.Width + 20);
@ -282,7 +280,7 @@ static Rect2D LInput_MeasureCaret(struct LInput* w) {
String_InitArray(text, textBuffer);
LInput_GetText(w, &text);
DrawTextArgs_Make(&args, &text, &w->Font, true);
DrawTextArgs_Make(&args, &text, &Launcher_TextFont, true);
r.X = w->X + 5;
r.Y = w->Y + w->Height - 5; r.Height = 2;
@ -361,7 +359,7 @@ static void LInput_MoveCaretToCursor(struct LInput* w) {
LInput_GetText(w, &text);
x -= w->X; y -= w->Y;
DrawTextArgs_Make(&args, &text, &w->Font, true);
DrawTextArgs_Make(&args, &text, &Launcher_TextFont, true);
if (x >= Drawer2D_TextWidth(&args)) {
w->CaretPos = -1; return;
}
@ -436,18 +434,16 @@ static struct LWidgetVTABLE linput_VTABLE = {
/* TODO: Don't redraw whole thing, just the outer border */
LInput_Select, LInput_Unselect /* Select */
};
void LInput_Init(struct LInput* w, const FontDesc* font, int width, int height, const char* hintText, const FontDesc* hintFont) {
void LInput_Init(struct LInput* w, int width, int height, const char* hintText) {
w->VTABLE = &linput_VTABLE;
w->TabSelectable = true;
String_InitArray(w->Text, w->_TextBuffer);
w->Font = *font;
w->Width = Display_ScaleX(width);
w->Height = Display_ScaleY(height);
w->MinWidth = w->Width;
LWidget_CalcPosition(w);
w->HintFont = *hintFont;
w->HintText = hintText;
w->CaretPos = -1;
}
@ -460,7 +456,7 @@ void LInput_SetText(struct LInput* w, const String* text_) {
String_Copy(&w->Text, text_);
String_InitArray(text, textBuffer);
LInput_GetText(w, &text);
DrawTextArgs_Make(&args, &text, &w->Font, true);
DrawTextArgs_Make(&args, &text, &Launcher_TextFont, true);
size = Drawer2D_MeasureText(&args);
w->Width = max(w->MinWidth, size.Width + 20);
@ -541,7 +537,7 @@ static void LLabel_Draw(void* widget) {
struct DrawTextArgs args;
if (w->Hidden) return;
DrawTextArgs_Make(&args, &w->Text, &w->Font, true);
DrawTextArgs_Make(&args, &w->Text, w->Font, true);
Drawer2D_DrawText(&Launcher_Framebuffer, &args, w->X, w->Y);
Launcher_MarkDirty(w->X, w->Y, w->Width, w->Height);
}
@ -552,10 +548,10 @@ static struct LWidgetVTABLE llabel_VTABLE = {
NULL, NULL, /* Hover */
NULL, NULL /* Select */
};
void LLabel_Init(struct LLabel* w, const FontDesc* font) {
void LLabel_Init(struct LLabel* w) {
w->VTABLE = &llabel_VTABLE;
String_InitArray(w->Text, w->_TextBuffer);
w->Font = *font;
w->Font = &Launcher_TextFont;
}
void LLabel_SetText(struct LLabel* w, const String* text) {
@ -563,12 +559,17 @@ void LLabel_SetText(struct LLabel* w, const String* text) {
Size2D size;
String_Copy(&w->Text, text);
DrawTextArgs_Make(&args, &w->Text, &w->Font, true);
DrawTextArgs_Make(&args, &w->Text, w->Font, true);
size = Drawer2D_MeasureText(&args);
w->Width = size.Width; w->Height = size.Height;
LWidget_CalcPosition(w);
}
void LLabel_SetConst(struct LLabel* w, const char* text) {
String str = String_FromReadonly(text);
LLabel_SetText(w, &str);
}
/*########################################################################################################################*
*-------------------------------------------------------BoxWidget---------------------------------------------------------*
@ -849,7 +850,7 @@ static void LTable_DrawHeaders(struct LTable* w) {
struct DrawTextArgs args;
int i, x, y;
DrawTextArgs_MakeEmpty(&args, &w->HdrFont, true);
DrawTextArgs_MakeEmpty(&args, &Launcher_TextFont, true);
x = w->X; y = w->Y;
for (i = 0; i < w->NumColumns; i++) {
@ -871,7 +872,7 @@ static void LTable_DrawRows(struct LTable* w) {
int i, x, y, row, end;
String_InitArray(str, strBuffer);
DrawTextArgs_Make(&args, &str, &w->RowFont, true);
DrawTextArgs_Make(&args, &str, w->RowFont, true);
y = w->RowsBegY;
end = w->TopRow + w->VisibleRows;
@ -1055,8 +1056,8 @@ static void LTable_StopDragging(void* widget) {
void LTable_Reposition(struct LTable* w) {
int rowsHeight;
w->HdrHeight = Drawer2D_FontHeight(&w->HdrFont, true) + HDR_YPADDING;
w->RowHeight = Drawer2D_FontHeight(&w->RowFont, true) + ROW_YPADDING;
w->HdrHeight = Drawer2D_FontHeight(&Launcher_TextFont, true) + HDR_YPADDING;
w->RowHeight = Drawer2D_FontHeight(w->RowFont, true) + ROW_YPADDING;
w->RowsBegY = w->Y + w->HdrHeight + w->GridlineHeight;
w->RowsEndY = w->Y + w->Height;
@ -1082,13 +1083,11 @@ static struct LWidgetVTABLE ltable_VTABLE = {
LTable_MouseDown, LTable_StopDragging, /* Select */
LTable_MouseWheel, /* Wheel */
};
void LTable_Init(struct LTable* w, const FontDesc* hdrFont, const FontDesc* rowFont) {
void LTable_Init(struct LTable* w, FontDesc* rowFont) {
w->VTABLE = &ltable_VTABLE;
w->Columns = tableColumns;
w->NumColumns = Array_Elems(tableColumns);
w->HdrFont = *hdrFont;
w->RowFont = *rowFont;
w->RowFont = rowFont;
w->ScrollbarWidth = Display_ScaleX(10);
w->GridlineWidth = Display_ScaleX(2);

View file

@ -52,12 +52,10 @@ void LWidget_Redraw(void* widget);
struct LButton {
LWidget_Layout
String Text;
FontDesc Font;
Size2D _TextSize;
char _TextBuffer[STRING_SIZE];
};
CC_NOINLINE void LButton_Init(struct LButton* w, const FontDesc* font, int width, int height);
CC_NOINLINE void LButton_SetText(struct LButton* w, const String* text);
CC_NOINLINE void LButton_Init(struct LButton* w, int width, int height);
CC_NOINLINE void LButton_SetConst(struct LButton* w, const char* text);
struct LInput;
struct LInput {
@ -74,12 +72,11 @@ struct LInput {
/* Specifies the position that characters are inserted/deleted from. */
/* NOTE: -1 to insert/delete characters at end of the text. */
int CaretPos;
FontDesc Font, HintFont;
String Text;
int _TextHeight;
char _TextBuffer[STRING_SIZE];
};
CC_NOINLINE void LInput_Init(struct LInput* w, const FontDesc* font, int width, int height, const char* hintText, const FontDesc* hintFont);
CC_NOINLINE void LInput_Init(struct LInput* w, int width, int height, const char* hintText);
CC_NOINLINE void LInput_SetText(struct LInput* w, const String* text);
/* Appends a character to the currently entered text. */
@ -96,13 +93,14 @@ CC_NOINLINE bool LInput_Clear(struct LInput* w);
/* Represents non-interactable text. */
struct LLabel {
LWidget_Layout
FontDesc Font;
FontDesc* Font;
String Text;
Size2D _TextSize;
char _TextBuffer[STRING_SIZE];
};
CC_NOINLINE void LLabel_Init(struct LLabel* w, const FontDesc* font);
CC_NOINLINE void LLabel_Init(struct LLabel* w);
CC_NOINLINE void LLabel_SetText(struct LLabel* w, const String* text);
CC_NOINLINE void LLabel_SetConst(struct LLabel* w, const char* text);
/* Represents a coloured rectangle. Usually used as a line separator. */
struct LBox {
@ -149,8 +147,8 @@ struct LTable {
struct LTableColumn* Columns;
/* Number of columns in the table. */
int NumColumns;
/* Fonts for text in header and rows. */
FontDesc RowFont, HdrFont;
/* Fonts for text in rows. */
FontDesc* RowFont;
/* Y start and end of rows and height of each row. */
int RowsBegY, RowsEndY, RowHeight;
/* Y height of headers. */
@ -186,7 +184,7 @@ struct LTable {
/* Initialises a table. */
/* NOTE: Must also call LTable_Reset to make a table actually useful. */
void LTable_Init(struct LTable* table, const FontDesc* hdrFont, const FontDesc* rowFont);
void LTable_Init(struct LTable* table, FontDesc* rowFont);
/* Resets state of a table (reset sorter, filter, etc) */
void LTable_Reset(struct LTable* table);
/* Adjusts Y position of rows and number of visible rows. */