static int winDatePickMapMethod(Ihandle* ih) { DWORD dwStyle = WS_CHILD | WS_CLIPSIBLINGS | DTS_SHORTDATECENTURYFORMAT; if (!ih->parent) return IUP_ERROR; if (iupAttribGetBoolean(ih, "CANFOCUS")) dwStyle |= WS_TABSTOP; if (!iupwinCreateWindow(ih, DATETIMEPICK_CLASS, 0, dwStyle, NULL)) return IUP_ERROR; /* Process WM_NOTIFY */ IupSetCallback(ih, "_IUPWIN_NOTIFY_CB", (Icallback)winDatePickWmNotify); if (iupwinIsVistaOrNew()) { dwStyle = MCS_NOTODAY | MCS_NOSELCHANGEONNAV; if (iupAttribGetBoolean(ih, "CALENDARWEEKNUMBERS")) dwStyle |= MCS_WEEKNUMBERS; SendMessage(ih->handle, DTM_SETMCSTYLE, 0, (LPARAM)dwStyle); } if (iupAttribGet(ih, "SEPARATOR") || iupAttribGet(ih, "ZEROPRECED") || iupAttribGet(ih, "MONTHSHORTNAMES")) winDatePickSetOrderAttrib(ih, "DMY"); return IUP_NOERROR; }
char* iupdrvGetSystemFont(void) { static char str[200]; /* must return a static string, because it will be used as the default value for the FONT attribute */ NONCLIENTMETRICSA ncm; ncm.cbSize = sizeof(NONCLIENTMETRICSA); /* this is before setting utf8mode, so use the ANSI version */ if (SystemParametersInfoA(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, FALSE)) winFontFromLogFontA(&ncm.lfMessageFont, str); else { if (iupwinIsVistaOrNew()) strcpy(str, "Segoe UI, 9"); else strcpy(str, "Tahoma, 10"); } return str; }
static void winDatePickComputeNaturalSizeMethod(Ihandle* ih, int *w, int *h, int *children_expand) { (void)children_expand; /* unset if not a container */ if (ih->handle && iupwinIsVistaOrNew() && iupwin_comctl32ver6) { SIZE size; SendMessage(ih->handle, DTM_GETIDEALSIZE, 0, (LPARAM)&size); *w = size.cx; *h = size.cy; } else { iupdrvFontGetMultiLineStringSize(ih, "WW/WW/WWWW", w, h); iupdrvTextAddBorders(w, h); *w += iupdrvGetScrollbarSize(); } }
int iupwinDrawGetThemeTabsBgColor(HWND hWnd, COLORREF *color) { HTHEME hTheme; HRESULT ret; if (!winDrawThemeEnabled()) return 0; hTheme = winThemeOpenData(hWnd, L"TAB"); if (!hTheme) return 0; if (iupwinIsVistaOrNew()) ret = winThemeGetColor(hTheme, TABP_AEROWIZARDBODY, TIS_NORMAL, TMT_FILLCOLORHINT, color); else ret = winThemeGetColor(hTheme, TABP_BODY, TIS_NORMAL, TMT_FILLCOLORHINT, color); winThemeCloseData(hTheme); return (ret == S_OK)? 1: 0; }
static int winCalendarMapMethod(Ihandle* ih) { DWORD dwStyle = WS_CHILD | WS_CLIPSIBLINGS | MCS_NOTODAY; if (!ih->parent) return IUP_ERROR; if (iupwinIsVistaOrNew()) dwStyle |= MCS_NOSELCHANGEONNAV | MCS_SHORTDAYSOFWEEK; if (iupAttribGetBoolean(ih, "CANFOCUS")) dwStyle |= WS_TABSTOP; if (iupAttribGetBoolean(ih, "WEEKNUMBERS")) dwStyle |= MCS_WEEKNUMBERS; if (!iupwinCreateWindow(ih, MONTHCAL_CLASS, 0, dwStyle, NULL)) return IUP_ERROR; /* Process WM_NOTIFY */ IupSetCallback(ih, "_IUPWIN_NOTIFY_CB", (Icallback)winCalendarWmNotify); return IUP_NOERROR; }
static int winButtonMsgProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT *result) { if (ih->data->type != IUP_BUTTON_TEXT) { /* redraw IMPRESS image if any */ if ((msg == WM_LBUTTONDOWN || msg == WM_LBUTTONUP) && iupAttribGet(ih, "IMPRESS")) iupdrvRedrawNow(ih); } switch (msg) { case WM_XBUTTONDBLCLK: case WM_LBUTTONDBLCLK: case WM_MBUTTONDBLCLK: case WM_RBUTTONDBLCLK: case WM_XBUTTONDOWN: case WM_LBUTTONDOWN: case WM_MBUTTONDOWN: case WM_RBUTTONDOWN: { /* Process BUTTON_CB */ iupwinButtonDown(ih, msg, wp, lp); /* Feedback will NOT be done when not receiving the focus or when in double click */ if ((msg==WM_LBUTTONDOWN && !iupAttribGetBoolean(ih, "CANFOCUS")) || msg==WM_LBUTTONDBLCLK) { iupAttribSet(ih, "_IUPWINBUT_SELECTED", "1"); iupdrvRedrawNow(ih); } break; } case WM_XBUTTONUP: case WM_LBUTTONUP: case WM_MBUTTONUP: case WM_RBUTTONUP: { /* Process BUTTON_CB */ iupwinButtonUp(ih, msg, wp, lp); if (msg==WM_LBUTTONUP) { if (iupAttribGet(ih, "_IUPWINBUT_SELECTED")) { iupAttribSet(ih, "_IUPWINBUT_SELECTED", NULL); iupdrvRedrawNow(ih); } /* BN_CLICKED will NOT be notified when not receiving the focus */ if (!iupAttribGetBoolean(ih, "CANFOCUS")) { Icallback cb = IupGetCallback(ih, "ACTION"); if (cb && cb(ih) == IUP_CLOSE) IupExitLoop(); } } if (!iupwinIsVistaOrNew() && iupObjectCheck(ih)) { /* TIPs desapear forever after a button click in XP, so we force an update. */ char* tip = iupAttribGet(ih, "TIP"); if (tip) iupdrvBaseSetTipAttrib(ih, tip); } break; } case WM_KEYDOWN: case WM_SYSKEYDOWN: if (wp==VK_RETURN) { /* enter activates the button */ iupdrvActivate(ih); *result = 0; return 1; /* abort default processing, or the default button will be activated, in this case even if there is a default button, this button must be activated instead. */ } break; case WM_MOUSELEAVE: if (!iupwin_comctl32ver6 && iupAttribGetBoolean(ih, "FLAT")) { iupAttribSet(ih, "_IUPWINBUT_ENTERWIN", NULL); iupdrvRedrawNow(ih); } if (iupAttribGet(ih, "_IUPWINBUT_SELECTED")) { iupAttribSet(ih, "_IUPWINBUT_SELECTED", NULL); iupdrvRedrawNow(ih); } break; case WM_MOUSEMOVE: if (!iupwin_comctl32ver6 && iupAttribGetBoolean(ih, "FLAT")) { if (!iupAttribGet(ih, "_IUPWINBUT_ENTERWIN")) { iupAttribSet(ih, "_IUPWINBUT_ENTERWIN", "1"); iupdrvRedrawNow(ih); } } break; case WM_SETFOCUS: if (!iupAttribGetBoolean(ih, "CANFOCUS")) { HWND previous = (HWND)wp; if (previous && previous != ih->handle) { SetFocus(previous); *result = 0; return 1; } } break; } return iupwinBaseMsgProc(ih, msg, wp, lp, result); }