int TopMenuItem::GetState() { if(!IsEnabled()) return NORMAL; if(HasMouse() && GetMouseLeft() || GetMouseRight()) return PUSH; if(HasFocus() || HasMouse()) return HIGHLIGHT; return NORMAL; }
void Ctrl::EventLoop(Ctrl *ctrl) { GuiLock __; ASSERT_(IsMainThread(), "EventLoop can only run in the main thread"); ASSERT(LoopLevel == 0 || ctrl); LoopLevel++; LLOG("Entering event loop at level " << LoopLevel << LOG_BEGIN); if(!GetMouseRight() && !GetMouseMiddle() && !GetMouseLeft()) ReleaseCtrlCapture(); Ptr<Ctrl> ploop; if(ctrl) { ploop = LoopCtrl; LoopCtrl = ctrl; ctrl->inloop = true; } while(!IsEndSession() && (ctrl ? ctrl->IsOpen() && ctrl->InLoop() : GetTopCtrls().GetCount())) { FetchEvents(TRUE); ProcessEvents(); } if(ctrl) LoopCtrl = ploop; LoopLevel--; LLOG(LOG_END << "Leaving event loop "); }
bool Ctrl::ProcessEvent(bool *quit) { LLOG("@ ProcessEvent"); ASSERT(IsMainThread()); if(!GetMouseLeft() && !GetMouseRight() && !GetMouseMiddle()) ReleaseCtrlCapture(); if(FBProcessEvent(quit)) { LLOG("FBProcesEvent returned true"); SyncTopWindows(); DefferedFocusSync(); SyncCaret(); return true; } return false; }
bool Ctrl::ProcessEvent(bool *quit) { ASSERT_(IsMainThread(), "ProcessEvent can only run in the main thread"); if(!GetMouseLeft() && !GetMouseRight() && !GetMouseMiddle()) ReleaseCtrlCapture(); MSG msg; if(GetMsg(msg)) { if(msg.message == WM_QUIT && quit) *quit = true; // LLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": sProcessMSG " << FormatIntHex(msg.message)); sProcessMSG(msg); // LLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": //sProcessMSG " << FormatIntHex(msg.message)); DefferedFocusSync(); SyncCaret(); return true; } return false; }
bool Ctrl::ProcessEvent(bool *quit) { if(EndSession()) return false; if(!GetMouseLeft() && !GetMouseRight() && !GetMouseMiddle()) ReleaseCtrlCapture(); MSG msg; if(PeekMsg(msg)) { if(msg.message == WM_QUIT && quit) *quit = true; // LLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": sProcessMSG " << FormatIntHex(msg.message)); sProcessMSG(msg); // LLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": //sProcessMSG " << FormatIntHex(msg.message)); DefferedFocusSync(); SyncCaret(); return true; } return false; }
int MenuItem::GetVisualState() { return HasFocus() ? (HasMouse() && GetMouseLeft() || GetMouseRight()) ? PUSH : HIGHLIGHT : NORMAL; }