mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-03 12:24:17 +01:00
fixed bugs of resized widgets
This commit is contained in:
@@ -37,6 +37,9 @@ typedef struct W_TabView {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define DEFAULT_WIDTH 40
|
||||
#define DEFAULT_HEIGHT 40
|
||||
|
||||
@@ -61,6 +64,19 @@ static WMView *W_TabViewItemView(WMTabViewItem *item);
|
||||
static void recalcTabWidth(TabView *tPtr);
|
||||
|
||||
|
||||
static void didResize(struct W_ViewDelegate*, WMView*);
|
||||
|
||||
static W_ViewDelegate delegate = {
|
||||
NULL,
|
||||
NULL,
|
||||
didResize,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
static void
|
||||
handleEvents(XEvent *event, void *data)
|
||||
{
|
||||
@@ -131,6 +147,7 @@ WMCreateTabView(WMWidget *parent)
|
||||
return NULL;
|
||||
}
|
||||
tPtr->view->self = tPtr;
|
||||
tPtr->view->delegate = &delegate;
|
||||
|
||||
tPtr->lightGray = WMCreateRGBColor(scr, 0xd9d9, 0xd9d9, 0xd9d9, False);
|
||||
tPtr->tabColor = WMCreateRGBColor(scr, 0x8420, 0x8420, 0x8420, False);
|
||||
@@ -640,6 +657,32 @@ paintTabView(TabView *tPtr)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
rearrange(TabView *tPtr)
|
||||
{
|
||||
int i;
|
||||
int width, height;
|
||||
|
||||
recalcTabWidth(tPtr);
|
||||
|
||||
width = tPtr->view->size.width - 3;
|
||||
height = tPtr->view->size.height - tPtr->tabHeight - 3;
|
||||
|
||||
for (i = 0; i < tPtr->itemCount; i++) {
|
||||
W_ResizeView(W_TabViewItemView(tPtr->items[i]), width, height);
|
||||
}
|
||||
if (W_VIEW_MAPPED(tPtr->view) && W_VIEW_REALIZED(tPtr->view))
|
||||
paintTabView(tPtr);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
didResize(struct W_ViewDelegate *deleg, WMView *view)
|
||||
{
|
||||
rearrange(view->self);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
destroyTabView(TabView *tPtr)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user