mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +01:00
added ability to enable/disable individual WMTabViewItems
This commit is contained in:
@@ -11,6 +11,7 @@ Changes since wmaker 0.80.0:
|
|||||||
about arranging subviews after removing one and a memleak occuring in the
|
about arranging subviews after removing one and a memleak occuring in the
|
||||||
same case.
|
same case.
|
||||||
- Fixed WMGetViewScreenPosition() to consider the window decorations.
|
- Fixed WMGetViewScreenPosition() to consider the window decorations.
|
||||||
|
- Added ability to enable/disable individual WMTableViewItems.
|
||||||
|
|
||||||
|
|
||||||
Changes since wmaker 0.70.0:
|
Changes since wmaker 0.70.0:
|
||||||
|
|||||||
@@ -1701,6 +1701,8 @@ void WMSetTabViewDelegate(WMTabView *tPtr, WMTabViewDelegate *delegate);
|
|||||||
|
|
||||||
WMTabViewItem* WMCreateTabViewItemWithIdentifier(int identifier);
|
WMTabViewItem* WMCreateTabViewItemWithIdentifier(int identifier);
|
||||||
|
|
||||||
|
void WMSetTabViewItemEnabled(WMTabViewItem *tPtr, Bool flag);
|
||||||
|
|
||||||
int WMGetTabViewItemIdentifier(WMTabViewItem *item);
|
int WMGetTabViewItemIdentifier(WMTabViewItem *item);
|
||||||
|
|
||||||
void WMSetTabViewItemLabel(WMTabViewItem *item, char *label);
|
void WMSetTabViewItemLabel(WMTabViewItem *item, char *label);
|
||||||
|
|||||||
@@ -38,6 +38,23 @@ typedef struct W_TabView {
|
|||||||
} TabView;
|
} TabView;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct W_TabViewItem {
|
||||||
|
WMTabView *tabView;
|
||||||
|
|
||||||
|
W_View *view;
|
||||||
|
|
||||||
|
char *label;
|
||||||
|
|
||||||
|
short tabWidth;
|
||||||
|
int identifier;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
unsigned visible:1;
|
||||||
|
unsigned enabled:1;
|
||||||
|
} flags;
|
||||||
|
} W_TabViewItem;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -150,7 +167,10 @@ handleEvents(XEvent *event, void *data)
|
|||||||
WMTabViewItem *item = WMTabViewItemAtPoint(tPtr,
|
WMTabViewItem *item = WMTabViewItemAtPoint(tPtr,
|
||||||
event->xbutton.x,
|
event->xbutton.x,
|
||||||
event->xbutton.y);
|
event->xbutton.y);
|
||||||
if (item) {
|
/*if (item && !item->flags.enabled)
|
||||||
|
break;*/
|
||||||
|
|
||||||
|
if (item && item->flags.enabled) {
|
||||||
WMSelectTabViewItem(tPtr, item);
|
WMSelectTabViewItem(tPtr, item);
|
||||||
} else if (tPtr->flags.dontFitAll) {
|
} else if (tPtr->flags.dontFitAll) {
|
||||||
int redraw = 0;
|
int redraw = 0;
|
||||||
@@ -256,7 +276,7 @@ WMAddItemInTabView(WMTabView *tPtr, WMTabViewItem *item)
|
|||||||
void
|
void
|
||||||
WMSetTabViewEnabled(WMTabView *tPtr, Bool flag)
|
WMSetTabViewEnabled(WMTabView *tPtr, Bool flag)
|
||||||
{
|
{
|
||||||
tPtr->flags.enabled = flag;
|
tPtr->flags.enabled = (flag ? 1 : 0);
|
||||||
if (W_VIEW_REALIZED(tPtr->view))
|
if (W_VIEW_REALIZED(tPtr->view))
|
||||||
paintTabView(tPtr);
|
paintTabView(tPtr);
|
||||||
}
|
}
|
||||||
@@ -749,7 +769,8 @@ paintTabView(TabView *tPtr)
|
|||||||
rect.size.width = W_TabViewItemTabWidth(tPtr->items[first+i]);
|
rect.size.width = W_TabViewItemTabWidth(tPtr->items[first+i]);
|
||||||
rect.size.height = theight;
|
rect.size.height = theight;
|
||||||
W_DrawLabel(tPtr->items[first+i], buffer, rect,
|
W_DrawLabel(tPtr->items[first+i], buffer, rect,
|
||||||
tPtr->flags.enabled);
|
tPtr->flags.enabled &&
|
||||||
|
tPtr->items[first+i]->flags.enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (moreAtLeft) {
|
if (moreAtLeft) {
|
||||||
@@ -846,22 +867,6 @@ destroyTabView(TabView *tPtr)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
|
|
||||||
typedef struct W_TabViewItem {
|
|
||||||
WMTabView *tabView;
|
|
||||||
|
|
||||||
W_View *view;
|
|
||||||
|
|
||||||
char *label;
|
|
||||||
|
|
||||||
short tabWidth;
|
|
||||||
int identifier;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
unsigned visible:1;
|
|
||||||
} flags;
|
|
||||||
} TabViewItem;
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
W_SetTabViewItemParent(WMTabViewItem *item, WMTabView *parent)
|
W_SetTabViewItemParent(WMTabViewItem *item, WMTabView *parent)
|
||||||
{
|
{
|
||||||
@@ -937,6 +942,8 @@ WMCreateTabViewItemWithIdentifier(int identifier)
|
|||||||
|
|
||||||
item->identifier = identifier;
|
item->identifier = identifier;
|
||||||
|
|
||||||
|
item->flags.enabled = 1;
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -950,12 +957,23 @@ WMCreateTabViewItem(int identifier, char *label)
|
|||||||
memset(item, 0, sizeof(WMTabViewItem));
|
memset(item, 0, sizeof(WMTabViewItem));
|
||||||
|
|
||||||
item->identifier = identifier;
|
item->identifier = identifier;
|
||||||
|
|
||||||
|
item->flags.enabled = 1;
|
||||||
|
|
||||||
WMSetTabViewItemLabel(item, label);
|
WMSetTabViewItemLabel(item, label);
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
WMSetTabViewItemEnabled(WMTabViewItem *tPtr, Bool flag)
|
||||||
|
{
|
||||||
|
tPtr->flags.enabled = (flag ? 1 : 0);
|
||||||
|
if (tPtr->tabView && W_VIEW_REALIZED(tPtr->tabView->view))
|
||||||
|
paintTabView(tPtr->tabView);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
WMGetTabViewItemIdentifier(WMTabViewItem *item)
|
WMGetTabViewItemIdentifier(WMTabViewItem *item)
|
||||||
|
|||||||
Reference in New Issue
Block a user