Files
create/src/Mod/Start/Gui/Workbench.cpp
2011-10-10 13:44:52 +00:00

121 lines
4.3 KiB
C++

/***************************************************************************
* Copyright (c) 2008 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <qobject.h>
#endif
#include "Workbench.h"
#include <Gui/ToolBarManager.h>
#include <Gui/MenuManager.h>
#include <Gui/ToolBarManager.h>
#include <Gui/DockWindowManager.h>
#include <Gui/Application.h>
#include <Gui/Action.h>
#include <Gui/Command.h>
#include <Gui/Selection.h>
#include <Gui/ToolBoxManager.h>
#include <App/Document.h>
#include <App/DocumentObject.h>
#include <Base/Console.h>
#include <Base/Exception.h>
#include <Mod/Start/App/StartConfiguration.h>
using namespace StartGui;
TYPESYSTEM_SOURCE(StartGui::Workbench, Gui::StdWorkbench)
StartGui::Workbench::Workbench()
{
}
StartGui::Workbench::~Workbench()
{
}
void StartGui::Workbench::activated()
{
try {
Gui::Command::doCommand(Gui::Command::Gui,"import WebGui");
Gui::Command::doCommand(Gui::Command::Gui,"from StartPage import StartPage");
#if defined(FC_OS_WIN32)
Gui::Command::doCommand(Gui::Command::Gui,"WebGui.openBrowserHTML"
"(StartPage.handle(),App.getResourceDir() + 'Mod/Start/StartPage/','Start page')");
#else
Gui::Command::doCommand(Gui::Command::Gui,"WebGui.openBrowserHTML"
"(StartPage.handle(),'file://' + App.getResourceDir() + 'Mod/Start/StartPage/','Start page')");
#endif
}
catch (const Base::Exception& e) {
Base::Console().Error("%s\n", e.what());
}
}
void StartGui::Workbench::setupContextMenu(const char* recipient,Gui::MenuItem* item) const
{
}
Gui::MenuItem* StartGui::Workbench::setupMenuBar() const
{
return Gui::StdWorkbench::setupMenuBar();
}
Gui::ToolBarItem* StartGui::Workbench::setupToolBars() const
{
Gui::ToolBarItem* root = StdWorkbench::setupToolBars();
// web navigation toolbar
Gui::ToolBarItem* navigation = new Gui::ToolBarItem(root);
navigation->setCommand("Navigation");
*navigation << "Web_OpenWebsite"
<< "Separator"
<< "Web_BrowserBack"
<< "Web_BrowserNext"
<< "Web_BrowserRefresh"
<< "Web_BrowserStop"
<< "Separator"
<< "Web_BrowserZoomIn"
<< "Web_BrowserZoomOut";
return root;
}
Gui::ToolBarItem* StartGui::Workbench::setupCommandBars() const
{
Gui::ToolBarItem* root = new Gui::ToolBarItem;
return root;
}
Gui::DockWindowItems* StartGui::Workbench::setupDockWindows() const
{
Gui::DockWindowItems* root = Gui::StdWorkbench::setupDockWindows();
root->setVisibility(false); // hide all dock windows by default
root->setVisibility("Std_CombiView",true); // except of the combi view
return root;
}