//Main game Fifteen::Fifteen() { SetGameAreaBackground(); SetGameArray(); SetTimeCallback(REFRESH, THISBACK(DrawGameArea)); SetTimeCallback(-SEC, THISBACK(CountTime)); SetTimeCallback(REFRESH, THISBACK(GameOver)); SetTimeCallback(REFRESH, THISBACK(ClickTile)); newgame <<= THISBACK (SetGameArray); solve <<= THISBACK (SolutionClick); help <<= THISBACK(HelpClick); CtrlLayout(*this, "Piętnastka"); }
void SubMenuItem::MouseEnter(Point, dword) { SetFocus(); Refresh(); if(!menu.IsOpen() && isenabled) SetTimeCallback(400, THISBACK(Pull), TIMEID_PULL); }
void ShowToolTip() { LLOG("ShowToolTip"); CloseToolTip(); if(tipctrl) { String text = tipctrl->GetTip(); LLOG("-> showing tip: " << text << " tipctrl: " << UPP::Name(tipctrl)); Ctrl *top = tipctrl->GetTopCtrl(); if(!text.IsEmpty() && top && (top->IsForeground() || top->IsPopUp())) { LLOG("-> foreground"); ToolTip& q = AppToolTip(); q.Set(text); Size sz = q.GetMinSize(); Rect r = top->GetWorkArea(); Point p = GetMousePos() + Size(0, 22); if(p.y + sz.cy > r.bottom) p = GetMousePos() - Size(0, 22); q.PopUp(top, p, !showmode); showmode = true; KillTimeCallback((void *)EndShowMode); return; } LLOG("-> background / empty text, top = " << UPP::Name(top)); } SetTimeCallback(200, callback(EndShowMode), (void *)EndShowMode); }
VisualTest::VisualTest() { CtrlLayoutOKCancel(*this, "Window title"); list.HeaderObject().Absolute(); for(int i = 0; i < 5; i++) list.AddColumn(AsString(i), 100).HeaderTab().WhenAction = callback(Test); for(int i = 0; i < 100; i++) { list.Add(i); droplist.Add(i); } tabs.Add().Text("A"); tabs.Add().Text("B"); // tabs.Add().Text("BVB"); // tabs.Add().Text("Baas"); // tabs.Add().Text("Basdasd"); // tabs.Add().Text("Basdasdasd"); // tabs.Add().Text("Basdasdasdasdasd"); Sizeable().Zoomable(); disabled.Disable(); pi.Set(44, 0); slider.Range(100); slider <<= THISBACK(PI); bo.SetImage(CtrlImg::cut()); exit.Exit(); bo.Disable(); SetTimeCallback(-50, THISBACK(PI)); dc.AddList("Test"); }
void TopWindow::SyncTitle() { GuiLock __; LLOG("SyncTitle: " << title); KillTimeCallback(TIMEID_DEFSYNCTITLE); SetTimeCallback(0, THISBACK(DefSyncTitle), TIMEID_DEFSYNCTITLE); LLOG("*SyncTitle: " << title); }
//--------------------------------------------------------------------------- Kmedis::Kmedis() { CtrlLayout(*this, TOP_WINDOW_TITLE); CenterScreen(); //---------------------------------------------------------- SetTimeCallback(1500, THISBACK(Close)); }
LoggerCtrl::LoggerCtrl() : maxlines(1000), ignore(false) { NoInitFocus(); NoWantFocus(); SetReadOnly(); Reserve(512); SetTimeCallback(-200, THISBACK(Flush)); }
void GrabScreen::Init(GrabYourScreen &_program) { program = &_program; editFileNameGrab <<= AppendFileName(GetDesktopFolder(), "ScreenGrab.avi"); editFileNameGrab.Type(t_("Video file"), ".avi"); editTime <<= 5; editFrameRate <<= 1; opGrabMouse <<= true; swGrabMode.Add("Desktop"); swGrabMode.Add("Window"); #if defined(PLATFORM_WIN32) swGrabMode.Add("Rectangle"); #endif swGrabMode.MinCaseHeight(20); swGrabMode.SetData(0); swGrabMode.WhenAction = THISBACK(SwGrabMode_Action); SwGrabMode_Action(); #if defined(PLATFORM_WIN32) butGrab.WhenPush = THISBACK(ButGrab_Push); #else butGrab.Enable(false); editFileNameGrab.Enable(false); editTime.Enable(false); editFrameRate.Enable(false); opGrabMouse.Enable(false); editLeft.Hide(); editTop.Hide(); editWidth.Hide(); editHeight.Hide(); left.Hide(); top.Hide(); width.Hide(); height.Hide(); #endif editLeft <<= 100; editWidth <<= 1000; editTop <<= 100; editHeight <<= 900; String extension; editFileNameSnap <<= AppendFileName(GetDesktopFolder(), "ScreenSnap.jpg"); editFileNameSnap.Type(t_("Image file"), ".jpg"); butSnap.WhenPush = THISBACK(ButSnap_Push); Array<int64> hWnd, processId; Array<String> name, fileName, caption; GetWindowsList(hWnd, processId, name, fileName, caption, false); Sort(caption); for (int i = 0; i < caption.GetCount(); ++i) { if (!Trim(caption[i]).IsEmpty()) editWindowTitle.Add(caption[i]); } editWindowTitle.SetData(editWindowTitle.GetValue(0)); SetTimeCallback(-1000, THISBACK(Timer)); }
void FileList::LeftDown(Point p, dword flags) { int c = GetCursor(); if(IsEdit()) { OkEdit(); c = -1; } ColumnList::LeftDown(p, flags); KillEdit(); if(c == GetCursor() && c >= 0 && !HasCapture() && renaming && !(flags & (K_SHIFT|K_CTRL))) SetTimeCallback(750, THISBACK(StartEdit), TIMEID_STARTEDIT); }
void RichTextView::Layout() { sizetracking = false; if(IsOpen() && lazy) { sizetracking = true; KillTimeCallback(TIMEID_ENDSIZETRACKING); SetTimeCallback(250, THISBACK(EndSizeTracking), TIMEID_ENDSIZETRACKING); } SetSb(); Refresh(); }
void MapEditor::OnMoveLevel(int s, int e) { _map.GetLevels().Swap(s - 1, e - 1); if (PromptOKCancel(t_("Recalculate mipmaps for moved levels now?"))) { OnLevelMapCalc( _map.GetLevels()[s - 1], s - 1 ); OnLevelMapCalc( _map.GetLevels()[e - 1], e - 1 ); } SetTimeCallback(1, THISBACK(UpdateLevelList)); }
//Function show solution of game void Fifteen::ShowSolution() { solutionLength--; CopyTGameArray(GameArray, Solution[solutionLength]); if (solutionLength > 0) { SetTimeCallback(REFRESH*(-2), THISBACK(ShowSolution)); } else { usedSolution = false; } }
void SyncToolTip(Ctrl *ctrl) { if(ctrl != tipctrl || ctrl && ctrl->GetTip() != AppToolTip().Get()) { LLOG("ToolTipHook / ctrl change " << UPP::Name(ctrl) << " -> " << UPP::Name(ctrl)); tipctrl = ctrl; KillTimeCallback((void *)SyncToolTip); if(showmode) ShowToolTip(); else { LLOG("ToolTipHook -> SetTimeCallback"); SetTimeCallback(GUI_ToolTipDelay(), callback(ShowToolTip), (void *)SyncToolTip); } } }
bool ToolTipHook(Ctrl *ctrl, bool inframe, int event, Point p, int zdelta, dword keyflags) { if(event == Ctrl::MOUSEMOVE && ctrl != &AppToolTip()) { SyncToolTip(Ctrl::GetVisibleChild(ctrl, p, inframe)); LLOG("ToolTipHook MOUSEMOVE " << UPP::Name(ctrl) << " inframe: " << inframe); } if(event == Ctrl::MOUSELEAVE) { LLOG("ToolTipHook MOUSELEAVE " << UPP::Name(ctrl)); CloseToolTip(); KillTimeCallback((void *)EndShowMode); SetTimeCallback(1000, callback(EndShowMode), (void *)EndShowMode); } if((event & Ctrl::ACTION) == Ctrl::DOWN) { LLOG("ToolTipHook DOWN"); CloseToolTip(); EndShowMode(); } return false; }
void ScatterCtrl::Paint(Draw& w) { GuiLock __; if (IsNull(highlight_0) && highlighting) { highlighting = false; KillTimeCallback(); } if (!IsNull(highlight_0) && !highlighting) { highlighting = true; SetTimeCallback(-200, THISBACK(TimerCallback)); } TimeStop t; lastRefresh0_ms = GetTickCount(); if (IsEnabled()) { if (mode == MD_DRAW) { ScatterCtrl::SetDrawing(w, GetSize(), 1); PlotTexts(w, GetSize(), 1); } else { ImageBuffer ib(GetSize()); BufferPainter bp(ib, mode); ScatterCtrl::SetDrawing(bp, GetSize(), 1); w.DrawImage(0, 0, ib); PlotTexts(w, GetSize(), 1); } if (HasFocus()) { w.DrawLine(0, 0, GetSize().cx, 0, 2, LtGray()); w.DrawLine(0, 0, 0, GetSize().cy, 2, LtGray()); int delta = -2; #ifdef PLATFORM_WIN32 delta = 0; #endif w.DrawLine(GetSize().cx+delta, 0, GetSize().cx+delta, GetSize().cy, 2, LtGray()); w.DrawLine(0, GetSize().cy+delta, GetSize().cx, GetSize().cy+delta, 2, LtGray()); } } lastRefresh_ms = t.Elapsed(); }
void Ctrl::PostCallback(Callback cb, int id) { SetTimeCallback(0, cb, id); }
void TopWindow::Open(Ctrl *owner) { LLOG("TopWindow::Open"); GuiLock __; if(dokeys && (!GUI_AKD_Conservative() || GetAccessKeysDeep() <= 1)) DistributeAccessKeys(); USRLOG(" OPEN " + Desc(this)); LLOG("OPEN " << Name() << " owner: " << UPP::Name(owner)); IgnoreMouseUp(); bool weplace = owner && center == 1 || center == 2 || !GetRect().IsEmpty(); if(fullscreen) SetRect(0, 0, Xwidth, Xheight); else CenterRect(owner); LLOG("Open NextRequest " << NextRequest(Xdisplay)); Create(owner, false, false); XSetWMProperties (Xdisplay, GetWindow(), NULL, NULL, NULL, 0, NULL, NULL, NULL); xminsize.cx = xmaxsize.cx = Null; title2.Clear(); if(!weplace) { LLOG("SyncCaption"); SyncCaption(); } LLOG("SyncSizeHints"); size_hints->flags = 0; SyncSizeHints(); Rect r = GetRect(); size_hints->x = r.left; size_hints->y = r.top; size_hints->width = r.Width(); size_hints->height = r.Height(); size_hints->win_gravity = StaticGravity; size_hints->flags |= PPosition|PSize|PWinGravity; if(owner) { ASSERT(owner->IsOpen()); LLOG("XSetTransientForHint"); XSetTransientForHint(Xdisplay, GetWindow(), owner->GetWindow()); } LLOG("XSetWMNormalHints"); XSetWMNormalHints(Xdisplay, GetWindow(), size_hints); Atom protocols[3]; protocols[0] = XAtom("WM_DELETE_WINDOW"); protocols[1] = XAtom("WM_TAKE_FOCUS"); protocols[2] = XAtom("_NET_WM_PING"); LLOG("XSetWMProtocols"); XSetWMProtocols(Xdisplay, GetWindow(), protocols, 3); String x = GetExeTitle().ToString(); const char *progname = ~x; class_hint->res_name = (char *)progname; class_hint->res_class = (char *)progname; XSetClassHint(Xdisplay, GetWindow(), class_hint); LLOG("WndShow(" << visible << ")"); WndShow(visible); if(visible) { XEvent e; LLOG("XWindowEvent"); XWindowEvent(Xdisplay, top->window, VisibilityChangeMask, &e); ignoretakefocus = true; SetTimeCallback(500, THISBACK(EndIgnoreTakeFocus)); LLOG("SetWndFocus"); SetWndFocus(); for(int i = 0; i < 50; i++) { // X11 tries to move our window, so ignore the first set of ConfigureNotify // and move the window into position after FocusIn - but not if we want WM to // place the window if(weplace) while(XCheckTypedWindowEvent(Xdisplay, top->window, ConfigureNotify, &e)) { if(e.xconfigure.window != top->window) ProcessEvent(&e); } if(XCheckTypedWindowEvent(Xdisplay, top->window, FocusIn, &e)) { ProcessEvent(&e); if(e.xfocus.window == top->window) break; } Sleep(10); } } if(weplace) { WndSetPos(GetRect()); LLOG("SyncCaption"); SyncCaption(); } LLOG(">Open NextRequest " << NextRequest(Xdisplay)); LLOG(">OPENED " << Name()); PlaceFocus(); StateH(OPEN); Vector<int> fe = GetPropertyInts(top->window, XAtom("_NET_FRAME_EXTENTS")); if(fe.GetCount() >= 4 && fe[0] >= 0 && fe[0] <= 16 && fe[1] >= 0 && fe[1] <= 16 && //fluxbox returns wrong numbers - quick&dirty workaround fe[2] >= 0 && fe[2] <= 64 && fe[3] >= 0 && fe[3] <= 48) { GuiLock __; windowFrameMargin.left = max(windowFrameMargin.left, fe[0]); windowFrameMargin.right = max(windowFrameMargin.right, fe[1]); windowFrameMargin.top = max(windowFrameMargin.top, fe[2]); windowFrameMargin.bottom = max(windowFrameMargin.bottom, fe[3]); } if(IsOpen() && top) top->owner = owner; long curr_pid = getpid(); static Window wm_client_leader; ONCELOCK { wm_client_leader = XCreateSimpleWindow(Xdisplay, Xroot, 0, 0, 1, 1, 0, 0, 0); XChangeProperty(Xdisplay, wm_client_leader, XAtom("WM_CLIENT_LEADER"), XA_WINDOW, 32, PropModeReplace, (byte *)&wm_client_leader, 1); XChangeProperty(Xdisplay, wm_client_leader, XAtom("_NET_WM_PID"), XA_CARDINAL, 32, PropModeReplace, (byte *) &curr_pid, 1); } Window win = GetWindow(); XChangeProperty(Xdisplay, win, XAtom("_NET_WM_PID"), XA_CARDINAL, 32, PropModeReplace, (byte *) &curr_pid, 1); XChangeProperty(Xdisplay, win, XAtom("WM_CLIENT_LEADER"), XA_WINDOW, 32, PropModeReplace, (byte *)&wm_client_leader, 1); int version = 5; XChangeProperty(Xdisplay, win, XAtom("XdndAware"), XA_ATOM, 32, 0, (byte *)&version, 1); SyncState(); FixIcons(); }
void ToolBar::Post(Event<Bar&> bar) { KillTimeCallback(TIMEID_POST); SetTimeCallback(0, PTEBACK1(Set, bar), TIMEID_POST); }
void BoostPyTest::ExitHandler() { SetTimeCallback(1000, Breaker()); }
void ShowSplash() { Single<Splash>().PopUp(NULL, false, false); SetTimeCallback(750, callback(HideSplash)); }
void Tab5_Dynamic::Start() { SetTimeCallback(-5, THISBACK(Animate)); bStart.Disable(); bStop.Enable(); }
void MenuBar::Deactivate() { LLOG("Deactivate"); if(IsOpen()) SetTimeCallback(0, THISBACK(PostDeactivate), TIMEID_STOP); }
void MenuBar::DelayedClose() { SetTimeCallback(400, THISBACK(SubmenuClose), TIMEID_SUBMENUCLOSE); }
void MenuBar::Post(Event<Bar&> bar) { KillTimeCallback(TIMEID_POST); SetTimeCallback(0, THISBACK1(Set, bar), TIMEID_POST); }
void Ide::SetUpdateTimer(int period){ LLOG("SetUpdateTimer, period="<<period); PostCallback(THISBACK1(CheckUpdates,false)); SetTimeCallback(-60000*period,THISBACK1(CheckUpdates,false)); }
void Ctrl::KillSetTimeCallback(int delay_ms, Callback cb, int id) { KillTimeCallback(id); SetTimeCallback(delay_ms, cb, id); }