summaryrefslogtreecommitdiff
path: root/widgetfactory.cpp
diff options
context:
space:
mode:
authorJonas Kümmerlin <jonas@kuemmerlin.eu>2020-05-04 19:57:19 +0200
committerJonas Kümmerlin <jonas@kuemmerlin.eu>2020-05-04 19:57:19 +0200
commit0f20107854d1e619b347110c459c253b6e07b71c (patch)
treedba4ee5425c2ab0dad5113ad80bef7f352ffd2e5 /widgetfactory.cpp
parent7d608f736bec340715ac4063391b086eb3fdbe77 (diff)
widget factory: test label alignment (broken atm)
Diffstat (limited to 'widgetfactory.cpp')
-rw-r--r--widgetfactory.cpp70
1 files changed, 62 insertions, 8 deletions
diff --git a/widgetfactory.cpp b/widgetfactory.cpp
index b0c0fdd..1215e10 100644
--- a/widgetfactory.cpp
+++ b/widgetfactory.cpp
@@ -415,24 +415,78 @@ buttonPanelAddToNotebook(HWND hwndNotebook)
/* label panel */
+//FIXME! replace with real widget
+static HWND
+makeSeparator(HWND parent, int x, int y)
+{
+ HWND p = ALF_AddPanel(parent, (WORD)-1, x, y);
+ ALF_PanelSetEdge(p, BDR_SUNKENOUTER);
+ return p;
+}
+
static void
labelPanelAttach(void *closure, HWND panel)
{
(void)closure;
- ALF_AddLabel(panel, (WORD)-1, 0, 2, TEXT("N&ormal"));
- HWND l = ALF_AddLabel(panel, (WORD)-1, 0, 4, TEXT("Disabled"));
- EnableWindow(l, FALSE);
-
- ALF_AddEdit(panel, (WORD)-1, 3, 2, TEXT("Baseline Comparison"));
- l = ALF_AddLabel(panel, (WORD)-1, 3, 4, TEXT("Left Comparison"));
+ HWND l, g;
+
+ g = ALF_AddGroupBox(panel, (WORD)-1, 0, 0, TEXT("Horizontal and Vertical"));
+ l = ALF_AddLabel(g, (WORD)-1, 0, 0, TEXT("Left\r\nTop"));
+ ALF_LabelSetStyle(l, ALF_LABEL_ALIGN_LEFT | ALF_LABEL_ALIGN_TOP);
+ l = ALF_AddLabel(g, (WORD)-1, 0, 2, TEXT("Left\r\nCenter"));
+ ALF_LabelSetStyle(l, ALF_LABEL_ALIGN_LEFT | ALF_LABEL_ALIGN_VCENTER);
+ l = ALF_AddLabel(g, (WORD)-1, 0, 4, TEXT("Left\r\nBottom"));
+ ALF_LabelSetStyle(l, ALF_LABEL_ALIGN_LEFT | ALF_LABEL_ALIGN_BOTTOM);
+ l = ALF_AddLabel(g, (WORD)-1, 2, 0, TEXT("Center\r\nTop"));
+ ALF_LabelSetStyle(l, ALF_LABEL_ALIGN_HCENTER | ALF_LABEL_ALIGN_TOP);
+ l = ALF_AddLabel(g, (WORD)-1, 2, 2, TEXT("Center\r\nCenter"));
+ ALF_LabelSetStyle(l, ALF_LABEL_ALIGN_HCENTER | ALF_LABEL_ALIGN_VCENTER);
+ l = ALF_AddLabel(g, (WORD)-1, 2, 4, TEXT("Center\r\nBottom"));
+ ALF_LabelSetStyle(l, ALF_LABEL_ALIGN_HCENTER | ALF_LABEL_ALIGN_BOTTOM);
+ l = ALF_AddLabel(g, (WORD)-1, 4, 0, TEXT("Right\r\nTop"));
+ ALF_LabelSetStyle(l, ALF_LABEL_ALIGN_RIGHT | ALF_LABEL_ALIGN_TOP);
+ l = ALF_AddLabel(g, (WORD)-1, 4, 2, TEXT("Right\r\nCenter"));
+ ALF_LabelSetStyle(l, ALF_LABEL_ALIGN_RIGHT | ALF_LABEL_ALIGN_VCENTER);
+ l = ALF_AddLabel(g, (WORD)-1, 4, 4, TEXT("Right\r\nBottom"));
+ ALF_LabelSetStyle(l, ALF_LABEL_ALIGN_RIGHT | ALF_LABEL_ALIGN_BOTTOM);
+
+ makeSeparator(g, 0, 1);
+ makeSeparator(g, 0, 3);
+ makeSeparator(g, 2, 1);
+ makeSeparator(g, 2, 3);
+ makeSeparator(g, 4, 1);
+ makeSeparator(g, 4, 3);
+
+ ALF_LayoutSetRowExpandNumerator(g, 0, 1);
+ ALF_LayoutSetRowExpandNumerator(g, 2, 1);
+ ALF_LayoutSetRowExpandNumerator(g, 4, 1);
+
+ makeSeparator(g, 1, 0);
+ makeSeparator(g, 1, 2);
+ makeSeparator(g, 1, 4);
+ makeSeparator(g, 3, 0);
+ makeSeparator(g, 3, 2);
+ makeSeparator(g, 3, 4);
+
+ ALF_LayoutSetColumnExpandNumerator(g, 0, 1);
+ ALF_LayoutSetColumnExpandNumerator(g, 2, 1);
+ ALF_LayoutSetColumnExpandNumerator(g, 4, 1);
+
+ g = ALF_AddGroupBox(panel, (WORD)-1, 1, 0, TEXT("Like Edit"));
+ ALF_AddLabel(g, (WORD)-1, 1, 2, TEXT("Bas&eline"));
+ ALF_AddEdit(g, (WORD)-1, 3, 2, TEXT("Baseline Comparison"));
+ l = ALF_AddLabel(g, (WORD)-1, 3, 4, TEXT("Left Comparison"));
ALF_LabelSetStyle(l, ALF_LABEL_ALIGN_LEFT_LIKE_EDIT | ALF_LABEL_ALIGN_TOP);
- l = ALF_AddLabel(panel, (WORD)-1, 0, 6, TEXT("Colored"));
+ g = ALF_AddGroupBox(panel, (WORD)-1, 0, 2, TEXT("Other Stuff"));
+ l = ALF_AddLabel(g, (WORD)-1, 0, 0, TEXT("Colored"));
ALF_SetBackgroundColor(l, ALF_COLOR_RGB(0, 0, 255));
ALF_SetTextColor(l, ALF_COLOR_RGB(255, 255, 255));
+ l = ALF_AddLabel(g, (WORD)-1, 0, 1, TEXT("Disabled"));
+ EnableWindow(l, FALSE);
- // TODO: demo right, center, bottom alignment
+ ALF_LayoutSetRowExpandNumerator(panel, 0, 1);
}
static ALFPanelVTable labelPanelVtbl = {