Ejemplo n.º 1
0
int main(int argc, char **argv) {
    AppWindow* win = new AppWindow(215, 144);
    win->begin();
    MenuBar* o = new MenuBar(0, 0, 215, 25);
    o->menu(menu_);

    Fl_Image* img1 = (Fl_Image*)IconLoader::get("document-new", ICON_SIZE_TINY);
    Fl_Image* img2 = (Fl_Image*)IconLoader::get("document-save", ICON_SIZE_SMALL);
    Fl_Image* img3 = (Fl_Image*)IconLoader::get("system-log-out", ICON_SIZE_TINY);

    menu_[1].image(img1);
    menu_[1].tooltip("Tooltip for First Item");
    menu_[2].image(img2);
    menu_[8].image(img3);

    MenuButton* b = new MenuButton(65, 80, 90, 25, "menu");
    b->menu(menu_menu);

    Fl_Image* img4 = (Fl_Image*)IconLoader::get("folder", ICON_SIZE_TINY);
    menu_menu[0].image(img4);
    menu_menu[0].tooltip("This should be some folder");
    win->end();
    win->show(argc, argv);
    return Fl::run();
}
Ejemplo n.º 2
0
	//------------------------------------------------------------------------------------
	void TimeStateTool::hideUI()
	{
		MenuBar* mb = MenuBarList::getSingleton().getMenuBar("EditorMenuBar");
		mb->removeItem("TimeState");
		mb->removeItem("Sky");
		showTimeStatePanel(false);
	}
Ejemplo n.º 3
0
void DinoGUI::init_menus(MenuBar& mbar) {

  MenuItem* file_item = manage(new MenuItem("_File", true));
  Menu* file_menu = manage(new Menu);
  file_item->set_submenu(*file_menu);
  mbar.append(*file_item);
  create_menu_item(*file_menu, "Clear all", "file_clear_all",
                   Stock::CLEAR, &DinoGUI::slot_file_clear_all);
  file_menu->append(*manage(new SeparatorMenuItem));
  create_menu_item(*file_menu, Stock::QUIT, "file_quit", 
                   &DinoGUI::slot_file_quit);
  
  MenuItem* edit_item = manage(new MenuItem("_Edit", true));
  Menu* edit_menu = manage(new Menu);
  edit_item->set_submenu(*edit_menu);
  mbar.append(*edit_item);
  create_menu_item(*edit_menu, Stock::UNDO, "edit_undo",
		   &DinoGUI::slot_edit_undo);
  m_proxy.signal_stack_changed().
    connect(compose(mem_fun(*this, &DinoGUI::update_undo),
		    mem_fun(m_proxy, &CommandProxy::get_next_undo_name)));
  update_undo(m_proxy.get_next_undo_name());
  edit_menu->append(*manage(new SeparatorMenuItem));
  create_menu_item(*edit_menu, Stock::CUT, "edit_cut", 
                   &DinoGUI::slot_edit_cut);
  create_menu_item(*edit_menu, Stock::COPY, "edit_copy", 
                   &DinoGUI::slot_edit_copy);
  create_menu_item(*edit_menu, Stock::PASTE, "edit_paste", 
                   &DinoGUI::slot_edit_paste);
  create_menu_item(*edit_menu, Stock::DELETE, "edit_delete", 
                   &DinoGUI::slot_edit_delete);
  edit_menu->append(*manage(new SeparatorMenuItem));
  create_menu_item(*edit_menu, "Select all", "edit_select_all", 
                   &DinoGUI::slot_edit_select_all);
  
  MenuItem* transport_item = manage(new MenuItem("_Transport", true));
  Menu* transport_menu = manage(new Menu);
  transport_item->set_submenu(*transport_menu);
  mbar.append(*transport_item);
  create_menu_item(*transport_menu, Stock::MEDIA_PLAY, "transport_play", 
                   &DinoGUI::slot_transport_play);
  create_menu_item(*transport_menu, "_Stop", "transport_stop", 
                   Stock::MEDIA_PAUSE, &DinoGUI::slot_transport_stop);
  create_menu_item(*transport_menu, "_Go to start", "transport_go_to_start", 
                   Stock::MEDIA_PREVIOUS, &DinoGUI::slot_transport_go_to_start);
  
  MenuItem* plugins_item = manage(new MenuItem("_Plugins", true));
  Menu* plugins_menu = manage(new Menu);
  plugins_item->set_submenu(*plugins_menu);
  mbar.append(*plugins_item);
  create_menu_item(*plugins_menu, "_Manage plugins", "plugins_manage_plugins", 
                   Stock::DISCONNECT, &DinoGUI::slot_plugins_manage);

  MenuItem* help_item = manage(new MenuItem("_Help", true));
  Menu* help_menu = manage(new Menu);
  help_item->set_submenu(*help_menu);
  mbar.append(*help_item);
  create_menu_item(*help_menu, "_About Dino", "help_about", 
                   Stock::ABOUT, &DinoGUI::slot_help_about_dino);
}
	//------------------------------------------------------------------------------------
	WorldObjectPropertiesTool::~WorldObjectPropertiesTool()
	{
		MenuBar* mb = MenuBarList::getSingleton().getMenuBar("EditorMenuBar");
		mb->removeItem("WorldObjectProperties");
		mb->removeItem("WorldObjectPropertiesSep");
		mb->removeItem("Windows");
	}
QAction* SpectralLibraryMatchResults::createAction()
{
   // Add toolbar button and menu item to invoke the window
   QAction* pShowAction(NULL);
   ToolBar* pToolBar = static_cast<ToolBar*>(Service<DesktopServices>()->getWindow("Spectral", TOOLBAR));
   if (pToolBar != NULL)
   {
      MenuBar* pMenuBar = pToolBar->getMenuBar();
      if (pMenuBar != NULL)
      {
         QAction* pMenuAction = pMenuBar->getMenuItem("/Spectral/Support Tools");
         if (pMenuAction != NULL)
         {
            QMenu* pMenu = pMenuBar->getMenu(pMenuAction);
            if (pMenu != NULL)
            {
               pShowAction = pMenu->addAction("Spectral Library Match Results Window");
               if (pShowAction != NULL)
               {
                  QPixmap pixShowResults(ShowResultsIcon);
                  pShowAction->setIcon(QIcon(pixShowResults));
                  pShowAction->setCheckable(true);
                  pShowAction->setAutoRepeat(false);
                  pShowAction->setStatusTip("Toggles the display of the Spectral Library Match Results Window");
                  pToolBar->addSeparator();
                  pToolBar->addButton(pShowAction);
               }
            }
         }
      }
   }

   return pShowAction;
}
Ejemplo n.º 6
0
void DockCont::WindowMenu()
{
	MenuBar bar;
	DockContMenu menu(base);
	menu.ContainerMenu(bar, this, true);
	bar.Execute();
}
SpectralLibraryMatchResults::~SpectralLibraryMatchResults()
{
   Service<DesktopServices> pDesktop;

   // remove toolbar button and menu item
   QAction* pAction = getAction();
   if (pAction != NULL)
   {
      ToolBar* pToolBar = static_cast<ToolBar*>(pDesktop->getWindow("Spectral", TOOLBAR));
      if (pToolBar != NULL)
      {
         pToolBar->removeItem(pAction);
         MenuBar* pMenuBar = pToolBar->getMenuBar();
         if (pMenuBar != NULL)
         {
            pMenuBar->removeMenuItem(pAction);
         }
      }
   }

   // dockwindow should still exist so detach from it
   DockWindow* pWindow = getDockWindow();
   if (pWindow != NULL)
   {
      pWindow->detach(SIGNAL_NAME(DockWindow, AboutToShowContextMenu),
         Slot(this, &SpectralLibraryMatchResults::updateContextMenu));
   }
}
Ejemplo n.º 8
0
	//------------------------------------------------------------------------------------
	QuitTool::~QuitTool()
	{
		MenuBar* mb = MenuBarList::getSingleton().getMenuBar("EditorMenuBar");
		mb->removeItem("Quit");
		mb->removeItem("QuitSep");
		mb->removeItem("File");
	}
Ejemplo n.º 9
0
  //------------------------------------------------------------------------------------
  void EnvironmentTool::showUI()
  {
    MenuBar* mb = MenuBarList::getSingleton().getMenuBar("EditorMenuBar");
    mb->insertItem("Sky", MenuItemType::POPUP, "#{Sky}");

    mb->insertItem("EnvironmentParams", MenuItemType::NORMAL, "#{Environment}", "Sky");
    mb->setItemDescription("EnvironmentParams", "#{Environment_Desc}");
    mb->attachTool("EnvironmentParams", this);
  }
Ejemplo n.º 10
0
	//------------------------------------------------------------------------------------
	FrameStatsConfigTool::FrameStatsConfigTool()
	{
		MenuBar* mb = MenuBarList::getSingleton().getMenuBar("EditorMenuBar");
		mb->insertItem("Settings", MenuItemType::Popup, "#{Settings}");

		mb->insertItem("FrameStatsConfig", MenuItemType::Normal, "#{FrameStatsConfig}", "Settings");
		mb->setItemDescription("FrameStatsConfig", "#{FrameStatsConfig_Desc}");
		mb->attachTool("FrameStatsConfig", this);
	}
Ejemplo n.º 11
0
Archivo: Test.C Proyecto: juddy/edcde
void TestWindow::Initialize()
{
   MenuBar *mbar;
   Menu *menu;

   mbar = new MenuBar(this);
   container = new Container("PrinterSubSystem", this, "Printers");
   container->WidthHeight(600, 400);
   container->ContainerView(TREE);
   SetWorkWindow(container);

   // File menu
   menu = new Menu(mbar, "File", "F");
     new Button(menu, "Exit", PUSH_BUTTON, ExitCB, this, "x", "ALT+F4");

   // Edit menu
   menu = new Menu(mbar, "Edit", "E");
     new Button(menu, "Cut", PUSH_BUTTON, NULL, NULL, "t", "Shift+Del");
     new Button(menu, "Copy", PUSH_BUTTON, NULL, NULL, "C", "Ctrl+Ins");
     new Button(menu, "Paste", PUSH_BUTTON, NULL, NULL, "P", "Shift+Ins");
     new Button(menu, "Delete", PUSH_BUTTON, NULL, NULL, "D");

   // View menu
   menu = new Menu(mbar, "View", "V");
     new Button(menu, "New", PUSH_BUTTON, NULL, NULL, "N");
     new Sep(menu);
     new Button(menu, "Select All", PUSH_BUTTON, NULL, NULL, "S", "Ctrl+/");
     new Button(menu, "Unselect All", PUSH_BUTTON, NULL, NULL, "U", "Ctrl+\\");
     new Sep(menu);
     new Button(menu, "Set Preferences...", PUSH_BUTTON, NULL, NULL, "P");
     new Sep(menu);
     new Button(menu, "Save Settings...", PUSH_BUTTON, NULL, NULL, "t");

   // Actions Menu
   menu = new Menu(mbar, "Actions", "A");
     new Button(menu, "Monitor", PUSH_BUTTON, NULL, NULL, "M");
     new Button(menu, "Cancel Job", PUSH_BUTTON, NULL, NULL, "C");

   // Help Menu
   menu = new Menu(mbar, "Help", "H");
     new Button(menu, "Introduction", PUSH_BUTTON, NULL, NULL, "I");
     new Sep(menu);
     new Button(menu, "Tasks", PUSH_BUTTON, NULL, NULL, "T");
     new Button(menu, "Reference", PUSH_BUTTON, NULL, NULL, "R");
     new Button(menu, "On Item", PUSH_BUTTON, NULL, NULL, "O");
     new Sep(menu);
     new Button(menu, "Using Help", PUSH_BUTTON, NULL, NULL, "U");
     new Sep(menu);
     new Button(menu, "Version", PUSH_BUTTON, NULL, NULL, "V");
   mbar->SetHelpMenu(menu);

   // Debug menu
   menu = new Menu(mbar, "Debug", "G");
     new Button(menu, "Print Objects", PUSH_BUTTON, PrintObjectsCB, Parent());
     new Button(menu, "Print UI", PUSH_BUTTON, PrintUICB, Parent());

}
Ejemplo n.º 12
0
	//------------------------------------------------------------------------------------
	void CameraPositionTool::updateMenuItems()
	{
		MenuBar* mb = MenuBarList::getSingleton().getMenuBar("EditorMenuBar");
		bool hasActiveWorld = (WorldManager::getSingleton().getActiveWorld() != nullptr);
		for(int i = 0; i != NUM_POSITIONS; ++i)
		{
			mb->setItemEnabled( STORE_MENU_ITEM_ID[i], hasActiveWorld );
			mb->setItemEnabled( RESTORE_MENU_ITEM_ID[i], hasActiveWorld && isPositionSaved(i) );
		}
	}
Ejemplo n.º 13
0
void MenuBar::SetupRestoreFocus()
{
	MenuBar *q = GetMasterMenu();
	while(q) {
		if(q->HasFocusDeep()) return;
		q = q->submenu;
	}
	restorefocus = GetFocusCtrl();
	LLOG("SetupRestoreFocus -> " << UPP::Name(restorefocus));
}
	WorldObjectPropertiesTool::WorldObjectPropertiesTool()
	{
		MenuBar* mb = MenuBarList::getSingleton().getMenuBar("EditorMenuBar");
		mb->insertItem("Windows", MenuItemType::Popup, "#{Windows}");
		
		mb->insertItem("WorldObjectProperties", MenuItemType::Normal, "", "Windows");
		mb->setItemDescription("WorldObjectProperties", "#{WorldObjectProperties_Desc}");
		mb->attachTool("WorldObjectProperties", this);
		
		registerUISettingsListener();
	}
Ejemplo n.º 15
0
void Ide::FindStdDir()
{
	String n = GetFileFolder(editfile);
	MenuBar menu;
	if(!IsNull(n))
		menu.Add(n, THISBACK1(FindSetStdDir, n));
	Vector<String> d = GetUppDirs();
	for(int i = 0; i < d.GetCount(); i++)
		menu.Add(d[i], THISBACK1(FindSetStdDir, d[i]));
	menu.Execute(&ff.folder, ff.folder.GetPushScreenRect().BottomLeft());
}
Ejemplo n.º 16
0
	void RightDown(Point, dword) {
		CallbackArgTarget<int> result;
		MenuBar menu;
		for(int i = 0; i < 10; i++)
			menu.Add(AsString(i), result[i]);
		menu.Separator();
		menu.Add("Exit", THISBACK(Exit));
		menu.Execute();
		if(!IsNull(result))
			PromptOK("You have selected " + AsString((int)result));
	}
void DClusterUserHasDevicesListPage::initializeWidget()
{
    //导航栏
    QString strLeftBtn = tr("上一步");
    QString strTitle = tr("成员所属设备");
    navigationMenuBar = new NavigationMenuBar(this);
    navigationMenuBar->setLeftText(strLeftBtn);
    navigationMenuBar->setTitleText(strTitle);
    connect(navigationMenuBar, SIGNAL(leftClicked()), this, SLOT(on_btnPrepage_clicked()));

    MenuBar* menuBar = navigationMenuBar->getMenuBar();
    addDeviceAction = menuBar->addAction(tr("添加设备"));
    deleteDeviceAction = menuBar->addAction(tr("删除设备"));
    connect(addDeviceAction, SIGNAL(triggered()),this,SLOT(on_addDeviceAction_clicked()));
    connect(deleteDeviceAction, SIGNAL(triggered()), this, SLOT(on_deleteDeviceAction_clicked()));

    QHBoxLayout* pHLTop = new QHBoxLayout();
    pHLTop->addWidget(navigationMenuBar);
    pHLTop->setSpacing(0);
    pHLTop->setMargin(0);
    this->setTopbarLayout(pHLTop);

    //成员信息
    QPixmap pixmapLeft(ImagePath::USER_PORTRAIT);
    QPixmap pixmapRight(ImagePath::RIGHT_HOLLOW_ARROWS);
    btnUserDetail = new GroupButton(this);
    btnUserDetail->setPixMap(pixmapLeft);
    btnUserDetail->setReserve(pixmapRight);
    btnUserDetail->setAttribute(Qt::WA_LayoutUsesWidgetRect);
    btnUserDetail->setFixedHeight(this->screenHeight()*0.12);
    btnUserDetail->setStyleSheet(SheetStyle::GROUPBUTTON_BOTTOMBORDER);
    connect(btnUserDetail, SIGNAL(clicked()), this, SLOT(on_btnUserDetail_clicked()));

    //成员所属设备列表
    devListWidget = new GListWidget(this);
    this->setGListWidget(devListWidget);
    connect(devListWidget, SIGNAL(flexClicked(int)), this, SLOT(on_btnListWidgetFlex_clicked(int)));

    //主体布局
    QVBoxLayout* vbLayout = new QVBoxLayout;
    vbLayout->addWidget(btnUserDetail);
    vbLayout->addSpacing(this->screenHeight()*0.037);
    vbLayout->addWidget(devListWidget);
    vbLayout->setSpacing(0);
    vbLayout->setMargin(0);
    vbLayout->addStretch(0);
    this->setBodyPartLayout(vbLayout);
    curFixedContentHeight += this->screenHeight()*0.037;

    //屏幕触摸滚动设置
    this->installScrollViewportArea();
    this->loadLocalData();
    timerID = this->startTimer(ConstNum::MAX_TIME_INTERVAL);
}
Ejemplo n.º 18
0
	//------------------------------------------------------------------------------------
	void TimeStateTool::showUI()
	{
		MenuBar* mb = MenuBarList::getSingleton().getMenuBar("EditorMenuBar");
		mb->insertItem("Sky", MenuItemType::POPUP, "#{Sky}");
		
		mb->insertItem("TimeState", MenuItemType::NORMAL, "#{TimeState}", "Sky");
		mb->setItemDescription("TimeState", "#{TimeState_Desc}");
		mb->attachTool("TimeState", this);
		
		setStateVisible(false);
	}
Ejemplo n.º 19
0
	virtual void RightDown(Point p, dword keyflags) {
		int result = Null;
		MenuBar menu;
		for(int i = 0; i < 10; i++)
			menu.Add(AsString(i), [=, &result] { result = i; });
		menu.Execute();
		if(IsNull(result))
			PromptOK("Menu was cancelled");
		else
			PromptOK("You have selected " + AsString((int)result));
	}
Ejemplo n.º 20
0
/** int QWidget::height()
 * bind/QWidget.h:15
 */
static int MenuBar_height(lua_State *L) {
  try {
    MenuBar *self = *((MenuBar **)dub_checksdata(L, 1, "mimas.MenuBar"));
    lua_pushnumber(L, self->height());
    return 1;
  } catch (std::exception &e) {
    lua_pushfstring(L, "height: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "height: Unknown exception");
  }
  return dub_error(L);
}
Ejemplo n.º 21
0
ConvolutionMatrixEditor::~ConvolutionMatrixEditor()
{
   QAction* pWindowAction = getAction();
   if (pWindowAction != NULL)
   {
      MenuBar* pMenuBar = Service<DesktopServices>()->getMainMenuBar();
      if (pMenuBar != NULL)
      {
         pMenuBar->removeMenuItem(pWindowAction);
      }
   }
}
Ejemplo n.º 22
0
/** void QWidget::activateWindow()
 * bind/QWidget.h:35
 */
static int MenuBar_activateWindow(lua_State *L) {
  try {
    MenuBar *self = *((MenuBar **)dub_checksdata(L, 1, "mimas.MenuBar"));
    self->activateWindow();
    return 0;
  } catch (std::exception &e) {
    lua_pushfstring(L, "activateWindow: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "activateWindow: Unknown exception");
  }
  return dub_error(L);
}
Ejemplo n.º 23
0
/** bool QWidget::isFullScreen()
 * bind/QWidget.h:36
 */
static int MenuBar_isFullScreen(lua_State *L) {
  try {
    MenuBar *self = *((MenuBar **)dub_checksdata(L, 1, "mimas.MenuBar"));
    lua_pushboolean(L, self->isFullScreen());
    return 1;
  } catch (std::exception &e) {
    lua_pushfstring(L, "isFullScreen: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "isFullScreen: Unknown exception");
  }
  return dub_error(L);
}
Ejemplo n.º 24
0
/** QString QWidget::windowTitle()
 * bind/QWidget.h:40
 */
static int MenuBar_windowTitle(lua_State *L) {
  try {
    MenuBar *self = *((MenuBar **)dub_checksdata(L, 1, "mimas.MenuBar"));
    lua_pushstring(L, self->windowTitle().toUtf8());
    return 1;
  } catch (std::exception &e) {
    lua_pushfstring(L, "windowTitle: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "windowTitle: Unknown exception");
  }
  return dub_error(L);
}
Ejemplo n.º 25
0
/** QVariant QObject::property(const char *name)
 * bind/QObject.h:9
 */
static int MenuBar_property(lua_State *L) {
  try {
    MenuBar *self = *((MenuBar **)dub_checksdata(L, 1, "mimas.MenuBar"));
    const char *name = dub_checkstring(L, 2);
    return pushVariantInLua(L, self->property(name));
  } catch (std::exception &e) {
    lua_pushfstring(L, "property: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "property: Unknown exception");
  }
  return dub_error(L);
}
	//------------------------------------------------------------------------------------
	void WorldObjectPropertiesTool::uiSettingsChanged( const ConfigSettingsEvent& _evt)
	{
		bool value = WorldObjectPropertiesWindowManager::getSingleton().isVisible();
		String caption;
		if(value)
			caption = "#{WorldObjectProperties_Shown}";
		else
			caption = "#{WorldObjectProperties_Hidden}";

		MenuBar* mb = MenuBarList::getSingleton().getMenuBar("EditorMenuBar");
		mb->setItemCaption("WorldObjectProperties", caption);
	}
Ejemplo n.º 27
0
/** void QWidget::setFocus()
 * bind/QWidget.h:20
 */
static int MenuBar_setFocus(lua_State *L) {
  try {
    MenuBar *self = *((MenuBar **)dub_checksdata(L, 1, "mimas.MenuBar"));
    self->setFocus(Qt::OtherFocusReason);
    return 0;
  } catch (std::exception &e) {
    lua_pushfstring(L, "setFocus: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "setFocus: Unknown exception");
  }
  return dub_error(L);
}
Ejemplo n.º 28
0
/** void QMenuBar::addMenu(Menu *menu)
 * bind/QMenuBar.h:10
 */
static int MenuBar_addMenu(lua_State *L) {
  try {
    MenuBar *self = *((MenuBar **)dub_checksdata(L, 1, "mimas.MenuBar"));
    Menu *menu = *((Menu **)dub_checksdata(L, 2, "mimas.Menu"));
    self->addMenu(menu);
    return 0;
  } catch (std::exception &e) {
    lua_pushfstring(L, "addMenu: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "addMenu: Unknown exception");
  }
  return dub_error(L);
}
Ejemplo n.º 29
0
void MenuButton::mouseEntered(MouseEvent& me)
{
    Button::mouseEntered(me);

    MenuBar *menu = (MenuBar*)getParent(); // <-- unsafe cast, beware!
    if(!menu)
        throw GCN_EXCEPTION("MenuButton has no parent menu");

    if(menu->getActiveButton())
    {
        menu->setActiveButton(this);
    }
}
Ejemplo n.º 30
0
//================================================================================
// メニューバータップチェック処理
//================================================================================
bool HitChecker::checkTapOnMenuBar(Point touchPoint)
{
    MenuBar* pMenuBar = m_pUIManager->getMenuBar();

    Rect menuBarRect = (pMenuBar->getSprite())->getBoundingBox();

    if(menuBarRect.containsPoint(touchPoint))
    {
        return true;
    }

    return false;
}