WINGs/Tests is useful. it's almost as if it was documentation.
>From 68f286ba8960ece094dd4935158750727ee0569e Mon Sep 17 00:00:00 2001
From: Tamas TEVESZ <[email protected]>
Date: Fri, 2 Apr 2010 12:05:53 +0200
Subject: [PATCH] Make WPrefs' Expert panel scrollable
---
WPrefs.app/Expert.c | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/WPrefs.app/Expert.c b/WPrefs.app/Expert.c
index b8f8b46..f8b4dac 100644
--- a/WPrefs.app/Expert.c
+++ b/WPrefs.app/Expert.c
@@ -56,19 +56,30 @@ static void showData(_Panel * panel)
static void createPanel(Panel * p)
{
_Panel *panel = (_Panel *) p;
+ WMScrollView *sv;
+ WMFrame *f;
int i;
panel->box = WMCreateBox(panel->parent);
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
- for (i = 0; i < 9; i++) {
- panel->swi[i] = WMCreateSwitchButton(panel->box);
+ sv = WMCreateScrollView(panel->box);
+ WMResizeWidget(sv, 500, 215);
+ WMMoveWidget(sv, 12, 10);
+ WMSetScrollViewRelief(sv, WRSunken);
+ WMSetScrollViewHasVerticalScroller(sv, True);
+ WMSetScrollViewHasHorizontalScroller(sv, False);
+
+ f = WMCreateFrame(panel->box);
+ WMResizeWidget(f, 495, sizeof(panel->swi) / sizeof(char *) * 25 + 8);
+ WMSetFrameRelief(f, WRFlat);
+
+ for (i = 0; i < sizeof(panel->swi) / sizeof(char *); i++) {
+ panel->swi[i] = WMCreateSwitchButton(f);
WMResizeWidget(panel->swi[i], FRAME_WIDTH - 40, 25);
- WMMoveWidget(panel->swi[i], 20, 20 + i * 25);
+ WMMoveWidget(panel->swi[i], 5, 5 + i * 25);
}
- /* XXX: it would be HIGHLY desireable if this could scroll vertically */
-
WMSetButtonText(panel->swi[0],
_("Disable miniwindows (icons for minimized windows).
For use with KDE/GNOME."));
WMSetButtonText(panel->swi[1], _("Do not set non-WindowMaker specific
parameters (do not use xset)."));
@@ -82,8 +93,9 @@ static void createPanel(Panel * p)
WMSetButtonEnabled(panel->swi[6], True);
- WMRealizeWidget(panel->box);
WMMapSubwidgets(panel->box);
+ WMSetScrollViewContentView(sv, WMWidgetView(f));
+ WMRealizeWidget(panel->box);
showData(panel);
}
--
1.7.0
--
[-]
mkdir /nonexistentFrom 68f286ba8960ece094dd4935158750727ee0569e Mon Sep 17 00:00:00 2001
From: Tamas TEVESZ <[email protected]>
Date: Fri, 2 Apr 2010 12:05:53 +0200
Subject: [PATCH] Make WPrefs' Expert panel scrollable
---
WPrefs.app/Expert.c | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/WPrefs.app/Expert.c b/WPrefs.app/Expert.c
index b8f8b46..f8b4dac 100644
--- a/WPrefs.app/Expert.c
+++ b/WPrefs.app/Expert.c
@@ -56,19 +56,30 @@ static void showData(_Panel * panel)
static void createPanel(Panel * p)
{
_Panel *panel = (_Panel *) p;
+ WMScrollView *sv;
+ WMFrame *f;
int i;
panel->box = WMCreateBox(panel->parent);
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
- for (i = 0; i < 9; i++) {
- panel->swi[i] = WMCreateSwitchButton(panel->box);
+ sv = WMCreateScrollView(panel->box);
+ WMResizeWidget(sv, 500, 215);
+ WMMoveWidget(sv, 12, 10);
+ WMSetScrollViewRelief(sv, WRSunken);
+ WMSetScrollViewHasVerticalScroller(sv, True);
+ WMSetScrollViewHasHorizontalScroller(sv, False);
+
+ f = WMCreateFrame(panel->box);
+ WMResizeWidget(f, 495, sizeof(panel->swi) / sizeof(char *) * 25 + 8);
+ WMSetFrameRelief(f, WRFlat);
+
+ for (i = 0; i < sizeof(panel->swi) / sizeof(char *); i++) {
+ panel->swi[i] = WMCreateSwitchButton(f);
WMResizeWidget(panel->swi[i], FRAME_WIDTH - 40, 25);
- WMMoveWidget(panel->swi[i], 20, 20 + i * 25);
+ WMMoveWidget(panel->swi[i], 5, 5 + i * 25);
}
- /* XXX: it would be HIGHLY desireable if this could scroll vertically */
-
WMSetButtonText(panel->swi[0],
_("Disable miniwindows (icons for minimized windows). For use with KDE/GNOME."));
WMSetButtonText(panel->swi[1], _("Do not set non-WindowMaker specific parameters (do not use xset)."));
@@ -82,8 +93,9 @@ static void createPanel(Panel * p)
WMSetButtonEnabled(panel->swi[6], True);
- WMRealizeWidget(panel->box);
WMMapSubwidgets(panel->box);
+ WMSetScrollViewContentView(sv, WMWidgetView(f));
+ WMRealizeWidget(panel->box);
showData(panel);
}
--
1.7.0