static void iDialogAfterShow(Ihandle* ih) { Ihandle* old_focus; IFni show_cb; int show_state; /* process all pending messages */ IupFlush(); old_focus = IupGetFocus(); show_state = ih->data->show_state; show_cb = (IFni)IupGetCallback(ih, "SHOW_CB"); if (show_cb && show_cb(ih, show_state) == IUP_CLOSE) { IupExitLoop(); return; } if (show_state == IUP_SHOW) { if (show_cb) IupFlush(); /* again to update focus */ /* do it only if show_cb did NOT changed the current focus */ if (old_focus == IupGetFocus()) { Ihandle *startfocus = IupGetAttributeHandle(ih, "STARTFOCUS"); if (startfocus) IupSetFocus(startfocus); else IupNextField(ih); } } }
static Window motClipboardGetWindow(void) { Ihandle* focus = IupGetFocus(); Ihandle* dlg; if (!focus) return (Window)NULL; dlg = IupGetDialog(focus); if (dlg) return XtWindow(dlg->handle); else return (Window)NULL; }
Ihandle *IupSetFocus(Ihandle *ih) { Ihandle* old_focus = IupGetFocus(); iupASSERT(iupObjectCheck(ih)); if (!iupObjectCheck(ih)) return old_focus; /* Current focus is NOT set here, only in the iupCallGetFocusCb */ if (iupFocusCanAccept(ih)) iupdrvSetFocus(ih); return old_focus; }
void iupCallKillFocusCb(Ihandle *ih) { Icallback cb; if (ih != IupGetFocus()) /* avoid duplicate messages */ return; cb = IupGetCallback(ih, "KILLFOCUS_CB"); if (cb) cb(ih); if (ih->iclass->nativetype == IUP_TYPECANVAS) { IFni cb2 = (IFni)IupGetCallback(ih, "FOCUS_CB"); if (cb2) cb2(ih, 0); } iupSetCurrentFocus(NULL); }
static int GetFocus(lua_State *L) { iuplua_pushihandle(L, IupGetFocus()); return 1; }
static void GetFocus(void) { iuplua_pushihandle(IupGetFocus()); }