mirror of
https://github.com/gryf/wmaker.git
synced 2026-03-19 09:13:33 +01:00
WINGs: wpopupbutton add two functions to change the displayed item
This patch is adding WMSelectPopUpButtonPreviousItem and WMSelectPopUpButtonNextItem functions to the widget. The WINGs lib version is bumped.
This commit is contained in:
committed by
Carlos R. Mafra
parent
c82e6dad5c
commit
156841f80e
@@ -1462,6 +1462,10 @@ void WMSetPopUpButtonEnabled(WMPopUpButton *bPtr, Bool flag);
|
||||
|
||||
Bool WMGetPopUpButtonEnabled(WMPopUpButton *bPtr);
|
||||
|
||||
int WMSelectPopUpButtonPreviousItem(WMPopUpButton *bPtr);
|
||||
|
||||
int WMSelectPopUpButtonNextItem(WMPopUpButton *bPtr);
|
||||
|
||||
/* ---[ WINGs/wprogressindicator.c ]------------------------------------- */
|
||||
|
||||
WMProgressIndicator* WMCreateProgressIndicator(WMWidget *parent);
|
||||
|
||||
@@ -252,6 +252,56 @@ WMMenuItem *WMGetPopUpButtonMenuItem(WMPopUpButton * bPtr, int index)
|
||||
return WMGetFromArray(bPtr->items, index);
|
||||
}
|
||||
|
||||
int WMSelectPopUpButtonPreviousItem(WMPopUpButton * bPtr)
|
||||
{
|
||||
int testIndex;
|
||||
|
||||
CHECK_CLASS(bPtr, WC_PopUpButton);
|
||||
|
||||
if (bPtr->flags.pullsDown || bPtr->selectedItemIndex < 0)
|
||||
return -1;
|
||||
|
||||
testIndex = bPtr->selectedItemIndex - 1;
|
||||
|
||||
while (testIndex >= 0 && !WMGetPopUpButtonItemEnabled(bPtr, testIndex))
|
||||
testIndex--;
|
||||
|
||||
if (testIndex != -1) {
|
||||
WMSetPopUpButtonSelectedItem(bPtr, testIndex);
|
||||
if (bPtr->action)
|
||||
(*bPtr->action) (bPtr, bPtr->clientData);
|
||||
return testIndex;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int WMSelectPopUpButtonNextItem(WMPopUpButton * bPtr)
|
||||
{
|
||||
int itemCount;
|
||||
int testIndex;
|
||||
|
||||
CHECK_CLASS(bPtr, WC_PopUpButton);
|
||||
|
||||
if (bPtr->flags.pullsDown || bPtr->selectedItemIndex < 0)
|
||||
return -1;
|
||||
|
||||
itemCount = WMGetArrayItemCount(bPtr->items);
|
||||
testIndex = bPtr->selectedItemIndex + 1;
|
||||
|
||||
while (testIndex < itemCount && !WMGetPopUpButtonItemEnabled(bPtr, testIndex))
|
||||
testIndex++;
|
||||
|
||||
if (testIndex != itemCount) {
|
||||
WMSetPopUpButtonSelectedItem(bPtr, testIndex);
|
||||
if (bPtr->action)
|
||||
(*bPtr->action) (bPtr, bPtr->clientData);
|
||||
return testIndex;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void paintPopUpButton(PopUpButton * bPtr)
|
||||
{
|
||||
W_Screen *scr = bPtr->view->screen;
|
||||
|
||||
@@ -78,9 +78,9 @@ WRASTER_VERSION=$WRASTER_CURRENT:$WRASTER_REVISION:$WRASTER_AGE
|
||||
AC_SUBST(WRASTER_VERSION)
|
||||
dnl
|
||||
dnl libWINGs
|
||||
WINGS_CURRENT=5
|
||||
WINGS_CURRENT=6
|
||||
WINGS_REVISION=0
|
||||
WINGS_AGE=2
|
||||
WINGS_AGE=3
|
||||
WINGS_VERSION=$WINGS_CURRENT:$WINGS_REVISION:$WINGS_AGE
|
||||
AC_SUBST(WINGS_VERSION)
|
||||
dnl
|
||||
|
||||
Reference in New Issue
Block a user