static int winValBaseSetTipAttrib(Ihandle* ih, const char* value) { HWND tips_hwnd; iupdrvBaseSetTipAttrib(ih, value); tips_hwnd = (HWND)iupAttribGet(ih, "_IUPWIN_TIPSWIN"); SendMessage(ih->handle, TBM_SETTOOLTIPS, (WPARAM)tips_hwnd, 0); return 1; }
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); }