1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-04 21:04:18 +01:00

added colorwell updating through colorpanel

added delegate and new functions to tabview
This commit is contained in:
kojima
1999-05-17 03:55:35 +00:00
parent 07e83b45d0
commit aff8982859
5 changed files with 70 additions and 8 deletions

View File

@@ -27,6 +27,7 @@ changes since wmaker 0.53.0:
manually when you change the text. manually when you change the text.
- added WMTabView - added WMTabView
- added WMGetColorPanelColor(WMColorPanel *panel)
changes since wmaker 0.52.0: changes since wmaker 0.52.0:
............................ ............................

View File

@@ -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); void WMSetColorPanelColor(WMColorPanel *panel, WMColor *color);
WMColor *WMGetColorPanelColor(WMColorPanel *panel);
void WMSetColorPanelPickerMode(WMColorPanel *panel, WMColorPanelMode mode); void WMSetColorPanelPickerMode(WMColorPanel *panel, WMColorPanelMode mode);
void WMSetColorPanelAction(WMColorPanel *panel, WMAction2 *action, void *data); 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 WMSelectTabViewItemAtIndex(WMTabView *tPtr, int index);
void WMSetTabViewDelegate(WMTabView *tPtr, WMTabViewDelegate *delegate);
WMTabViewItem *WMCreateTabViewItemWithIdentifier(int identifier); WMTabViewItem *WMCreateTabViewItemWithIdentifier(int identifier);
int WMGetTabViewItemIdentifier(WMTabViewItem *item);
void WMSetTabViewItemLabel(WMTabViewItem *item, char *label); void WMSetTabViewItemLabel(WMTabViewItem *item, char *label);
char *WMGetTabViewItemLabel(WMTabViewItem *item); char *WMGetTabViewItemLabel(WMTabViewItem *item);

View File

@@ -1289,10 +1289,17 @@ WMSetColorPanelPickerMode(WMColorPanel *panel, WMColorPanelMode mode)
WMSetButtonSelected(panel->colorListBtn, True); WMSetButtonSelected(panel->colorListBtn, True);
} }
panel->mode = mode; panel->mode = mode;
} }
WMColor*
WMGetColorPanelColor(WMColorPanel *panel)
{
return WMGetColorWellColor(panel->colorWell);
}
void void
WMSetColorPanelColor(WMColorPanel *panel, WMColor *color) WMSetColorPanelColor(WMColorPanel *panel, WMColor *color)
{ {

View File

@@ -69,7 +69,6 @@ static WMDragSourceProcs dragProcs = {
static void static void
colorChangedObserver(void *data, WMNotification *notification) colorChangedObserver(void *data, WMNotification *notification)
{ {
/*
WMColorPanel *panel = (WMColorPanel*)WMGetNotificationObject(notification); WMColorPanel *panel = (WMColorPanel*)WMGetNotificationObject(notification);
WMColorWell *cPtr = (WMColorWell*)data; WMColorWell *cPtr = (WMColorWell*)data;
WMColor *color; WMColor *color;
@@ -79,21 +78,21 @@ colorChangedObserver(void *data, WMNotification *notification)
color = WMGetColorPanelColor(panel); color = WMGetColorPanelColor(panel);
WMSetColorWellColor(cPtr, color);*/ WMSetColorWellColor(cPtr, color);
WMPostNotificationName(WMColorWellDidChangeNotification, cPtr, NULL);
} }
static void static void
updateColorCallback(void *self, void *data) updateColorCallback(void *self, void *data)
{ {
/*
WMColorPanel *panel = (WMColorPanel*)self; WMColorPanel *panel = (WMColorPanel*)self;
WMColorWell *cPtr = (ColorWell*)data; WMColorWell *cPtr = (ColorWell*)data;
WMColor *color; WMColor *color;
color = WMGetColorPanelColor(panel); color = WMGetColorPanelColor(panel);
WMSetColorWellColor(cPtr, color);*/ WMSetColorWellColor(cPtr, color);
WMPostNotificationName(WMColorWellDidChangeNotification, cPtr, NULL);
} }

View File

@@ -17,6 +17,8 @@ typedef struct W_TabView {
WMColor *lightGray; WMColor *lightGray;
WMColor *tabColor; WMColor *tabColor;
WMTabViewDelegate *delegate;
short tabWidth; short tabWidth;
short tabHeight; short tabHeight;
@@ -127,6 +129,13 @@ WMCreateTabView(WMWidget *parent)
} }
void
WMSetTabViewDelegate(WMTabView *tPtr, WMTabViewDelegate *delegate)
{
tPtr->delegate = delegate;
}
void void
WMAddItemInTabView(WMTabView *tPtr, WMTabViewItem *item) WMAddItemInTabView(WMTabView *tPtr, WMTabViewItem *item)
{ {
@@ -184,6 +193,8 @@ WMInsertItemInTabView(WMTabView *tPtr, int index, WMTabViewItem *item)
if (index == 0) { if (index == 0) {
W_MapTabViewItem(item); 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; 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) else if (index >= tPtr->itemCount)
index = tPtr->itemCount - 1; index = tPtr->itemCount - 1;
item = tPtr->items[tPtr->selectedItem]; 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); W_UnmapTabViewItem(item);
@@ -329,6 +350,10 @@ WMSelectTabViewItemAtIndex(WMTabView *tPtr, int index)
W_MapTabViewItem(item); W_MapTabViewItem(item);
tPtr->selectedItem = index; 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 void
WMSetTabViewFont(WMTabView *tPtr, WMFont *font) WMSetTabViewFont(WMTabView *tPtr, WMFont *font)
{ {