MenuPtr HwndSourceHookMenuPopup::HitTestPopup() { suic::PopupPtr popover; for (int i = 0; i < _popups.size(); ++i) { suic::PopupPtr pop = suic::PopupPtr::cast(_popups[i]); suic::Rect rcpop(0, 0, pop->RenderSize().cx, pop->RenderSize().cy); suic::Point pt = suic::SystemHelper::GetCursorPoint(pop.get()); if (rcpop.PointIn(pt)) { popover = pop; break; } } if (!popover) { if (IsMouseOverOwer()) { return _mainMenu; } else { return MenuPtr(); } } else { return MenuPtr::cast(popover->GetPopupRoot()); } }
FramePtr FrameManager::getFrame(const std::string &frameName) const { FramePool::const_iterator it = _knownFrames.find(frameName); if (it != _knownFrames.end()) return it->second; else return MenuPtr(); }
Application::Application(Controller* ctrl): Fl_Window(600, 800, "Maszyna Turinga"), ctrl_(ctrl) { menu_ = MenuPtr(new Menu(ctrl_)); table_ = TablePtr(new StatesTable(ctrl_)); tape_ = TapePtr(new Tape(ctrl_)); state_ = BoxPtr(new Fl_Box(170,90,430,50,"STATE")); state_->box(FL_UP_BOX); add = ButtonPtr(new Fl_Button(5, 100, 50, 30, "Dodaj")); add->callback(add_button, this); start = ButtonPtr(new Fl_Button(75, 100, 50, 30, "Start")); start->callback(start_button, ctrl_); popup_ = PopupPtr(new Popup(ctrl_)); end(); show(); }
int InternalTrackPopupMenu(MenuPtr mainMenu) { MenuPtr trMenu = mainMenu; g_mainmenu = mainMenu; while (g_menuPop) { suic::PopupPtr menuPop = g_menuPop; suic::Size availableSize; MenuPtr menu(MenuPtr::cast(menuPop->GetPopupRoot())); g_menuPop = suic::PopupPtr(); menu->SetStyle(menu->FindResource(_T("Menu"))); menu->DoInit(); menu->Measure(availableSize); int cx = menu->GetDesiredSize().cx; int cy = menu->GetDesiredSize().cy; menuPop->SetWidth(cx); menuPop->SetHeight(cy); SetTrackMenu(menuPop); if (g_mainmenu != trMenu) { trMenu = g_mainmenu; } g_trackmenupopup = new HwndSourceHookMenuPopup(menuPop, trMenu); if (g_pretrackmenuitem && g_pretrackmenuitem != g_trackmenuitem) { g_pretrackmenuitem->SetSelected(false); g_pretrackmenuitem->InvalidateVisual(true); } // 去掉焦点 menuPop->SetFocusable(false); menuPop->WriteFlag(CoreFlags::IsLayeredWindow, true); menuPop->TrackingPopup(g_x, g_y, true, cx, cy, g_trackmenupopup.get()); suic::SystemHelper::RemoveHwndMessageSystemHook(g_trackmenupopup.get()); g_trackmenupopup = NULL; SetTrackMenu(NULL); } g_mainmenu = MenuPtr(); if (g_trackmenuitem) { g_trackmenuitem->SetSelected(false); g_trackmenuitem->InvalidateVisual(true); } g_pretrackmenuitem = MenuItemPtr(); g_trackmenuitem = MenuItemPtr(); return 0; }