summaryrefslogtreecommitdiff
path: root/iup/src/win/iupwin_tabs.c
diff options
context:
space:
mode:
Diffstat (limited to 'iup/src/win/iupwin_tabs.c')
-rwxr-xr-xiup/src/win/iupwin_tabs.c56
1 files changed, 32 insertions, 24 deletions
diff --git a/iup/src/win/iupwin_tabs.c b/iup/src/win/iupwin_tabs.c
index 682f451..b39f7fe 100755
--- a/iup/src/win/iupwin_tabs.c
+++ b/iup/src/win/iupwin_tabs.c
@@ -232,10 +232,7 @@ static HWND winTabCreatePageWindow(Ihandle* ih)
DWORD dwStyle = WS_CHILD|WS_CLIPSIBLINGS,
dwExStyle = 0;
- if (iupAttribGetBoolean(IupGetDialog(ih), "COMPOSITED"))
- dwExStyle |= WS_EX_COMPOSITED;
- else
- dwStyle |= WS_CLIPCHILDREN;
+ iupwinGetNativeParentStyle(ih, &dwExStyle, &dwStyle);
hWnd = CreateWindowEx(dwExStyle, "IupTabsPage", NULL, dwStyle,
0, 0, CW_USEDEFAULT, CW_USEDEFAULT,
@@ -255,9 +252,12 @@ static int winTabsSetPaddingAttrib(Ihandle* ih, const char* value)
iupStrToIntInt(value, &ih->data->horiz_padding, &ih->data->vert_padding, 'x');
if (ih->handle)
+ {
SendMessage(ih->handle, TCM_SETPADDING, 0, MAKELPARAM(ih->data->horiz_padding, ih->data->vert_padding));
-
- return 0;
+ return 0;
+ }
+ else
+ return 1; /* store until not mapped, when mapped will be set again */
}
static int winTabsSetMultilineAttrib(Ihandle* ih, const char* value)
@@ -368,6 +368,13 @@ static char* winTabsGetBgColorAttrib(Ihandle* ih)
return IupGetGlobal("DLGBGCOLOR");
}
+static int winTabsSetBgColorAttrib(Ihandle *ih, const char *value)
+{
+ (void)value;
+ iupdrvPostRedraw(ih);
+ return 1;
+}
+
/* ------------------------------------------------------------------------- */
/* winTabs - Calls the user callback to change of tab */
@@ -397,6 +404,7 @@ static int winTabsWmNotify(Ihandle* ih, NMHDR* msg_info, int *result)
int prev_pos = SendMessage(ih->handle, TCM_GETCURSEL, 0, 0);
iupAttribSetInt(ih, "_IUPTABS_PREV_CHILD_POS", prev_pos);
+ /* save the previous handle if callback exists */
if (cb)
{
Ihandle* prev_child = IupGetChild(ih, prev_pos);
@@ -420,7 +428,9 @@ static int winTabsWmNotify(Ihandle* ih, NMHDR* msg_info, int *result)
Ihandle* prev_child = (Ihandle*)iupAttribGet(ih, "_IUPTABS_PREV_CHILD");
iupAttribSetStr(ih, "_IUPTABS_PREV_CHILD", NULL);
- cb(ih, child, prev_child);
+ /* avoid duplicate calls when a Tab is inside another Tab. */
+ if (prev_child)
+ cb(ih, child, prev_child);
}
}
@@ -522,7 +532,7 @@ static void winTabsChildAddedMethod(Ihandle* ih, Ihandle* child)
}
}
- iupdrvDisplayRedraw(ih);
+ iupdrvRedrawNow(ih);
}
}
}
@@ -535,12 +545,11 @@ static void winTabsChildRemovedMethod(Ihandle* ih, Ihandle* child)
if (tab_page)
{
int pos = winTabsGetPageWindowPos(ih, tab_page);
+ iupTabsTestRemoveTab(ih, pos);
+
SendMessage(ih->handle, TCM_DELETEITEM, pos, 0);
DestroyWindow(tab_page);
- if (pos==0) pos++;
- iupdrvTabsSetCurrentTab(ih, pos-1);
-
iupAttribSetStr(child, "_IUPTAB_CONTAINER", NULL);
}
}
@@ -564,19 +573,14 @@ static int winTabsMapMethod(Ihandle* ih)
if (ih->data->is_multiline)
dwStyle |= TCS_MULTILINE;
- if (iupAttribGetBoolean(IupGetDialog(ih), "COMPOSITED"))
- {
- dwExStyle |= WS_EX_COMPOSITED;
+ iupwinGetNativeParentStyle(ih, &dwExStyle, &dwStyle);
- if (!ih->data->is_multiline && iupwinIsVista())
- {
- /* workaround for composite bug in Vista */
- ih->data->is_multiline = 1;
- dwStyle |= TCS_MULTILINE;
- }
+ if (dwExStyle & WS_EX_COMPOSITED && !ih->data->is_multiline && iupwinIsVistaOrNew())
+ {
+ /* workaround for composite bug in Vista */
+ ih->data->is_multiline = 1;
+ dwStyle |= TCS_MULTILINE;
}
- else
- dwStyle |= WS_CLIPCHILDREN;
if (!iupwinCreateWindowEx(ih, WC_TABCONTROL, dwExStyle, dwStyle))
return IUP_ERROR;
@@ -665,7 +669,7 @@ void iupdrvTabsInitClass(Iclass* ic)
/* Driver Dependent Attribute functions */
/* Visual */
- iupClassRegisterAttribute(ic, "BGCOLOR", winTabsGetBgColorAttrib, NULL, IUPAF_SAMEASSYSTEM, "DLGBGCOLOR", IUPAF_DEFAULT);
+ iupClassRegisterAttribute(ic, "BGCOLOR", winTabsGetBgColorAttrib, winTabsSetBgColorAttrib, IUPAF_SAMEASSYSTEM, "DLGBGCOLOR", IUPAF_DEFAULT);
/* Special */
iupClassRegisterAttribute(ic, "FGCOLOR", NULL, NULL, IUPAF_SAMEASSYSTEM, "DLGFGCOLOR", IUPAF_NOT_MAPPED);
@@ -676,5 +680,9 @@ void iupdrvTabsInitClass(Iclass* ic)
iupClassRegisterAttribute(ic, "MULTILINE", winTabsGetMultilineAttrib, winTabsSetMultilineAttrib, NULL, NULL, IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);
iupClassRegisterAttributeId(ic, "TABTITLE", NULL, winTabsSetTabTitleAttrib, IUPAF_NO_DEFAULTVALUE|IUPAF_NO_INHERIT);
iupClassRegisterAttributeId(ic, "TABIMAGE", NULL, winTabsSetTabImageAttrib, IUPAF_NO_DEFAULTVALUE|IUPAF_NO_INHERIT);
- iupClassRegisterAttribute(ic, "PADDING", iupTabsGetPaddingAttrib, winTabsSetPaddingAttrib, IUPAF_SAMEASSYSTEM, "0x0", IUPAF_NOT_MAPPED);
+ iupClassRegisterAttribute(ic, "PADDING", iupTabsGetPaddingAttrib, winTabsSetPaddingAttrib, IUPAF_SAMEASSYSTEM, "0x0", IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);
+
+ /* necessary because transparent background does not work when not using visual styles */
+ if (!iupwin_comctl32ver6) /* Used by iupdrvImageCreateImage */
+ iupClassRegisterAttribute(ic, "FLAT_ALPHA", NULL, NULL, IUPAF_SAMEASSYSTEM, "YES", IUPAF_NOT_MAPPED|IUPAF_NO_INHERIT);
}