1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-06 05:44:11 +01:00

WINGs: create a new type of Tri-State Switch Button (to doc)

There are some times when we need a Switch Button (aka CheckBox) with more
than 2 states, generally to express check/uncheck/leave-as-is.

This patch extends the Button widget to support the new WBTTriState type,
similar to the existing WBTSwitch except it supports a 3rd state which is
reported to application as '-1'.

The implementation was done in order to not break the binary API. The
version have been incremented in the WINGs header to reflect the change,
but not the version in the 'configure.ac' because that have already been
done in commit c6e323e75d for the next Window Maker release.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2015-05-10 19:56:05 +02:00
committed by Carlos R. Mafra
parent 997b3e5d91
commit 976083f5b9
4 changed files with 112 additions and 7 deletions

View File

@@ -97,6 +97,66 @@ static char *RADIO_BUTTON_OFF[] = {
"..... .....",
};
#define TRISTATE_BUTTON_ON_WIDTH 15
#define TRISTATE_BUTTON_ON_HEIGHT 15
static char *TRISTATE_BUTTON_ON[] = {
"%%%%%%%%%%%%%%.",
"%%%%%%%%%%%%%. ",
"%% . ",
"%% ## ## . ",
"%% ### ### . ",
"%% ### ### . ",
"%% ##### . ",
"%% ### . ",
"%% ##### . ",
"%% ### ### . ",
"%% ### ### . ",
"%% ## ## . ",
"%% . ",
"%............. ",
". ",
};
#define TRISTATE_BUTTON_OFF_WIDTH 15
#define TRISTATE_BUTTON_OFF_HEIGHT 15
static char *TRISTATE_BUTTON_OFF[] = {
"%%%%%%%%%%%%%%.",
"%%%%%%%%%%%%%. ",
"%% . ",
"%% . ",
"%% . ",
"%% . ",
"%% . ",
"%% . ",
"%% . ",
"%% . ",
"%% . ",
"%% . ",
"%% . ",
"%............. ",
". ",
};
#define TRISTATE_BUTTON_TRI_WIDTH 15
#define TRISTATE_BUTTON_TRI_HEIGHT 15
static char *TRISTATE_BUTTON_TRI[] = {
"%%%%%%%%%%%%%%.",
"%%%%%%%%%%%%%. ",
"%% . ",
"%% # # # # # . ",
"%% # # # # . ",
"%% # # # # # . ",
"%% # # # # . ",
"%% # # # # # . ",
"%% # # # # . ",
"%% # # # # # . ",
"%% # # # # . ",
"%% # # # # # . ",
"%% . ",
"%............. ",
". ",
};
static char *BUTTON_ARROW[] = {
"..................",
"....##....#### ...",
@@ -729,6 +789,15 @@ WMScreen *WMCreateScreenWithRContext(Display * display, int screen, RContext * c
scrPtr->radioButtonImageOff = makePixmap(scrPtr, RADIO_BUTTON_OFF,
RADIO_BUTTON_OFF_WIDTH, RADIO_BUTTON_OFF_HEIGHT, False);
scrPtr->tristateButtonImageOn = makePixmap(scrPtr, TRISTATE_BUTTON_ON,
TRISTATE_BUTTON_ON_WIDTH, TRISTATE_BUTTON_ON_HEIGHT, False);
scrPtr->tristateButtonImageOff = makePixmap(scrPtr, TRISTATE_BUTTON_OFF,
TRISTATE_BUTTON_OFF_WIDTH, TRISTATE_BUTTON_OFF_HEIGHT, False);
scrPtr->tristateButtonImageTri = makePixmap(scrPtr, TRISTATE_BUTTON_TRI,
TRISTATE_BUTTON_TRI_WIDTH, TRISTATE_BUTTON_TRI_HEIGHT, False);
scrPtr->buttonArrow = makePixmap(scrPtr, BUTTON_ARROW, BUTTON_ARROW_WIDTH, BUTTON_ARROW_HEIGHT, False);
scrPtr->pushedButtonArrow = makePixmap(scrPtr, BUTTON_ARROW2,