void CMainFrame::CreateMyToolbar(void) { m_toolbar=CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT | wxTB_TEXT,TOOLBAR_TOOLS); wxBitmap toolBarBitmaps[4]; // Initialisation images toolBarBitmaps[0] = wxBitmap(wxT("new.bmp"),wxBITMAP_TYPE_BMP); toolBarBitmaps[1] = wxBitmap(wxT("open.bmp"),wxBITMAP_TYPE_BMP); toolBarBitmaps[2] = wxBitmap(wxT("save.bmp"),wxBITMAP_TYPE_BMP); toolBarBitmaps[3] = wxBitmap(wxT("draw.bmp"),wxBITMAP_TYPE_BMP); //Ajustement format image m_toolbar->SetToolBitmapSize(wxSize(toolBarBitmaps[0].GetWidth(),toolBarBitmaps[0].GetHeight())); //Ajout des boutons image m_toolbar->AddTool(MENU_NEW, wxT("Nouveau"), toolBarBitmaps[0], wxT("Nouveau dessin")); m_toolbar->AddTool(MENU_OPEN, wxT("Ouvrir"), toolBarBitmaps[1], wxT("Ouvrir un fichier existant")); m_toolbar->AddTool(MENU_SAVE, wxT("Sauvegarder"), toolBarBitmaps[2], wxT("Sauvegarder le fichier courant")); m_toolbar->AddSeparator(); m_toolbar->AddCheckTool(TOOLBAR_DRAW, wxT("Dessiner"), toolBarBitmaps[3]); m_toolbar->Realize(); SetToolBar(m_toolbar); return; }
bool wxDialog::Create(wxWindow *parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { SetExtraStyle(GetExtraStyle() | wxTOPLEVEL_EX_DIALOG); // save focus before doing anything which can potentially change it // m_oldFocus = FindFocus(); // All dialogs should really have this style style |= wxTAB_TRAVERSAL; if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) ) return false; if ( !m_hasFont ) SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); #if defined(__SMARTPHONE__) && defined(__WXWINCE__) SetLeftMenu(wxID_OK, _("OK")); #endif #if wxUSE_TOOLBAR && defined(__POCKETPC__) CreateToolBar(); #endif return true; }
BOOL InitControls(HWND hwnd) { if (CreateStatusBar(hwnd) && CreateToolBar(hwnd) && CreateListView(hwnd) && CreateTreeView(hwnd) && CreateRichEdit(hwnd) && CreateVSplitBar(hwnd) && CreateHSplitBar(hwnd)) { WCHAR szBuffer1[MAX_STR_LEN], szBuffer2[MAX_STR_LEN]; InitApplicationsList(); InitCategoriesList(); LoadStringW(hInst, IDS_APPS_COUNT, szBuffer2, _countof(szBuffer2)); StringCbPrintfW(szBuffer1, sizeof(szBuffer1), szBuffer2, ListView_GetItemCount(hListView)); SetStatusBarText(szBuffer1); return TRUE; } return FALSE; }
void Window::createToolbar() { wxToolBar *toolbar = CreateToolBar(); wxBitmap bline = wxMEMORY_BITMAPEX(line, wxBITMAP_TYPE_PNG); wxBitmap btriangle = wxMEMORY_BITMAPEX(triangle, wxBITMAP_TYPE_PNG); wxBitmap bquad = wxMEMORY_BITMAPEX(quad, wxBITMAP_TYPE_PNG); wxBitmap bhexa = wxMEMORY_BITMAPEX(hexagon, wxBITMAP_TYPE_PNG); wxBitmap bocta = wxMEMORY_BITMAPEX(octagon, wxBITMAP_TYPE_PNG); wxBitmap bcircle = wxMEMORY_BITMAPEX(circle, wxBITMAP_TYPE_PNG); wxBitmap bguy = wxMEMORY_BITMAPEX(guy, wxBITMAP_TYPE_PNG); wxBitmap btext = wxMEMORY_BITMAPEX(text, wxBITMAP_TYPE_PNG); toolbar->AddRadioTool(0, wxT("Line"), bline, wxNullBitmap, _("Line")); toolbar->AddRadioTool(1, wxT("Triangle"), btriangle, wxNullBitmap, _("Undo")); toolbar->AddRadioTool(2, wxT("Quad"), bquad, wxNullBitmap, _("Rectangle")); toolbar->AddRadioTool(3, wxT("6"), bhexa, wxNullBitmap, _("Hexagon")); toolbar->AddRadioTool(4, wxT("8"), bocta, wxNullBitmap, _("Octagon")); toolbar->AddRadioTool(5, wxT("Circle"), bcircle, wxNullBitmap, _("Circle")); toolbar->AddRadioTool(6, wxT("Guy"), bguy, wxNullBitmap, _("Guy")); toolbar->AddRadioTool(7, wxT("Text"), btext, wxNullBitmap, _("Text")); toolbar->AddSeparator(); wxBitmap bcolor1 = wxMEMORY_BITMAPEX(color1, wxBITMAP_TYPE_PNG); wxBitmap bcolor2 = wxMEMORY_BITMAPEX(color2, wxBITMAP_TYPE_PNG); wxBitmap bcolor3 = wxMEMORY_BITMAPEX(color3, wxBITMAP_TYPE_PNG); wxBitmap bcolor4 = wxMEMORY_BITMAPEX(color4, wxBITMAP_TYPE_PNG); wxBitmap bcolor5 = wxMEMORY_BITMAPEX(color5, wxBITMAP_TYPE_PNG); wxBitmap bcolor6 = wxMEMORY_BITMAPEX(color6, wxBITMAP_TYPE_PNG); wxBitmap bcolor7 = wxMEMORY_BITMAPEX(color7, wxBITMAP_TYPE_PNG); wxBitmap bcolor8 = wxMEMORY_BITMAPEX(color8, wxBITMAP_TYPE_PNG); wxBitmap bchoosecolor = wxMEMORY_BITMAPEX(choosecolor, wxBITMAP_TYPE_PNG); toolbar->AddRadioTool(13, wxT("Black"), bcolor4, wxNullBitmap, _("Black")); toolbar->AddRadioTool(12, wxT("Gray"), bcolor3, wxNullBitmap, _("Gray")); toolbar->AddRadioTool(11, wxT("Light Gray"), bcolor2, wxNullBitmap, _("Light Gray")); toolbar->AddRadioTool(10, wxT("White"), bcolor1, wxNullBitmap, _("White")); toolbar->AddRadioTool(14, wxT("Red"), bcolor5, wxNullBitmap, _("Red")); toolbar->AddRadioTool(15, wxT("Yellow"), bcolor6, wxNullBitmap, _("Yellow")); toolbar->AddRadioTool(16, wxT("Green"), bcolor7, wxNullBitmap, _("Green")); toolbar->AddRadioTool(17, wxT("Blue"), bcolor8, wxNullBitmap, _("Blue")); toolbar->AddRadioTool(18, wxT("Custom"), bchoosecolor, wxNullBitmap, _("Custom")); toolbar->AddSeparator(); wxBitmap bundo = wxMEMORY_BITMAPEX(undo, wxBITMAP_TYPE_PNG); wxBitmap bprint = wxMEMORY_BITMAPEX(print, wxBITMAP_TYPE_PNG); wxBitmap bnewfile = wxMEMORY_BITMAPEX(newfile, wxBITMAP_TYPE_PNG); wxBitmap bopenfile = wxMEMORY_BITMAPEX(openfile, wxBITMAP_TYPE_PNG); wxBitmap bsave = wxMEMORY_BITMAPEX(save, wxBITMAP_TYPE_PNG); wxBitmap bquit = wxMEMORY_BITMAPEX(quit, wxBITMAP_TYPE_PNG); toolbar->AddTool(wxID_UNDO, wxT("Undo"), bundo, _("Undo")); toolbar->AddTool(wxID_PRINT, wxT("Print"), bprint, _("Print")); toolbar->AddTool(wxID_NEW, wxT("New"), bnewfile, _("New")); toolbar->AddTool(wxID_OPEN, wxT("Open"), bopenfile, _("Open")); toolbar->AddTool(wxID_SAVE, wxT("Save"), bsave, _("Save")); toolbar->AddTool(wxID_CLOSE, wxT("Quit"), bquit, _("Quit")); toolbar->Realize(); }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; EnableDocking(CBRS_ALIGN_ANY); if (!CreateToolBar()) return -1; if (!CreateStyleBar()) return -1; if (!CreatePaletteBar()) return -1; if (!CreateStatusBar()) return -1; if (!m_wndDlgBar.Create(this, IDD_VIEWSELECT, CBRS_LEFT|CBRS_TOOLTIPS|CBRS_FLYBY, IDD_VIEWSELECT)) { TRACE0("Failed to create DlgBar\n"); return -1; // fail to create } return 0; }
wxLuaConsole::wxLuaConsole(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name) :wxFrame(parent, id, title, pos, size, style, name), m_exit_when_closed(false) { m_max_lines = 2000; m_saveFilename = wxT("log.txt"); m_saveFilename .Normalize(); SetIcon(wxICON(LUA)); wxToolBar* tb = CreateToolBar(); tb->AddTool(wxID_NEW, wxT("Clear window"), wxArtProvider::GetBitmap(wxART_NEW, wxART_TOOLBAR), wxT("Clear console window"), wxITEM_NORMAL); tb->AddTool(wxID_SAVEAS, wxT("Save output"), wxArtProvider::GetBitmap(wxART_FILE_SAVE, wxART_TOOLBAR), wxT("Save contents to file..."), wxITEM_NORMAL); tb->AddTool(wxID_COPY, wxT("Copy text"), wxArtProvider::GetBitmap(wxART_COPY, wxART_TOOLBAR), wxT("Copy contents to clipboard"), wxITEM_NORMAL); tb->AddTool(ID_WXLUACONSOLE_SCROLLBACK_LINES, wxT("Scrollback"), wxArtProvider::GetBitmap(wxART_LIST_VIEW, wxART_TOOLBAR), wxT("Set the number of scrollback lines..."), wxITEM_NORMAL); //tb->AddTool(ID_WXLUACONSOLE_BACKTRACE, wxT("Backtrace"), wxArtProvider::GetBitmap(wxART_QUESTION, wxART_TOOLBAR), wxT("Show the current Lua stack..."), wxITEM_NORMAL); tb->Realize(); m_textCtrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH2 | wxTE_DONTWRAP); wxFont monoFont(10, wxTELETYPE, wxNORMAL, wxNORMAL); // monospace m_textCtrl->SetFont(monoFont); // Only set it to this if it wasn't already set, typically there will only be one of these. if (sm_wxluaConsole == NULL) sm_wxluaConsole = this; }
// 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) { textWindow = new wxTextCtrl(this, wxID_ANY, _T("A help window"), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxSUNKEN_BORDER); #if wxUSE_TOOLBAR CreateToolBar(wxNO_BORDER | wxTB_FLAT | wxTB_HORIZONTAL); InitToolBar(GetToolBar()); #endif // wxUSE_TOOLBAR #if wxUSE_ACCEL // Accelerators wxAcceleratorEntry entries[3]; entries[0].Set(wxACCEL_CTRL, (int) 'N', MDI_NEW_WINDOW); entries[1].Set(wxACCEL_CTRL, (int) 'X', MDI_QUIT); entries[2].Set(wxACCEL_CTRL, (int) 'A', MDI_ABOUT); wxAcceleratorTable accel(3, entries); SetAcceleratorTable(accel); #endif // wxUSE_ACCEL }
int CMainFrame::OnCreate(LPCREATESTRUCT cs) { if (CFrameWnd::OnCreate(cs) == -1) return -1; if (!CreateClientView() || !CreateToolBar() || !CreateStatusBar()) return -1; return 0; }
LRESULT Main_OnCreate(HWND hWnd,WPARAM wParam,LPARAM lParam) { hWndMain=hWnd; hCanvas=CreateWindow("Canvas",NULL,WS_CHILD | WS_VISIBLE, 0,0,0,0,hWnd,(HMENU)0,g_hInst,NULL); CreateToolBar(); InitCommonControls(); return 0; }
MyFrame::MyFrame( wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style ) :wxFrame( parent, id, title, position, size, style ) { m_preview_state = ID_PREVIEW; // set the frame icon SetIcon(wxICON(mondrian)); SetMinSize(wxSize(200, 200)); // set-up the menu, toolbar, statusbar so we know what the client size will be m_menubar = new wxMenuBar(); SetMenuBar(m_menubar); m_toolBar = CreateToolBar(); #if wxUSE_STATUSBAR CreateStatusBar(2); int status_text_width = 0, status_text_height = 0; GetStatusBar()->GetTextExtent(MyVideoCaptureWindow::GetStatusText(999999, 9999), &status_text_width, &status_text_height); int status_widths[2] = {-1, status_text_width}; SetStatusWidths(2, status_widths); #endif // wxUSE_STATUSBAR m_splitterWin = new wxSplitterWindow(this, wxID_ANY); m_splitterWin->SetMinimumPaneSize(20); m_logPanel = new wxPanel( m_splitterWin, wxID_ANY ); wxBoxSizer *logpanelsizer = new wxBoxSizer(wxVERTICAL); m_logTextCtrl = new wxTextCtrl(m_logPanel, wxID_ANY, wxT("Event Log for wxVideoCaptureWindow : \n"), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_RICH2|wxTE_READONLY ); logpanelsizer->Add(m_logTextCtrl, 1, wxEXPAND); m_logPanel->SetAutoLayout( true ); m_logPanel->SetSizer(logpanelsizer); logpanelsizer->Fit( m_logPanel ); logpanelsizer->SetSizeHints( m_logPanel ); m_vidCapWin = new MyVideoCaptureWindow( m_splitterWin, ID_VIDEOWIN, wxDefaultPosition, wxDefaultSize); #ifdef WXVIDCAP_AVI_SUPPORT SetTitle(wxT("wxVidCap - ") + m_vidCapWin->GetCaptureFilename()); #else SetTitle(wxT("wxVidCap")); #endif // WXVIDCAP_AVI_SUPPORT m_logPanel->Show(false); m_vidCapWin->Show(true); m_splitterWin->Initialize(m_vidCapWin); CreateMenus(); CreateToolbar(); SetupVideoMenus(); }
BOOL CSkin::LoadToolbars(CXMLElement* pBase) { for ( POSITION pos = pBase->GetElementIterator() ; pos ; ) { CXMLElement* pXML = pBase->GetNextElement( pos ); if ( pXML->IsNamed( _T("toolbar") ) && ! CreateToolBar( pXML ) ) return FALSE; } return TRUE; }
BOOL CVideoPane::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here // 获取参数 CRect rect; GetClientRect(rect); CString strOcxPath = eLTE_Tool::GetOcxPath(); // 设置图标 Gdiplus::Bitmap* pBitmap = Gdiplus::Bitmap::FromFile(strOcxPath + _T("Skin\\Icon.ico")); if (NULL != pBitmap && Gdiplus::Ok == pBitmap->GetLastStatus()) { HICON hIcon = NULL; pBitmap->GetHICON(&hIcon); if (NULL != hIcon) { SetIcon(hIcon, FALSE); // Set small icon SetIcon(hIcon, TRUE); // Set big icon } } // 显示边框 ModifyStyle(0, WS_BORDER); SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_DRAWFRAME); // 创建标题栏 CreateCaption(rect, strOcxPath); // 创建视频窗口 CreateVideoStatic(rect, strOcxPath); // 创建工具栏 CreateToolBar(rect, strOcxPath); // 禁用按钮 EnableImageButton(FALSE); // 工具栏隐藏 if (!m_bShowToolBar) { m_SnapshotBtn.ShowWindow(SW_HIDE); m_ReversePlayBtn.ShowWindow(SW_HIDE); m_FullScreenBtn.ShowWindow(SW_HIDE); m_AudioBtn.ShowWindow(SW_HIDE); } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void wxraytracerFrame::create_toolbar() { toolbar_ = CreateToolBar(); renderBtn_ = new wxButton(toolbar_, COMMAND_RENDER, wxT("Render"), wxDefaultPosition, wxSize(90,30)); toolbar_->AddControl(renderBtn_); stopBtn_ = new wxButton(toolbar_, COMMAND_STOP, wxT("X"), wxDefaultPosition, wxSize(30,30)); toolbar_->AddControl(stopBtn_); builderCombo_ = new wxComboBox( toolbar_, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(60,30), NULL, wxCB_DROPDOWN | wxCB_READONLY); for (int i = 0; i < NUM_BUILDERS; i++) { const void* data = reinterpret_cast<const void*>(BUILDERS[i].func_); builderCombo_->Append( BUILDERS[i].name_, const_cast<void*>(data)); } builderCombo_->SetSelection(0); toolbar_->AddControl(builderCombo_); samplerCombo_ = new wxComboBox( toolbar_, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(120,30), NULL, wxCB_DROPDOWN | wxCB_READONLY); for (int i = 0; i < NUM_SAMPLERS; i++) { const void* data = reinterpret_cast<const void*>(&SAMPLERS[i].sampler); samplerCombo_->Append( SAMPLERS[i].name_, const_cast<void*>(data)); } samplerCombo_->SetSelection(0); toolbar_->AddControl(samplerCombo_); transformCheck_ = new wxCheckBox(toolbar_, wxID_ANY, wxT("Disk")); toolbar_->AddControl(transformCheck_); sampleNumCombo_ = new wxComboBox( toolbar_, wxID_ANY, wxT("1"), wxDefaultPosition, wxSize(60,30), NUM_DEFAULT_SAMPLE_NUMS, DEFAULT_SAMPLE_NUMS); toolbar_->AddControl(sampleNumCombo_); pixSizeSpin_ = new wxSpinCtrl(toolbar_, wxID_ANY); pixSizeSpin_->SetRange(1,100); // In hundreths pixSizeSpin_->SetValue(100); toolbar_->AddControl(pixSizeSpin_); }
// 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) { nWinCreated = 0 ; // Give it an icon SetIcon(wxICON(mondrian)); CreateToolBar(wxNO_BORDER | wxTB_FLAT | wxTB_HORIZONTAL); InitToolBar(GetToolBar()); }
//--------------------------------------------------------------------------- void GUI_Main::ToolBar_Create() { //ToolBar wxToolBar* ToolBar=CreateToolBar(wxTB_VERTICAL); #if wxUSE_DRAG_AND_DROP && defined(__WXMAC__) ToolBar->SetDropTarget(new FileDrop(C)); #endif //wxUSE_DRAG_AND_DROP ToolBar->SetToolBitmapSize(wxSize(32, 32)); ToolBar->AddTool(ID_Menu_File_Open_Files, __T("Open &file(s)"), wxICON(File_Open_File)); ToolBar->AddTool(ID_Menu_File_Open_Directory, __T("Open &directory"), wxICON(File_Open_Directory)); ToolBar->AddSeparator(); ToolBar->AddTool(wxID_ABOUT, __T("About"), wxICON(Help_About)); ToolBar->Realize(); }
MyFrameT14::MyFrameT14(const wxString& title) : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(280, 180)) { wxImage::AddHandler(new wxPNGHandler); wxBitmap exit(wxT("application-exit-3.png"), wxBITMAP_TYPE_PNG); wxToolBar *toolbar = CreateToolBar(); toolbar->AddTool(wxID_EXIT, exit, wxT("Exit application")); toolbar->Realize(); Connect(wxID_EXIT, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(MyFrameT14::OnQuit)); Centre(); }
//Construtor da Frame MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size) :wxFrame(NULL, wxID_ANY, title, pos, size){ //Criação do Menu Menu *MenuBar = new Menu(); SetMenuBar(MenuBar); Centre(); //Setando o ícone SetIcon(wxIcon(wxString(_T("/../Images/Icones/icone"), wxBITMAP_TYPE_BMP))); //Criando barra de ferramentas m_toolbar = CreateToolBar(wxTB_FLAT | wxTB_HORIZONTAL | wxTB_TEXT,wxID_ANY); m_toolbar->AddTool(ID_NEW, wxString(_("Novo")), wxBitmap(wxT("../../Images/Icones/newfile.bmp"), wxBITMAP_TYPE_BMP), wxString(_("Novo"))); m_toolbar->AddTool(ID_SAVE, wxString(_("Salvar")), wxBitmap(wxT("../../Images/Icones/save.bmp"), wxBITMAP_TYPE_BMP), wxString(_("Salvar"))); m_toolbar->AddTool(ID_OPEN, wxString(_("Abrir")), wxBitmap(wxT("../../Images/Icones/open.bmp"), wxBITMAP_TYPE_BMP), wxString(_("Abrir"))); m_toolbar->AddSeparator(); m_toolbar->AddTool(ID_HELP, wxString(_("Ajuda")), wxBitmap(wxT("../../Images/Icones/help.bmp"), wxBITMAP_TYPE_BMP), wxString(_("Ajuda"))); m_toolbar->AddTool(wxID_EXIT, wxString(_("Sair")), wxBitmap(wxT("../../Images/Icones/close.bmp"), wxBITMAP_TYPE_BMP), wxString(_("Sair"))); //Para atualizar a barra de ferramentas com os ícones bitmap m_toolbar->Realize(); //Setanto barra de ferramentas SetToolBar(m_toolbar); //Barra de Status CreateStatusBar(3); SetStatusText("TP2 PAC", 0); // connectando eventos de menu da frame aos "handlers" da classe menu Connect(ID_NEW, wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(Menu::OnNew)); Connect(ID_OPEN, wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(Menu::OnOpen)); Connect(ID_SAVE, wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(Menu::OnSave)); Connect(ID_HELP, wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(Menu::OnHelp)); Connect(ID_PORTUGUESE, wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(Menu::OnPortuguese)); Connect(ID_ENGLISH, wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(Menu::OnEnglish)); Connect(ID_SPANISH, wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(Menu::OnSpanish)); Connect(wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(Menu::OnExit)); Connect(wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(Menu::OnAbout)); };
// Define my frame constructor csFrame::csFrame(wxDocManager* manager, wxFrame *parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style): wxDocMDIParentFrame(manager, parent, id, title, pos, size, style, _T("frame")) { CreateToolBar(wxNO_BORDER|wxTB_FLAT|wxTB_HORIZONTAL); wxGetApp().InitToolBar(GetToolBar()); // Accelerators wxAcceleratorEntry entries[4]; entries[0].Set(wxACCEL_NORMAL, WXK_F1, wxID_HELP); entries[1].Set(wxACCEL_CTRL, 'O', wxID_OPEN); entries[2].Set(wxACCEL_CTRL, 'N', wxID_NEW); entries[3].Set(wxACCEL_CTRL, 'P', wxID_PRINT); wxAcceleratorTable accel(4, entries); SetAcceleratorTable(accel); }
/** * \brief Create the toolbar. */ void bf::main_frame::create_toolbar() { wxToolBar* bar = CreateToolBar(); bar->AddTool ( wxID_NEW, _("&New"), wxArtProvider::GetBitmap(wxART_NEW), _("New") ); bar->AddTool ( wxID_OPEN, _("&Open"), wxArtProvider::GetBitmap(wxART_FILE_OPEN), _("Open") ); bar->AddTool ( wxID_SAVE, _("&Save"), wxArtProvider::GetBitmap(wxART_FILE_SAVE), _("Save") ); bar->AddSeparator(); bar->AddTool ( ID_COMPILE, _("&Compile"), wxBitmap(compile_xpm), _("Compile") ); bar->Realize(); } // main_frame::create_toolbar()
LRESULT Main_OnCreate(HWND hWnd,WPARAM wParam,LPARAM lParam) { OSVERSIONINFO osv; osv.dwOSVersionInfoSize=sizeof(OSVERSIONINFO); GetVersionEx(&osv); if (osv.dwPlatformId == VER_PLATFORM_WIN32_NT) { StretchMode=HALFTONE; } else { StretchMode=COLORONCOLOR; } hWndMain=hWnd; hCanvas=CreateWindow("Canvas",NULL,WS_CHILD | WS_VISIBLE, 0,0,0,0,hWnd,(HMENU)0,g_hInst,NULL); CreateToolBar(); InitCommonControls(); return 0; }
my1Form::my1Form(const wxString &title) : wxFrame( NULL, wxID_ANY, title, wxDefaultPosition, wxSize(320, 240), wxDEFAULT_FRAME_STYLE & ~ (wxRESIZE_BORDER | wxMAXIMIZE_BOX) ) { wxInitAllImageHandlers(); SetIcon(wxIcon(wxT(MY1APP_ICON))); wxIcon mIconExit(wxT(MY1BITMAP_EXIT)); wxIcon mIconClear(wxT(MY1BITMAP_NEW)); wxIcon mIconLoad(wxT(MY1BITMAP_OPEN)); wxIcon mIconSave(wxT(MY1BITMAP_SAVE)); wxIcon mIconGenerate(wxT(MY1BITMAP_BINARY)); wxIcon mIconOptions(wxT(MY1BITMAP_OPTION)); wxToolBar *mainTool = CreateToolBar(); // our icon is 16x16, windows defaults to 24x24 //mainTool->SetToolBitmapSize(wxSize(16,16)); mainTool->AddTool(MY1ID_EXIT, wxT("Exit"), mIconExit); mainTool->AddSeparator(); mainTool->AddTool(MY1ID_CLEAR, wxT("Clear"), mIconClear); mainTool->AddTool(MY1ID_LOAD, wxT("Load"), mIconLoad); mainTool->AddTool(MY1ID_SAVE, wxT("Save"), mIconSave); mainTool->AddSeparator(); mainTool->AddTool(MY1ID_GENERATE, wxT("Generate"), mIconGenerate); mainTool->AddTool(MY1ID_OPTIONS, wxT("Options"), mIconOptions); mainTool->Realize(); CreateStatusBar(2); SetStatusText(_T("Welcome to my1GoLCD!")); mCanvas = new my1Canvas(this); SetClientSize(mCanvas->mImageWidth*mCanvas->mImageGridSize, mCanvas->mImageHeight*mCanvas->mImageGridSize); // SendSizeEvent(); // just in case?? // actions! this->Connect(MY1ID_EXIT, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(my1Form::OnQuit)); this->Connect(MY1ID_CLEAR, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(my1Form::OnClear)); this->Connect(MY1ID_LOAD, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(my1Form::OnLoad)); this->Connect(MY1ID_SAVE, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(my1Form::OnSave)); this->Connect(MY1ID_GENERATE, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(my1Form::OnGenerate)); this->Connect(MY1ID_OPTIONS, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(my1Form::OnCheckOptions)); Centre(); }
void ExternalToolsPlugin::DoRecreateToolbar() { wxWindow *parent(NULL); if (m_tb) { // we have a toolbar, remove it from the docking manager m_mgr->GetDockingManager()->DetachPane(m_tb); parent = m_tb->GetParent(); m_tb->Destroy(); } else { parent = m_mgr->GetTheApp()->GetTopWindow(); } m_tb = CreateToolBar(parent); if (m_tb) { m_mgr->GetDockingManager()->AddPane(m_tb, wxAuiPaneInfo().Name(GetShortName()).LeftDockable( true ).RightDockable( true ).Caption(GetShortName()).ToolbarPane().Top() ); // Apply changes m_mgr->GetDockingManager()->Update(); } }
void MainWindow::initToolBars() { m_toolBar = CreateToolBar(); wxBitmap bitmapNew(new_xpm); wxBitmap bitmapOpen(open_xpm); wxBitmap bitmapSave(save_xpm); // wxBitmap bitmapView(preview_xpm); wxBitmap bitmapInpaint(inpaint_xpm); wxBitmap bitmapSettings(settings_xpm); m_toolBar->AddTool((int)wxID_NEW, wxT("New"), bitmapNew, wxNullBitmap); m_toolBar->AddTool((int)wxID_OPEN, wxT("Open"), bitmapOpen, wxNullBitmap); m_toolBar->AddTool((int)wxID_SAVE, wxT("Save"), bitmapSave, wxNullBitmap); m_toolBar->AddTool((int)ID_INPAINT, wxT("Inpaint"), bitmapInpaint, wxNullBitmap); m_toolBar->AddTool((int)ID_SETTINGS, wxT("Settings"), bitmapSettings, wxNullBitmap); // SetToolBar(toolBar); m_toolBar->Realize(); }
int CDlgTaxiwayConstraint::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CXTResizeDialog::OnCreate(lpCreateStruct) == -1) return -1; switch (m_emType) { case WeightConstraint: SetWindowText(_T("Taxiway Weight Constraint")); break; case WingSpanConstraint: SetWindowText(_T("Taxiway Wingspan Constraint")); break; default: break; } CreateToolBar(); return 0; }
void CMainFrame::CreateMyToolBar() { m_toolbar = CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL | wxTB_TEXT, TOOLBAR_TOOLS); wxBitmap toolBarBitmaps[4]; toolBarBitmaps[0] = wxBitmap(wxT("img/new.bmp"),wxBITMAP_TYPE_BMP); toolBarBitmaps[1] = wxBitmap(wxT("img/open.bmp"),wxBITMAP_TYPE_BMP); toolBarBitmaps[2] = wxBitmap(wxT("img/save.bmp"),wxBITMAP_TYPE_BMP); toolBarBitmaps[3] = wxBitmap(wxT("img/draw.bmp"),wxBITMAP_TYPE_BMP); m_toolbar->SetToolBitmapSize(wxSize(toolBarBitmaps[0].GetWidth(), toolBarBitmaps[0].GetHeight())); m_toolbar->AddTool(M_NOUVEAU_FICHIER, wxT("Nouveau"), toolBarBitmaps[0]); m_toolbar->AddTool(M_OUVRIR, wxT("Ouvrir"), toolBarBitmaps[1]); m_toolbar->AddTool(M_SAUVEGARDER, wxT("Sauvegarder"), toolBarBitmaps[2]); m_toolbar->AddSeparator(); m_toolbar->AddTool(M_GESTION_TRIANGLES, wxT("Gestion des triangles"), toolBarBitmaps[3], wxT("Gestion des triangles")); m_toolbar->EnableTool(M_GESTION_TRIANGLES, false); m_toolbar->Realize(); SetToolBar(m_toolbar); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); // alias widget SetupWidgetAlias(); // init CreateActions(); CreateMainMenus(); CreateToolBar(); // setup table editWindow = new EditWindow(0); setCentralWidget(editWindow); // setup table SetupTables(); //connect signal-slot SetupConnectWidgets(); }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))//IDR_MAINFRAME//IDR_TOOLBAR { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } CreateToolBar(); m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockControlBar(&m_wndToolBar); //set the view->smooth checked CMenu* mainmenu=this->GetMenu(); // mainmenu->CheckMenuItem(ID_VIEW_3DAXISON,MF_CHECKED); // mainmenu->CheckMenuItem(ID_VIEW_2DAXIS,MF_CHECKED); mainmenu->CheckMenuItem(ID_VIEW_BFPLANE,MF_CHECKED); mainmenu->CheckMenuItem(ID_VIEW_PRIMALMESH,MF_CHECKED); return 0; }
bool wxDialog::Create(wxWindow *parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { SetExtraStyle(GetExtraStyle() | wxTOPLEVEL_EX_DIALOG); // All dialogs should really have this style style |= wxTAB_TRAVERSAL; if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) ) return false; if ( !m_hasFont ) SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); #if defined(__SMARTPHONE__) && defined(__WXWINCE__) SetLeftMenu(wxID_OK, _("OK")); #endif #if wxUSE_TOOLBAR && defined(__POCKETPC__) CreateToolBar(); #endif #if wxUSE_DIALOG_SIZEGRIP if ( HasFlag(wxRESIZE_BORDER) ) { CreateGripper(); Connect(wxEVT_CREATE, wxWindowCreateEventHandler(wxDialog::OnWindowCreate)); } #endif // wxUSE_DIALOG_SIZEGRIP return true; }
wxLuaConsole::wxLuaConsole(wxLuaConsoleWrapper* consoleWrapper, wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name) :wxFrame(parent, id, title, pos, size, style, name), m_wrapper(consoleWrapper), m_exit_when_closed(false) { m_max_lines = 2000; m_saveFilename = wxT("log.txt"); m_saveFilename .Normalize(); SetIcon(wxICON(LUA)); wxToolBar* tb = CreateToolBar(); tb->AddTool(wxID_NEW, wxT("Clear window"), wxArtProvider::GetBitmap(wxART_NEW, wxART_TOOLBAR), wxT("Clear console window"), wxITEM_NORMAL); tb->AddTool(wxID_SAVEAS, wxT("Save output"), wxArtProvider::GetBitmap(wxART_FILE_SAVE, wxART_TOOLBAR), wxT("Save contents to file..."), wxITEM_NORMAL); tb->AddTool(wxID_COPY, wxT("Copy text"), wxArtProvider::GetBitmap(wxART_COPY, wxART_TOOLBAR), wxT("Copy contents to clipboard"), wxITEM_NORMAL); tb->AddTool(ID_WXLUACONSOLE_SCROLLBACK_LINES, wxT("Scrollback"), wxArtProvider::GetBitmap(wxART_LIST_VIEW, wxART_TOOLBAR), wxT("Set the number of scrollback lines..."), wxITEM_NORMAL); tb->Realize(); m_splitter = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH); m_textCtrl = new wxTextCtrl(m_splitter, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH2 | wxTE_DONTWRAP); m_textCtrl->SetFont(wxFont(10, wxTELETYPE, wxNORMAL, wxNORMAL)); // monospace m_debugListBox = new wxListBox(m_splitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE); m_debugListBox->Show(false); // listbox is shown only when used m_splitter->Initialize(m_textCtrl); }
ChildView::ChildView(wxMDIParentFrame *parent, const wxString& title, SimulatedWorld *sw) : wxMDIChildFrame(parent, wxID_ANY, title, wxPoint(50,50), wxSize(500,400), wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE),m_timer(this,ID_TIMER) { mainWin = (MainWindow*)parent; m_splitter = (wxSplitterWindow *) NULL; toolbar = 0; s_world= sw; m_world = sw->getWorld(); playsimu=false; isActivated=true; //call timer m_timer.Start(100); //make a toolbar CreateToolBar( wxNO_BORDER | wxTB_FLAT |wxTB_HORIZONTAL, wxID_ANY, wxT("")); toolbar = GetToolBar(); if(toolbar)InitToolBar(toolbar); CreateSubWindows(); }