本文整理汇总了C++中GetToolBar函数的典型用法代码示例。如果您正苦于以下问题:C++ GetToolBar函数的具体用法?C++ GetToolBar怎么用?C++ GetToolBar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetToolBar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defined
wxMenuBar::~wxMenuBar()
{
// In Windows CE (not .NET), the menubar is always associated
// with a toolbar, which destroys the menu implicitly.
#if defined(WINCE_WITHOUT_COMMANDBAR) && defined(__POCKETPC__)
if (GetToolBar())
{
wxToolMenuBar* toolMenuBar = wxDynamicCast(GetToolBar(), wxToolMenuBar);
if (toolMenuBar)
toolMenuBar->SetMenuBar(NULL);
}
#else
// we should free Windows resources only if Windows doesn't do it for us
// which happens if we're attached to a frame
if (m_hMenu && !IsAttached())
{
#if defined(WINCE_WITH_COMMANDBAR)
::DestroyWindow((HWND) m_commandBar);
m_commandBar = (WXHWND) NULL;
#else
::DestroyMenu((HMENU)m_hMenu);
#endif
m_hMenu = (WXHMENU)NULL;
}
#endif
}
示例2: GetSize
void wxFrame::PositionToolBar()
{
int cw, ch;
GetSize( &cw , &ch ) ;
if ( GetStatusBar() && GetStatusBar()->IsShown())
{
int statusX, statusY;
GetStatusBar()->GetClientSize(&statusX, &statusY);
ch -= statusY;
}
if (GetToolBar())
{
int tx, ty, tw, th;
tx = ty = 0 ;
GetToolBar()->GetSize(& tw, & th);
if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL)
{
// Use the 'real' position. wxSIZE_NO_ADJUSTMENTS
// means, pretend we don't have toolbar/status bar, so we
// have the original client size.
GetToolBar()->SetSize(tx , ty , tw, ch , wxSIZE_NO_ADJUSTMENTS );
}
else
{
// Use the 'real' position
GetToolBar()->SetSize(tx , ty , cw , th, wxSIZE_NO_ADJUSTMENTS );
}
}
}
示例3: wxLogDebug
// Disables menuitems and toolbar tools that need to have an item selected in the
// listctrl first
void main_frame::on_update_ui_main_listctrl( wxUpdateUIEvent &event )
{
wxLogDebug( wxT( "Entering main_frame::on_update_ui_main_listctrl()" ) );
// True if there is some items selected in the listctrl.
bool enabled = (bool)m_main_listctrl->GetSelectedItemCount();
wxLogDebug( wxT( "Number of items selected in listctrl =%d" ), m_main_listctrl->GetSelectedItemCount() );
// Now set the tools and menuitems to that either true or false.
// The GetToolBar() and GetMenu() are the handy ways to get a pointer to the frame's
// toolbar and menubar. Do the menu first:
GetMenuBar()->Enable( wxID_PROPERTIES, enabled );
GetMenuBar()->Enable( wxID_DELETE, enabled );
GetMenuBar()->Enable( XRCID( "main_frame_update_selected_tool_or_menuitem" ), enabled );
// But it is possible that the user turned off the toolbar, so check to see if it there
// it a pointer by querying whether a call to wxFrame::GetToolBar() returns anything.
// Note we can't use the configuration setting to check it, since that value is
// written to config file when options dialog is closed.
if ( GetToolBar() )
{
GetToolBar()->EnableTool( wxID_PROPERTIES, enabled );
GetToolBar()->EnableTool( wxID_DELETE, enabled );
GetToolBar()->EnableTool( XRCID( "main_frame_update_selected_tool_or_menuitem" ), enabled );
}
}
示例4: defined
bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
{
#if wxUSE_MENUS
#if defined(WINCE_WITHOUT_COMMANDBAR)
if (GetToolBar() && GetToolBar()->FindById(id))
return GetToolBar()->MSWCommand(cmd, id);
#endif
// we only need to handle the menu and accelerator commands from the items
// of our menu bar, base wxWindow class already handles the rest
if ( !control && (cmd == 0 /* menu */ || cmd == 1 /* accel */) )
{
#if wxUSE_MENUS_NATIVE
if ( !wxCurrentPopupMenu )
#endif // wxUSE_MENUS_NATIVE
{
wxMenuItem * const mitem = FindItemInMenuBar((signed short)id);
if ( mitem )
return ProcessCommand(mitem);
}
}
#endif // wxUSE_MENUS
return wxFrameBase::HandleCommand(id, cmd, control);;
}
示例5: GetToolBar
// Not part of the wxBookctrl API, but must be called in OnIdle or
// by application to realize the toolbar and select the initial page.
void wxToolbook::Realize()
{
if (m_needsRealizing)
{
GetToolBar()->SetToolBitmapSize(m_maxBitmapSize);
int remap = wxSystemOptions::GetOptionInt(wxT("msw.remap"));
wxSystemOptions::SetOption(wxT("msw.remap"), 0);
GetToolBar()->Realize();
wxSystemOptions::SetOption(wxT("msw.remap"), remap);
}
m_needsRealizing = false;
if (m_selection == -1)
m_selection = 0;
if (GetPageCount() > 0)
{
int sel = m_selection;
m_selection = -1;
SetSelection(sel);
}
DoSize();
}
示例6: wxCHECK_MSG
bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
{
WXHMENU submenu = menu ? menu->GetHMenu() : 0;
wxCHECK_MSG( submenu, false, wxT("can't append invalid menu to menubar") );
if ( !wxMenuBarBase::Append(menu, title) )
return false;
menu->wxMenuBase::SetTitle(title);
#if defined(WINCE_WITHOUT_COMMANDBAR)
if (IsAttached())
#else
if (GetHmenu())
#endif
{
#if defined(WINCE_WITHOUT_COMMANDBAR)
if (!GetToolBar())
return false;
TBBUTTON tbButton;
memset(&tbButton, 0, sizeof(TBBUTTON));
tbButton.iBitmap = I_IMAGENONE;
tbButton.fsState = TBSTATE_ENABLED;
tbButton.fsStyle = TBSTYLE_DROPDOWN | TBSTYLE_NO_DROPDOWN_ARROW | TBSTYLE_AUTOSIZE;
size_t pos = GetMenuCount();
HMENU hPopupMenu = (HMENU) menu->GetHMenu() ;
tbButton.dwData = (DWORD)hPopupMenu;
wxString label = wxStripMenuCodes(title);
tbButton.iString = (int) label.wx_str();
tbButton.idCommand = NewControlId();
if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_INSERTBUTTON, pos, (LPARAM)&tbButton))
{
wxLogLastError(wxT("TB_INSERTBUTTON"));
return false;
}
#else
if ( !::AppendMenu(GetHmenu(), MF_POPUP | MF_STRING,
(UINT_PTR)submenu, title.wx_str()) )
{
wxLogLastError(wxT("AppendMenu"));
}
#endif
#if wxUSE_ACCEL
if ( menu->HasAccels() )
{
// need to rebuild accelerator table
RebuildAccelTable();
}
#endif // wxUSE_ACCEL
if (IsAttached())
Refresh();
}
return true;
}
示例7: GetStatusBar
void wxFrame::PositionToolBar()
{
int cw, ch;
wxTopLevelWindow::DoGetClientSize( &cw , &ch );
int statusX = 0 ;
int statusY = 0 ;
#if wxUSE_STATUSBAR
if (GetStatusBar() && GetStatusBar()->IsShown())
{
GetStatusBar()->GetSize(&statusX, &statusY);
ch -= statusY;
}
#endif
#ifdef __WXOSX_IPHONE__
// TODO integrate this in a better way, on iphone the status bar is not a child of the content view
// but the toolbar is
ch -= 20;
#endif
if (GetToolBar())
{
int tx, ty, tw, th;
tx = ty = 0 ;
GetToolBar()->GetSize(&tw, &th);
if (GetToolBar()->HasFlag(wxTB_LEFT))
{
// Use the 'real' position. wxSIZE_NO_ADJUSTMENTS
// means, pretend we don't have toolbar/status bar, so we
// have the original client size.
GetToolBar()->SetSize(tx , ty , tw, ch , wxSIZE_NO_ADJUSTMENTS );
}
else if (GetToolBar()->HasFlag(wxTB_RIGHT))
{
// Use the 'real' position. wxSIZE_NO_ADJUSTMENTS
// means, pretend we don't have toolbar/status bar, so we
// have the original client size.
tx = cw - tw;
GetToolBar()->SetSize(tx , ty , tw, ch , wxSIZE_NO_ADJUSTMENTS );
}
else if (GetToolBar()->HasFlag(wxTB_BOTTOM))
{
tx = 0;
ty = ch - th;
GetToolBar()->SetSize(tx, ty, cw, th, wxSIZE_NO_ADJUSTMENTS );
}
else
{
#if !wxOSX_USE_NATIVE_TOOLBAR
// Use the 'real' position
GetToolBar()->SetSize(tx , ty , cw , th, wxSIZE_NO_ADJUSTMENTS );
#endif
}
}
}
示例8: GetToolBar
void CMainFrame::SaveTBDefault()
// Saves the initial Toolbar configuration in a vector of TBBUTTON
{
int nCount = GetToolBar()->GetButtonCount();
for (int i = 0; i < nCount; i++)
{
TBBUTTON tbb;
GetToolBar()->GetButton(i, &tbb);
m_vTBBDefault.push_back(tbb);
}
}
示例9: SetSendSTEEvents
bool wxSTEditorFrame::Destroy()
{
SetSendSTEEvents(false);
if (GetToolBar() && (GetToolBar() == GetOptions().GetToolBar())) // remove for safety
GetOptions().SetToolBar(NULL);
if (GetMenuBar() && (GetMenuBar() == GetOptions().GetMenuBar())) // remove for file history
GetOptions().SetMenuBar(NULL);
if (GetStatusBar() && (GetStatusBar() == GetOptions().GetStatusBar()))
GetOptions().SetStatusBar(NULL);
return wxFrame::Destroy();
}
示例10:
wxMaximaFrame::~wxMaximaFrame()
{
wxString perspective = m_manager.SavePerspective();
wxConfig::Get()->Write(wxT("AUI/perspective"), perspective);
#if defined __WXMAC__
wxConfig::Get()->Write(wxT("AUI/toolbar"), (GetToolBar()->IsShown()));
#else
wxConfig::Get()->Write(wxT("AUI/toolbar"), (GetToolBar() != NULL));
#endif
m_manager.UnInit();
}
示例11: GetToolBar
void FrameMain::EnableToolBar(agi::OptionValue const& opt) {
if (opt.GetBool()) {
if (!GetToolBar()) {
toolbar::AttachToolbar(this, "main", context.get(), "Default");
GetToolBar()->Realize();
}
}
else if (wxToolBar *old_tb = GetToolBar()) {
SetToolBar(nullptr);
delete old_tb;
Layout();
}
}
示例12: WidgetCount
void SeparateTabWidget::setCurrentIndex (int index)
{
if (index >= WidgetCount ())
index = WidgetCount () - 1;
auto rootWM = Core::Instance ().GetRootWindowsManager ();
auto tabManager = rootWM->GetTabManager (Window_);
MainStackedWidget_->setCurrentIndex (-1);
if (CurrentToolBar_)
{
RemoveWidgetFromSeparateTabWidget (CurrentToolBar_);
CurrentToolBar_ = nullptr;
}
MainTabBar_->setCurrentIndex (index);
if (auto bar = tabManager->GetToolBar (index))
{
AddWidget2SeparateTabWidget (bar);
bar->show ();
CurrentToolBar_ = bar;
}
MainStackedWidget_->setCurrentIndex (index);
CurrentIndex_ = index;
if (CurrentWidget_ != Widget (index))
{
PreviousWidget_ = CurrentWidget_;
CurrentWidget_ = Widget (index);
emit currentChanged (index);
}
}
示例13: GetPageCount
wxWindow *wxToolbook::DoRemovePage(size_t page)
{
const size_t page_count = GetPageCount();
wxWindow *win = wxBookCtrlBase::DoRemovePage(page);
if ( win )
{
GetToolBar()->DeleteTool(page + 1);
if (m_selection >= (int)page)
{
// force new sel valid if possible
int sel = m_selection - 1;
if (page_count == 1)
sel = wxNOT_FOUND;
else if ((page_count == 2) || (sel == -1))
sel = 0;
// force sel invalid if deleting current page - don't try to hide it
m_selection = (m_selection == (int)page) ? wxNOT_FOUND : m_selection - 1;
if ((sel != wxNOT_FOUND) && (sel != m_selection))
SetSelection(sel);
}
}
return win;
}
示例14: GetToolBar
int wxToolbook::HitTest(const wxPoint& pt, long *flags) const
{
int pagePos = wxNOT_FOUND;
if ( flags )
*flags = wxBK_HITTEST_NOWHERE;
// convert from wxToolbook coordinates to wxToolBar ones
const wxToolBarBase * const tbar = GetToolBar();
const wxPoint tbarPt = tbar->ScreenToClient(ClientToScreen(pt));
// is the point over the toolbar?
if ( wxRect(tbar->GetSize()).Contains(tbarPt) )
{
const wxToolBarToolBase * const
tool = tbar->FindToolForPosition(tbarPt.x, tbarPt.y);
if ( tool )
{
pagePos = tbar->GetToolPos(tool->GetId());
if ( flags )
*flags = wxBK_HITTEST_ONICON | wxBK_HITTEST_ONLABEL;
}
}
else // not over the toolbar
{
if ( flags && GetPageRect().Contains(pt) )
*flags |= wxBK_HITTEST_ONPAGE;
}
return pagePos;
}
示例15: wxMDIParentFrame
// Define my frame constructor
MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size, const long style)
: wxMDIParentFrame(parent, id, title, pos, size, style)
{
m_nWinCreated = 0;
SetIcon(wxICON(sample));
// Make a menubar
wxMenu *file_menu = new wxMenu;
file_menu->Append(MDI_NEW_WINDOW, wxT("&New test\tCtrl+N"));
file_menu->Append(MDI_QUIT, wxT("&Exit\tAlt+X"));
wxMenu *help_menu = new wxMenu;
help_menu->Append(MDI_ABOUT, wxT("&About"));
wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, wxT("&File"));
menu_bar->Append(help_menu, wxT("&Help"));
// Associate the menu bar with the frame
SetMenuBar(menu_bar);
#if wxUSE_STATUSBAR
CreateStatusBar();
#endif // wxUSE_STATUSBAR
CreateToolBar(wxNO_BORDER | wxTB_FLAT | wxTB_HORIZONTAL);
InitToolBar(GetToolBar());
}