本文整理汇总了C++中ToolBarItem类的典型用法代码示例。如果您正苦于以下问题:C++ ToolBarItem类的具体用法?C++ ToolBarItem怎么用?C++ ToolBarItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ToolBarItem类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: WriteNode
//----------------------------------------------------------------
wxXmlNode* ToolBar::WriteNode()
/**
* \brief Writes a 'toolbar' xml element node.
* See class description for structure of such an xml node.
* \return The 'toolbar' xml element node; or NULL on error.
**/
{
// ToolBar Node erstellen
wxXmlNode* node = PenvHelper::CreateXmlNode(_T("toolbar"));
node->AddProperty(_T("id"), m_id);
node->AddProperty(_T("name"), m_name);
node->AddProperty(_T("visible"), PenvHelper::CreateBoolean(m_visible));
// Positions Node erstellen (node ist parent!)
wxAuiManager* mgr = Environment::Get()->GetFrame()->GetManager();
wxString posinfo = mgr->SavePaneInfo(m_paneinfo);
wxXmlNode* posnode = PenvHelper::CreateXmlNode(_T("position"), posinfo);
PenvHelper::AddXmlChildNode(node, posnode);
// ToolBar Itemes erstellen und hinzufügen
for (size_t i=0; i<m_array->Count(); ++i)
{
ToolBarItem* item = (*m_array)[i];
wxXmlNode* toolitemnode = item->WriteNode();
PenvHelper::AddXmlChildNode(node, toolitemnode);
}
return (node);
}
开发者ID:Sneedd,项目名称:penv,代码行数:27,代码来源:toolbar.cpp
示例2: ToolBarItem
ToolBarItem *ToolBar::add_separator_item(const std::string &name)
{
ToolBarItem *item = mforms::manage(new ToolBarItem(SeparatorItem));
item->set_name(name);
add_item(item);
return item;
}
开发者ID:ThiagoGarciaAlves,项目名称:mysql-workbench,代码行数:7,代码来源:toolbar.cpp
示例3: find_item
bool ToolBar::get_item_checked(const std::string &name)
{
ToolBarItem *item = find_item(name);
if (item)
return item->get_checked();
return false;
}
开发者ID:ThiagoGarciaAlves,项目名称:mysql-workbench,代码行数:7,代码来源:toolbar.cpp
示例4: wxLogError
//----------------------------------------------------------------
bool ToolBar::ReadNode(wxXmlNode* node)
/**
* \brief Read out a 'toolbar' xml element node.
* See class description for structure of such an xml node.
* \param node The 'toolbar' xml element node.
* \return True on success; false otherwise.
**/
{
// Fehler überprüfen
if (unlikely(node == NULL)) {
wxLogError(_T("[penv::ToolBar::ReadNode] Cannot load xml node, because parameter argument is NULL."));
return (false);
}
if (unlikely(node->GetType() != wxXML_ELEMENT_NODE)) {
wxLogError(_T("[penv::ToolBar::ReadNode] Cannot load, xml node must be an element node."));
return (false);
}
if (unlikely(node->GetName() != _T("toolbar"))) {
wxLogError(_T("[penv::ToolBar::ReadNode] Cannot load, xml element node must have the name \"toolbar\". This element node has the name \"%s\"."), node->GetName().c_str());
return (false);
}
// Einlesen der Attribute der Toolbar
if (unlikely(!node->HasProp(_T("id")))) {
wxLogError(_T("[penv::ToolBar::ReadNode] Cannot load, xml element node must have the attribute \"id\". This element node has the name \"%s\"."), node->GetName().c_str());
return (false);
}
m_id = node->GetPropVal(_T("id"), wxEmptyString);
CorrectToolbarId();
m_name = node->GetPropVal(_T("name"), wxEmptyString);
m_visible = PenvHelper::ParseBoolean(node->GetPropVal(_T("visible"), _T("true")));
// Einlesen der Position und der ToolBar Items
Environment* env = Environment::Get();
wxXmlNode* child = node->GetChildren();
while (child != NULL)
{
// Nicht Elemente überspringen
if (unlikely(child->GetType() != wxXML_ELEMENT_NODE)) {
child = child->GetNext();
continue;
}
if (child->GetName() == _T("position")) {
wxString strg = child->GetNodeContent();
env->GetFrame()->GetManager()->LoadPaneInfo(strg, m_paneinfo);
}
if (child->GetName() == _T("toolitem")) {
ToolBarItem* item = new ToolBarItem();
if (!item->ReadNode(child)) {
wxLogWarning(_T("[penv::ToolBar::ReadNode] Toolbar item in toolbar \"%s\" could not be readed. Skipping..."), m_name.c_str());
delete item;
} else {
Add(item);
}
}
child = child->GetNext();
}
return (true);
}
开发者ID:Sneedd,项目名称:penv,代码行数:60,代码来源:toolbar.cpp
示例5: ToolBarItem
void Workbench::setupCustomToolbars(ToolBarItem* root, const Base::Reference<ParameterGrp>& hGrp) const
{
std::vector<Base::Reference<ParameterGrp> > hGrps = hGrp->GetGroups();
CommandManager& rMgr = Application::Instance->commandManager();
std::string separator = "Separator";
for (std::vector<Base::Reference<ParameterGrp> >::iterator it = hGrps.begin(); it != hGrps.end(); ++it) {
bool active = (*it)->GetBool("Active", true);
if (!active) // ignore this toolbar
continue;
ToolBarItem* bar = new ToolBarItem(root);
bar->setCommand("Custom");
// get the elements of the subgroups
std::vector<std::pair<std::string,std::string> > items = hGrp->GetGroup((*it)->GetGroupName())->GetASCIIMap();
for (std::vector<std::pair<std::string,std::string> >::iterator it2 = items.begin(); it2 != items.end(); ++it2) {
if (it2->first.substr(0, separator.size()) == separator) {
*bar << "Separator";
}
else if (it2->first == "Name") {
bar->setCommand(it2->second);
}
else {
Command* pCmd = rMgr.getCommandByName(it2->first.c_str());
if (!pCmd) { // unknown command
// first try the module name as is
std::string pyMod = it2->second;
try {
Base::Interpreter().loadModule(pyMod.c_str());
// Try again
pCmd = rMgr.getCommandByName(it2->first.c_str());
}
catch(const Base::Exception&) {
}
}
// still not there?
if (!pCmd) {
// add the 'Gui' suffix
std::string pyMod = it2->second + "Gui";
try {
Base::Interpreter().loadModule(pyMod.c_str());
// Try again
pCmd = rMgr.getCommandByName(it2->first.c_str());
}
catch(const Base::Exception&) {
}
}
if (pCmd) {
*bar << it2->first; // command name
}
}
}
}
}
开发者ID:AjinkyaDahale,项目名称:FreeCAD,代码行数:55,代码来源:Workbench.cpp
示例6: ToolBarItem
ToolBarItem* StdWorkbench::setupToolBars() const
{
ToolBarItem* root = new ToolBarItem;
// File
ToolBarItem* file = new ToolBarItem( root );
file->setCommand("File");
*file << "Std_New" << "Std_Open" << "Std_Save" << "Std_Print" << "Separator" << "Std_Cut"
<< "Std_Copy" << "Std_Paste" << "Separator" << "Std_Undo" << "Std_Redo" << "Separator"
<< "Std_Refresh" << "Separator" << "Std_WhatsThis";
// Workbench switcher
ToolBarItem* wb = new ToolBarItem( root );
wb->setCommand("Workbench");
*wb << "Std_Workbench";
// Macro
ToolBarItem* macro = new ToolBarItem( root );
macro->setCommand("Macro");
*macro << "Std_DlgMacroRecord" << "Std_MacroStopRecord" << "Std_DlgMacroExecute"
<< "Std_DlgMacroExecuteDirect";
// View
ToolBarItem* view = new ToolBarItem( root );
view->setCommand("View");
*view << "Std_ViewFitAll" << "Std_ViewFitSelection" << "Std_DrawStyle" << "Separator" << "Std_ViewAxo" << "Separator" << "Std_ViewFront"
<< "Std_ViewTop" << "Std_ViewRight" << "Separator" << "Std_ViewRear" << "Std_ViewBottom"
<< "Std_ViewLeft" << "Separator" << "Std_MeasureDistance" ;
return root;
}
开发者ID:huanyingtianhe,项目名称:FreeCAD,代码行数:30,代码来源:Workbench.cpp
示例7: ToolBarItem
void Workbench::setupCustomToolbars(ToolBarItem* root, const char* toolbar) const
{
std::string name = this->name();
ParameterGrp::handle hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")
->GetGroup("Workbench")->GetGroup(name.c_str())->GetGroup(toolbar);
std::vector<Base::Reference<ParameterGrp> > hGrps = hGrp->GetGroups();
CommandManager& rMgr = Application::Instance->commandManager();
for (std::vector<Base::Reference<ParameterGrp> >::iterator it = hGrps.begin(); it != hGrps.end(); ++it) {
bool active = (*it)->GetBool("Active", true);
if (!active) // ignore this toolbar
continue;
ToolBarItem* bar = new ToolBarItem(root);
bar->setCommand("Custom");
// get the elements of the subgroups
std::vector<std::pair<std::string,std::string> > items = hGrp->GetGroup((*it)->GetGroupName())->GetASCIIMap();
for (std::vector<std::pair<std::string,std::string> >::iterator it2 = items.begin(); it2 != items.end(); ++it2) {
if (it2->first == "Separator") {
*bar << "Separator";
} else if (it2->first == "Name") {
bar->setCommand(it2->second);
} else {
Command* pCmd = rMgr.getCommandByName(it2->first.c_str());
if (!pCmd) { // unknown command
// try to find out the appropriate module name
std::string pyMod = it2->second + "Gui";
try {
Base::Interpreter().loadModule(pyMod.c_str());
}
catch(const Base::Exception&) {
}
// Try again
pCmd = rMgr.getCommandByName(it2->first.c_str());
}
if (pCmd) {
*bar << it2->first; // command name
}
}
}
}
}
开发者ID:JonasThomas,项目名称:free-cad,代码行数:44,代码来源:Workbench.cpp
示例8: wxToolBar
//----------------------------------------------------------------
bool ToolBar::Update()
/**
* \brief Updates the toolbar and all its item. In some cases it is
* necessary to update the wxAuiManager after calling this method.
* \return True on success; false otherwise.
**/
{
Environment* env = Environment::Get();
if (unlikely(m_toolbar == NULL)) {
wxToolBar* m_toolbar = new wxToolBar(env->GetFrame(), wxID_ANY,
wxDefaultPosition, wxDefaultSize, penvCOMMON_TOOLBARSTYLE);
m_toolbar->SetToolBitmapSize(penvCOMMON_TOOLBARICONSIZE);
}
else
{
// Because ClearTools does not remove events
// from event handler, remove them manually
ClearToolEvents();
// Clear all tool items
m_toolbar->ClearTools();
}
if (m_toolbarids != NULL) delete [] m_toolbarids;
m_toolbarids = new int[m_array->Count()];
m_counttoolbarids = m_array->Count();
for (size_t i=0; i<m_array->Count(); ++i)
{
ToolBarItem* item = m_array->ItemPtr(i);
// Überprüfen ob ID schon aufgelöst wurde
if (item->GetCommand() == NULL && !item->GetId().IsEmpty()) {
item->SetCommand(env->GetCommandList()->GetCommand(item->GetId()));
if (item->GetCommand() == NULL) {
wxLogWarning(_T("[penv::ToolBar::Update] Could not resolve command id '%s' for item. Removing item!"), item->GetId().c_str());
m_array->Del(i, true);
continue;
}
}
if (item->GetCommand() != NULL) {
if (item->GetCommand()->IsEvent()) {
wxLogWarning(_T("[penv::ToolBar::Update] Could not add command id '%s' to toolbar, because this command is a event. Removing item!"), item->GetId().c_str());
m_array->Del(i, true);
continue;
}
if (!item->GetIcon().IsOk()) {
wxLogWarning(_T("[penv::ToolBar::Update] Could not add command id '%s' to toolbar, because this command does not have a bitmap."), item->GetId().c_str());
continue;
}
}
wxToolBarToolBase* tool = NULL;
if (unlikely(item->IsSeparator())) {
tool = m_toolbar->AddSeparator();
item->SetTool(tool);
} else {
tool = m_toolbar->AddTool(wxNewId(),
item->GetCommand()->GetName(),
item->GetCommand()->GetIcon(),
wxNullBitmap,
wxITEM_NORMAL,
item->GetCommand()->GetName(),
item->GetCommand()->GetHelp());
item->SetTool(tool);
tool->Enable(item->GetCommand()->IsEnabled());
if (unlikely(!item->TryConnect())) {
wxLogWarning(_T("[penv::ToolBar::Update] Could not connect tool item, with wxWidgets Event."));
m_toolbarids[i] = -1;
} else {
m_toolbarids[i] = tool->GetId();
}
}
}
for (int i=m_array->Count()-1; i>=0; --i)
{
if (m_array->ItemPtr(i) == NULL) m_array->Remove((size_t)i, false);
}
m_toolbar->Realize();
// Toolbar always set caption new
m_paneinfo.Caption(m_name).Name(m_id).ToolbarPane();
// Toolbar is always on top!
if (m_paneinfo.dock_direction != wxAUI_DOCK_TOP) {
wxLogWarning(_T("[penv::ToolBar::Update] Toolbar '%s' is not on top of the frame, changing it to display toolbar on top."), m_name.c_str());
m_paneinfo.Top();
}
// Always set the correct size
m_paneinfo.BestSize(m_toolbar->GetBestSize());
m_paneinfo.MinSize(-1,-1).MaxSize(-1,-1).FloatingSize(-1,-1);
// Add toolbar to aui manager, if toolbar visible and there are min. 1 item
if (m_visible && m_array->Count() > 0) {
wxAuiManager* manager = Environment::Get()->GetFrame()->GetManager();
if (unlikely(!manager->AddPane(m_toolbar, m_paneinfo))) {
wxLogError(_T("[penv::ToolBar::Update] Cannot add toolbar '%s' to aui manager."), m_name.c_str());
return (false);
}
m_toolbar->Show();
} else {
m_toolbar->Hide();
}
return (true);
}
开发者ID:Sneedd,项目名称:penv,代码行数:98,代码来源:toolbar.cpp
示例9: MultiLineEditorBase
MultiLineEditor::MultiLineEditor( bool call_static, bool richtextMode, QWidget *parent, QWidget *editWidget,
FormWindow *fw, const QString &text )
: MultiLineEditorBase( parent, 0, WType_Dialog | WShowModal ), formwindow( fw ), doWrap( FALSE )
{
callStatic = call_static;
if ( callStatic )
applyButton->hide();
textEdit = new TextEdit( centralWidget(), "textedit" );
Layout4->insertWidget( 0, textEdit );
if ( richtextMode ) {
QPopupMenu *stylesMenu = new QPopupMenu( this );
menuBar->insertItem( tr( "&Styles" ), stylesMenu );
basicToolBar = new QToolBar( tr( "Basics" ), this, DockTop );
ToolBarItem *it = new ToolBarItem( this, basicToolBar, tr( "Italic" ),
"i", QPixmap::fromMimeSource( "designer_textitalic.png" ), CTRL+Key_I );
it->addTo( stylesMenu );
connect( it, SIGNAL( clicked( const QString& ) ),
this, SLOT( insertTags( const QString& )));
ToolBarItem *b = new ToolBarItem( this, basicToolBar, tr( "Bold" ),
"b", QPixmap::fromMimeSource( "designer_textbold.png" ), CTRL+Key_B );
b->addTo( stylesMenu );
connect( b, SIGNAL( clicked( const QString& ) ),
this, SLOT( insertTags( const QString& )));
ToolBarItem *ul = new ToolBarItem( this, basicToolBar, tr( "Underline" ),
"u", QPixmap::fromMimeSource( "designer_textunderline.png" ), CTRL+Key_U );
ul->addTo( stylesMenu );
connect( ul, SIGNAL( clicked( const QString& ) ),
this, SLOT( insertTags( const QString& )));
ToolBarItem *tt = new ToolBarItem( this, basicToolBar, tr( "Typewriter" ),
"tt", QPixmap::fromMimeSource( "designer_textteletext.png" ) );
tt->addTo( stylesMenu );
connect( tt, SIGNAL( clicked( const QString& ) ),
this, SLOT( insertTags( const QString& )));
basicToolBar->addSeparator();
QPopupMenu *layoutMenu = new QPopupMenu( this );
menuBar->insertItem( tr( "&Layout" ), layoutMenu );
QAction *brAction = new QAction( this );
brAction->setIconSet( QPixmap::fromMimeSource( "designer_textlinebreak.png" ) );
brAction->setText( tr("Break" ) );
brAction->addTo( basicToolBar );
brAction->addTo( layoutMenu );
connect( brAction, SIGNAL( activated() ) , this, SLOT( insertBR() ) );
ToolBarItem *p = new ToolBarItem( this, basicToolBar, tr( "Paragraph" ),
"p", QPixmap::fromMimeSource( "designer_textparagraph.png" ) );
p->addTo( layoutMenu );
connect( p, SIGNAL( clicked( const QString& ) ),
this, SLOT( insertTags( const QString& )));
layoutMenu->insertSeparator();
basicToolBar->addSeparator();
ToolBarItem *al = new ToolBarItem( this, basicToolBar, tr( "Align left" ),
"p align=\"left\"", QPixmap::fromMimeSource( "designer_textleft.png" ) );
al->addTo( layoutMenu );
connect( al, SIGNAL( clicked( const QString& ) ),
this, SLOT( insertTags( const QString& )));
ToolBarItem *ac = new ToolBarItem( this, basicToolBar, tr( "Align center" ),
"p align=\"center\"", QPixmap::fromMimeSource( "designer_textcenter.png" ) );
ac->addTo( layoutMenu );
connect( ac, SIGNAL( clicked( const QString& ) ),
this, SLOT( insertTags( const QString& )));
ToolBarItem *ar = new ToolBarItem( this, basicToolBar, tr( "Align right" ),
"p align=\"right\"", QPixmap::fromMimeSource( "designer_textright.png" ) );
ar->addTo( layoutMenu );
connect( ar, SIGNAL( clicked( const QString& ) ),
this, SLOT( insertTags( const QString& )));
ToolBarItem *block = new ToolBarItem( this, basicToolBar, tr( "Blockquote" ),
"blockquote", QPixmap::fromMimeSource( "designer_textjustify.png" ) );
block->addTo( layoutMenu );
connect( block, SIGNAL( clicked( const QString& ) ),
this, SLOT( insertTags( const QString& )));
QPopupMenu *fontMenu = new QPopupMenu( this );
menuBar->insertItem( tr( "&Font" ), fontMenu );
fontToolBar = new QToolBar( "Fonts", this, DockTop );
QAction *fontAction = new QAction( this );
fontAction->setIconSet( QPixmap::fromMimeSource( "designer_textfont.png" ) );
fontAction->setText( tr("Font" ) );
fontAction->addTo( fontToolBar );
fontAction->addTo( fontMenu );
connect( fontAction, SIGNAL( activated() ) , this, SLOT( showFontDialog() ) );
//.........这里部分代码省略.........
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:101,代码来源:multilineeditorimpl.cpp
注:本文中的ToolBarItem类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论