static HWND winTabCreatePageWindow(Ihandle* ih) { HWND hWnd; DWORD dwStyle = WS_CHILD|WS_CLIPSIBLINGS, dwExStyle = 0; iupwinGetNativeParentStyle(ih, &dwExStyle, &dwStyle); hWnd = CreateWindowEx(dwExStyle, "IupTabsPage", NULL, dwStyle, 0, 0, CW_USEDEFAULT, CW_USEDEFAULT, ih->handle, NULL, iupwin_hinstance, NULL); iupwinHandleAdd(ih, hWnd); return hWnd; }
static int winDialogMapMethod(Ihandle* ih) { InativeHandle* native_parent; DWORD dwStyle = WS_CLIPSIBLINGS, dwExStyle = 0; int has_titlebar = 0, has_border = 0; char* classname = "IupDialog"; char* title = iupAttribGet(ih, "TITLE"); if (title) has_titlebar = 1; if (iupAttribGetBoolean(ih, "RESIZE")) { dwStyle |= WS_THICKFRAME; has_border = 1; } else iupAttribSetStr(ih, "MAXBOX", "NO"); if (iupAttribGetBoolean(ih, "MENUBOX")) { dwStyle |= WS_SYSMENU; has_titlebar = 1; } if (iupAttribGetBoolean(ih, "MAXBOX")) { dwStyle |= WS_MAXIMIZEBOX; has_titlebar = 1; } if (iupAttribGetBoolean(ih, "MINBOX")) { dwStyle |= WS_MINIMIZEBOX; has_titlebar = 1; } if (iupAttribGetBoolean(ih, "BORDER") || has_titlebar) has_border = 1; if (iupAttribGetBoolean(ih, "MDICHILD")) { Ihandle *client; /* must have a parent dialog (the mdi frame) */ Ihandle* parent = IupGetAttributeHandle(ih, "PARENTDIALOG"); if (!parent || !parent->handle) return IUP_ERROR; /* set when the mdi client is mapped */ client = (Ihandle*)iupAttribGet(parent, "MDICLIENT_HANDLE"); if (!client) return IUP_ERROR; /* store the mdi client handle in each mdi child also */ iupAttribSetStr(ih, "MDICLIENT_HANDLE", (char*)client); classname = "IupDialogMDIChild"; /* The actual parent is the mdi client */ native_parent = client->handle; dwStyle |= WS_CHILD; if (has_titlebar) dwStyle |= WS_CAPTION; else if (has_border) dwStyle |= WS_BORDER; if (!IupGetName(ih)) iupAttribSetHandleName(ih); } else { native_parent = iupDialogGetNativeParent(ih); if (native_parent) { dwStyle |= WS_POPUP; if (has_titlebar) dwStyle |= WS_CAPTION; else if (has_border) dwStyle |= WS_BORDER; } else { if (has_titlebar) { dwStyle |= WS_OVERLAPPED; } else { if (has_border) dwStyle |= WS_POPUP | WS_BORDER; else dwStyle |= WS_POPUP; dwExStyle |= WS_EX_NOACTIVATE; /* this will hide it from the taskbar */ } } if (iupAttribGetBoolean(ih, "MDIFRAME")) { COLORREF color = GetSysColor(COLOR_BTNFACE); iupAttribSetStrf(ih, "_IUPWIN_BACKGROUND_COLOR", "%d %d %d", (int)GetRValue(color), (int)GetGValue(color), (int)GetBValue(color)); classname = "IupDialogMDIFrame"; } } if (iupAttribGetBoolean(ih, "TOOLBOX") && native_parent) dwExStyle |= WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE; if (iupAttribGetBoolean(ih, "DIALOGFRAME") && native_parent) dwExStyle |= WS_EX_DLGMODALFRAME; /* this will hide the MENUBOX but not the close button */ iupwinGetNativeParentStyle(ih, &dwExStyle, &dwStyle); if (iupAttribGetBoolean(ih, "HELPBUTTON")) dwExStyle |= WS_EX_CONTEXTHELP; if (iupAttribGetBoolean(ih, "CONTROL") && native_parent) { /* TODO: this were used by LuaCom to create embeded controls, don't know if it is still working */ dwStyle = WS_CHILD | WS_TABSTOP | WS_CLIPCHILDREN; classname = "IupDialogControl"; } /* CreateWindowEx will send WM_GETMINMAXINFO before Ihandle is associated with HWND */ if (iupAttribGet(ih, "MINSIZE") || iupAttribGet(ih, "MAXSIZE")) winMinMaxHandle = ih; /* size will be updated in IupRefresh -> winDialogLayoutUpdate */ /* position will be updated in iupDialogShowXY */ if (iupAttribGetBoolean(ih, "MDICHILD")) ih->handle = CreateMDIWindow(classname, title, /* title */ dwStyle, /* style */ 0, /* x-position */ 0, /* y-position */ 100, /* horizontal size - set this to avoid size calculation problems */ 100, /* vertical size */ native_parent, /* owner window */ iupwin_hinstance, /* instance of app. */ 0); /* no creation parameters */ else ih->handle = CreateWindowEx(dwExStyle, /* extended styles */ classname, /* class */ title, /* title */ dwStyle, /* style */ 0, /* x-position */ 0, /* y-position */ 100, /* horizontal size - set this to avoid size calculation problems */ 100, /* vertical size */ native_parent, /* owner window */ (HMENU)0, /* Menu or child-window identifier */ iupwin_hinstance, /* instance of app. */ NULL); /* no creation parameters */ if (!ih->handle) return IUP_ERROR; /* associate HWND with Ihandle*, all Win32 controls must call this. */ iupwinHandleAdd(ih, ih->handle); if (iupStrEqual(classname, "IupDialogMDIChild")) /* hides the mdi child */ ShowWindow(ih->handle, SW_HIDE); /* configure for DROP of files */ if (IupGetCallback(ih, "DROPFILES_CB")) iupAttribSetStr(ih, "DROPFILESTARGET", "YES"); /* Reset attributes handled during creation that */ /* also can be changed later, and can be consulted from the native system. */ iupAttribSetStr(ih, "TITLE", NULL); /* Ignore VISIBLE before mapping */ iupAttribSetStr(ih, "VISIBLE", NULL); /* Set the default CmdShow for ShowWindow */ ih->data->cmd_show = SW_SHOWNORMAL; if (iupAttribGetBoolean(ih, "MDICHILD")) winDialogMDIRefreshMenu(ih); return IUP_NOERROR; }
static int winCanvasMapMethod(Ihandle* ih) { CLIENTCREATESTRUCT clientstruct; void *clientdata = NULL; char *classname; DWORD dwStyle = WS_CHILD|WS_CLIPSIBLINGS, dwExStyle = 0; if (!ih->parent) return IUP_ERROR; if (ih->iclass->is_interactive) { if (iupAttribGetBoolean(ih, "CANFOCUS")) dwStyle |= WS_TABSTOP; } if (ih->firstchild) /* can be a container */ iupwinGetNativeParentStyle(ih, &dwExStyle, &dwStyle); if (iupAttribGetBoolean(ih, "BORDER")) dwStyle |= WS_BORDER; ih->data->sb = iupBaseGetScrollbar(ih); if (ih->data->sb & IUP_SB_HORIZ) dwStyle |= WS_HSCROLL; if (ih->data->sb & IUP_SB_VERT) dwStyle |= WS_VSCROLL; if (iupAttribGetBoolean(ih, "MDICLIENT")) { /* creating a MDI Client that will be inside the MDI Frame, it will work as parent of all MDI children */ Ihandle *winmenu = IupGetAttributeHandle(ih, "MDIMENU"); classname = "mdiclient"; dwStyle = WS_CHILD|WS_CLIPCHILDREN|WS_VSCROLL|WS_HSCROLL|MDIS_ALLCHILDSTYLES; dwExStyle = WS_EX_CLIENTEDGE; iupAttribSetStr(ih, "BORDER", "NO"); iupAttribSetStr(IupGetDialog(ih), "MDICLIENT_HANDLE", (char*)ih); clientdata = &clientstruct; clientstruct.hWindowMenu = winmenu? winmenu->handle: NULL; /* The system increments the identifier for each additional MDI child window the application creates, and reassigns identifiers when the application destroys a window to keep the range of identifiers contiguous. */ clientstruct.idFirstChild = IUP_MDI_FIRSTCHILD; } else classname = "IupCanvas"; ih->serial = iupDialogGetChildId(ih); ih->handle = CreateWindowEx(dwExStyle,/* extended style */ classname, /* window class */ NULL, /* title */ dwStyle, /* window style */ 0, /* x-position */ 0, /* y-position */ 10, /* default width to avoid 0 */ 10, /* default height to avoid 0 */ iupChildTreeGetNativeParentHandle(ih), /* window parent */ (HMENU)ih->serial, /* child identifier */ iupwin_hinstance, /* instance of app. */ clientdata); if (!ih->handle) return IUP_ERROR; /* associate HWND with Ihandle*, all Win32 controls must call this. */ iupwinHandleAdd(ih, ih->handle); if (iupAttribGetBoolean(ih, "MDICLIENT")) iupwinChangeProc(ih, iupwinBaseWinProc); else IupSetCallback(ih, "_IUPWIN_OLDPROC_CB", (Icallback)DefWindowProc); IupSetCallback(ih, "_IUPWIN_CTRLPROC_CB", (Icallback)winCanvasProc); /* configure for DROP of files */ if (IupGetCallback(ih, "DROPFILES_CB")) iupAttribSetStr(ih, "DROPFILESTARGET", "YES"); return IUP_NOERROR; }
static int winCanvasMapMethod(Ihandle* ih) { CLIENTCREATESTRUCT clientstruct; void *clientdata = NULL; TCHAR *classname; DWORD dwStyle = WS_CHILD|WS_CLIPSIBLINGS, dwExStyle = 0; if (!ih->parent) return IUP_ERROR; if (ih->iclass->is_interactive) { if (iupAttribGetBoolean(ih, "CANFOCUS")) dwStyle |= WS_TABSTOP; } if (ih->firstchild) /* can be a container */ iupwinGetNativeParentStyle(ih, &dwExStyle, &dwStyle); if (iupAttribGetBoolean(ih, "BORDER")) dwStyle |= WS_BORDER; ih->data->sb = iupBaseGetScrollbar(ih); if (ih->data->sb & IUP_SB_HORIZ) dwStyle |= WS_HSCROLL; if (ih->data->sb & IUP_SB_VERT) dwStyle |= WS_VSCROLL; if (iupAttribGetBoolean(ih, "MDICLIENT")) { /* creating a MDI Client that will be inside the MDI Frame, it will work as parent of all MDI children */ Ihandle *winmenu = IupGetAttributeHandle(ih, "MDIMENU"); classname = TEXT("mdiclient"); dwStyle = WS_CHILD|WS_CLIPCHILDREN|WS_VSCROLL|WS_HSCROLL|MDIS_ALLCHILDSTYLES; dwExStyle = WS_EX_CLIENTEDGE; iupAttribSet(ih, "BORDER", "NO"); iupAttribSet(IupGetDialog(ih), "MDICLIENT_HANDLE", (char*)ih); clientdata = &clientstruct; clientstruct.hWindowMenu = winmenu? winmenu->handle: NULL; /* The system increments the identifier for each additional MDI child window the application creates, and reassigns identifiers when the application destroys a window to keep the range of identifiers contiguous. */ clientstruct.idFirstChild = IUP_MDI_FIRSTCHILD; } else classname = TEXT("IupCanvas"); if (!iupwinCreateWindow(ih, classname, dwExStyle, dwStyle, clientdata)) return IUP_ERROR; IupSetCallback(ih, "_IUPWIN_CTRLMSGPROC_CB", (Icallback)winCanvasMsgProc); /* configure for DROP of files */ if (IupGetCallback(ih, "DROPFILES_CB")) iupAttribSet(ih, "DROPFILESTARGET", "YES"); winCanvasSetDXAttrib(ih, NULL); winCanvasSetDYAttrib(ih, NULL); return IUP_NOERROR; }
static int winTabsMapMethod(Ihandle* ih) { DWORD dwStyle = WS_CHILD | WS_CLIPSIBLINGS | TCS_HOTTRACK | WS_TABSTOP, dwExStyle = 0; if (!ih->parent) return IUP_ERROR; if (ih->data->type == ITABS_BOTTOM) dwStyle |= TCS_BOTTOM; else if (ih->data->type == ITABS_RIGHT) dwStyle |= TCS_VERTICAL|TCS_RIGHT; else if (ih->data->type == ITABS_LEFT) dwStyle |= TCS_VERTICAL; if (ih->data->is_multiline) dwStyle |= TCS_MULTILINE; iupwinGetNativeParentStyle(ih, &dwExStyle, &dwStyle); if (dwExStyle & WS_EX_COMPOSITED && !ih->data->is_multiline && iupwinIsVista()) { /* workaround for composite bug in Vista */ ih->data->is_multiline = 1; dwStyle |= TCS_MULTILINE; } if (!iupwinCreateWindowEx(ih, WC_TABCONTROL, dwExStyle, dwStyle)) return IUP_ERROR; /* replace the WinProc to handle other messages */ IupSetCallback(ih, "_IUPWIN_CTRLPROC_CB", (Icallback)winTabsProc); /* Process WM_NOTIFY */ IupSetCallback(ih, "_IUPWIN_NOTIFY_CB", (Icallback)winTabsWmNotify); /* Process background color */ IupSetCallback(ih, "_IUPWIN_CTLCOLOR_CB", (Icallback)winTabsCtlColor); if (iupwin_comctl32ver6 && ih->data->type != ITABS_TOP) { /* XP Styles support only TABTYPE=TOP */ iupwinDrawRemoveTheme(ih->handle); } /* Change children background */ if (winTabsUsingXPStyles(ih)) { char* color = iupAttribGetInheritNativeParent(ih, "BGCOLOR"); if (!color) color = iupAttribGetInheritNativeParent(ih, "BACKGROUND"); if (!color) { COLORREF cr; if (iupwinDrawGetThemeTabsBgColor(ih->handle, &cr)) iupAttribSetStrf(ih, "BACKGROUND", "%d %d %d", (int)GetRValue(cr), (int)GetGValue(cr), (int)GetBValue(cr)); } } /* Create pages and tabs */ if (ih->firstchild) { Ihandle* child; for (child = ih->firstchild; child; child = child->brother) winTabsChildAddedMethod(ih, child); } return IUP_NOERROR; }