//---------------------------------------------------------------------------------------------------- CMouseEventResult UIViewCreatorDataSource::dbOnMouseDown (const CPoint& where, const CButtonState& buttons, int32_t row, int32_t column, CDataBrowser* browser) { mouseDownRow = row; if (buttons.isLeftButton ()) { if (!buttons.isDoubleClick ()) return kMouseEventHandled; addViewToCurrentEditView (); } else if (buttons.isRightButton ()) { const std::string& viewName = getStringList ()->at (static_cast<uint32_t> (mouseDownRow)); std::string menuEntryName = "Add a new '" + viewName + "'"; COptionMenu menu; menu.setStyle (kPopupStyle); menu.addEntry (menuEntryName.c_str ()); CPoint menuLocation (where); browser->localToFrame (menuLocation); if (menu.popup (browser->getFrame (), menuLocation)) { if (menu.getEntry (menu.getLastResult ())) addViewToCurrentEditView (); } } mouseDownRow = -1; return kMouseDownEventHandledButDontNeedMovedOrUpEvents; }
virtual CMouseEventResult onMouseDown (CPoint &where, const long &buttons) { if (buttons == kRButton) { CView* view = getViewAt (where); if (!view || view->isTypeOf ("CTabButton")) { CRect r; localToFrame (where); r.offset (where.x, where.y); r.offset (-size.left, -size.top); COptionMenu* menu = new COptionMenu (r, NULL, 0); menu->addEntry ("Tabs Left"); menu->addEntry ("Tabs Right"); menu->addEntry ("Tabs Top"); menu->addEntry ("Tabs Bottom"); menu->addEntry ("-"); menu->addEntry ("Align Tabs Centered"); menu->addEntry ("Align Tabs Left/Top"); menu->addEntry ("Align Tabs Right/Bottom"); getFrame ()->addView (menu); menu->takeFocus (); long res = menu->getLastResult (); getFrame ()->removeView (menu); if (res != -1) { if (res < 4) { r = size; editor->setTabView (getFrame (), r, res); } else { alignTabs (kAlignCenter + res - 5); } } return kMouseDownEventHandledButDontNeedMovedOrUpEvents; } } return CTabView::onMouseDown (where, buttons); }