mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-07 22:34:18 +01:00
added colorwell updating through colorpanel
added delegate and new functions to tabview
This commit is contained in:
@@ -27,6 +27,7 @@ changes since wmaker 0.53.0:
|
||||
manually when you change the text.
|
||||
|
||||
- added WMTabView
|
||||
- added WMGetColorPanelColor(WMColorPanel *panel)
|
||||
|
||||
changes since wmaker 0.52.0:
|
||||
............................
|
||||
|
||||
@@ -453,6 +453,24 @@ typedef struct WMTextFieldDelegate {
|
||||
|
||||
|
||||
|
||||
typedef struct WMTabViewDelegate {
|
||||
void *data;
|
||||
|
||||
void (*didChangeNumberOfItems)(struct WMTabViewDelegate *self,
|
||||
WMTabView *tabView);
|
||||
|
||||
void (*didSelectItem)(struct WMTabViewDelegate *self, WMTabView *tabView,
|
||||
WMTabViewItem *item);
|
||||
|
||||
Bool (*shouldSelectItem)(struct WMTabViewDelegate *self, WMTabView *tabView,
|
||||
WMTabViewItem *item);
|
||||
|
||||
void (*willSelectItem)(struct WMTabViewDelegate *self, WMTabView *tabView,
|
||||
WMTabViewItem *item);
|
||||
} WMTabViewDelegate;
|
||||
|
||||
|
||||
|
||||
/* ....................................................................... */
|
||||
|
||||
|
||||
@@ -1025,6 +1043,8 @@ void WMCloseColorPanel(WMColorPanel *panel);
|
||||
|
||||
void WMSetColorPanelColor(WMColorPanel *panel, WMColor *color);
|
||||
|
||||
WMColor *WMGetColorPanelColor(WMColorPanel *panel);
|
||||
|
||||
void WMSetColorPanelPickerMode(WMColorPanel *panel, WMColorPanelMode mode);
|
||||
|
||||
void WMSetColorPanelAction(WMColorPanel *panel, WMAction2 *action, void *data);
|
||||
@@ -1143,10 +1163,13 @@ void WMSelectTabViewItem(WMTabView *tPtr, WMTabViewItem *item);
|
||||
|
||||
void WMSelectTabViewItemAtIndex(WMTabView *tPtr, int index);
|
||||
|
||||
void WMSetTabViewDelegate(WMTabView *tPtr, WMTabViewDelegate *delegate);
|
||||
|
||||
|
||||
WMTabViewItem *WMCreateTabViewItemWithIdentifier(int identifier);
|
||||
|
||||
int WMGetTabViewItemIdentifier(WMTabViewItem *item);
|
||||
|
||||
void WMSetTabViewItemLabel(WMTabViewItem *item, char *label);
|
||||
|
||||
char *WMGetTabViewItemLabel(WMTabViewItem *item);
|
||||
|
||||
@@ -1288,11 +1288,18 @@ WMSetColorPanelPickerMode(WMColorPanel *panel, WMColorPanelMode mode)
|
||||
WMMapWidget(panel->colorListFrm);
|
||||
WMSetButtonSelected(panel->colorListBtn, True);
|
||||
}
|
||||
|
||||
|
||||
|
||||
panel->mode = mode;
|
||||
}
|
||||
|
||||
|
||||
WMColor*
|
||||
WMGetColorPanelColor(WMColorPanel *panel)
|
||||
{
|
||||
return WMGetColorWellColor(panel->colorWell);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetColorPanelColor(WMColorPanel *panel, WMColor *color)
|
||||
{
|
||||
|
||||
@@ -69,7 +69,6 @@ static WMDragSourceProcs dragProcs = {
|
||||
static void
|
||||
colorChangedObserver(void *data, WMNotification *notification)
|
||||
{
|
||||
/*
|
||||
WMColorPanel *panel = (WMColorPanel*)WMGetNotificationObject(notification);
|
||||
WMColorWell *cPtr = (WMColorWell*)data;
|
||||
WMColor *color;
|
||||
@@ -79,21 +78,21 @@ colorChangedObserver(void *data, WMNotification *notification)
|
||||
|
||||
color = WMGetColorPanelColor(panel);
|
||||
|
||||
WMSetColorWellColor(cPtr, color);*/
|
||||
|
||||
WMSetColorWellColor(cPtr, color);
|
||||
WMPostNotificationName(WMColorWellDidChangeNotification, cPtr, NULL);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
updateColorCallback(void *self, void *data)
|
||||
{
|
||||
/*
|
||||
WMColorPanel *panel = (WMColorPanel*)self;
|
||||
WMColorWell *cPtr = (ColorWell*)data;
|
||||
WMColor *color;
|
||||
|
||||
color = WMGetColorPanelColor(panel);
|
||||
WMSetColorWellColor(cPtr, color);*/
|
||||
WMSetColorWellColor(cPtr, color);
|
||||
WMPostNotificationName(WMColorWellDidChangeNotification, cPtr, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ typedef struct W_TabView {
|
||||
WMColor *lightGray;
|
||||
WMColor *tabColor;
|
||||
|
||||
WMTabViewDelegate *delegate;
|
||||
|
||||
short tabWidth;
|
||||
short tabHeight;
|
||||
|
||||
@@ -127,6 +129,13 @@ WMCreateTabView(WMWidget *parent)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetTabViewDelegate(WMTabView *tPtr, WMTabViewDelegate *delegate)
|
||||
{
|
||||
tPtr->delegate = delegate;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMAddItemInTabView(WMTabView *tPtr, WMTabViewItem *item)
|
||||
{
|
||||
@@ -184,6 +193,8 @@ WMInsertItemInTabView(WMTabView *tPtr, int index, WMTabViewItem *item)
|
||||
if (index == 0) {
|
||||
W_MapTabViewItem(item);
|
||||
}
|
||||
if (tPtr->delegate && tPtr->delegate->didChangeNumberOfItems)
|
||||
(*tPtr->delegate->didChangeNumberOfItems)(tPtr->delegate, tPtr);
|
||||
}
|
||||
|
||||
|
||||
@@ -206,6 +217,8 @@ WMRemoveTabViewItem(WMTabView *tPtr, WMTabViewItem *item)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (tPtr->delegate && tPtr->delegate->didChangeNumberOfItems)
|
||||
(*tPtr->delegate->didChangeNumberOfItems)(tPtr->delegate, tPtr);
|
||||
}
|
||||
|
||||
|
||||
@@ -318,9 +331,17 @@ WMSelectTabViewItemAtIndex(WMTabView *tPtr, int index)
|
||||
else if (index >= tPtr->itemCount)
|
||||
index = tPtr->itemCount - 1;
|
||||
|
||||
|
||||
item = tPtr->items[tPtr->selectedItem];
|
||||
|
||||
if (tPtr->delegate && tPtr->delegate->shouldSelectItem)
|
||||
if (!(*tPtr->delegate->shouldSelectItem)(tPtr->delegate, tPtr,
|
||||
tPtr->items[index]))
|
||||
return;
|
||||
|
||||
if (tPtr->delegate && tPtr->delegate->willSelectItem)
|
||||
(*tPtr->delegate->willSelectItem)(tPtr->delegate, tPtr,
|
||||
tPtr->items[index]);
|
||||
|
||||
W_UnmapTabViewItem(item);
|
||||
|
||||
|
||||
@@ -329,6 +350,10 @@ WMSelectTabViewItemAtIndex(WMTabView *tPtr, int index)
|
||||
W_MapTabViewItem(item);
|
||||
|
||||
tPtr->selectedItem = index;
|
||||
|
||||
if (tPtr->delegate && tPtr->delegate->didSelectItem)
|
||||
(*tPtr->delegate->didSelectItem)(tPtr->delegate, tPtr,
|
||||
tPtr->items[index]);
|
||||
}
|
||||
|
||||
|
||||
@@ -601,6 +626,13 @@ WMCreateTabViewItemWithIdentifier(int identifier)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
WMGetTabViewItemIdentifier(WMTabViewItem *item)
|
||||
{
|
||||
return item->identifier;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetTabViewFont(WMTabView *tPtr, WMFont *font)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user