// OnCreateControlBars is called by the framework to create control bars on the // container application's windows. pWndFrame is the top level frame window of // the container and is always non-NULL. pWndDoc is the doc level frame window // and will be NULL when the container is an SDI application. A server // application can place MFC control bars on either window. BOOL CInPlaceFrame::OnCreateControlBars(CFrameWnd* pWndFrame, CFrameWnd* /*pWndDoc*/) { if (!CreateMenuBar()) return -1; if (!CreateToolBar(pWndFrame)) return FALSE; if (!CreateFormatBar(pWndFrame)) return FALSE; // set owner to this window, so messages are delivered to correct app m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); m_wndFormatBar.EnableDocking(CBRS_ALIGN_TOP|CBRS_ALIGN_BOTTOM); COleCntrFrameWndEx* pFrame = DYNAMIC_DOWNCAST (COleCntrFrameWndEx, m_pMainFrame); if (pFrame == NULL) { return FALSE; } ASSERT_VALID (pFrame); pFrame->EnableDocking(CBRS_ALIGN_ANY); pFrame->DockPane(&m_wndToolBar); pFrame->DockPane(&m_wndFormatBar); m_wndToolBar.SetOwner(this); m_wndFormatBar.SetOwner(this); m_wndRulerBar.SetOwner(this); OnBarState(1, RD_EMBEDDED); //load bar state return TRUE; }
// {{{ MainFrame::MainFrame() MainFrame::MainFrame() : wxFrame(NULL, ID_MAINFRAME, _("Dubnium")) { config = wxConfigBase::Get(); server = new DBGp::Server(static_cast<wxUint16>(config->Read(wxT("Network/Port"), 9000)), this); wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); sizer->Add(notebook = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_WINDOWLIST_BUTTON | wxAUI_NB_CLOSE_ON_ALL_TABS), 1, wxEXPAND | wxALL); notebook->AddPage(new WelcomePage(notebook), _("Welcome")); #ifdef __WXDEBUG__ notebook->AddPage(new DebugPage(notebook), _("Debug Log")); #endif SetMenuBar(CreateMenuBar()); SetAutoLayout(true); SetSizer(sizer); sizer->SetSizeHints(this); #ifndef __WXMAC__ wxIcon icon; icon.CopyFromBitmap(wxArtProvider::GetBitmap(wxT("icon"), wxART_TOOLBAR, wxSize(32, 32))); SetIcon(icon); #endif LoadSize(); }
// Specialization: create a PPC about dialog menubar LRESULT CStdSimpleDialog<IDD_ABOUTBOX>::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { CreateMenuBar(ATL_IDM_MENU_DONE); StdPlatformInit(); StdShidInit(); return TRUE; }
MainWindow::MainWindow(BRect frame) : BWindow(frame, "Torrentor!", B_DOCUMENT_WINDOW, B_AUTO_UPDATE_SIZE_LIMITS | B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE ) { SetPulseRate(1000000); // // // SetLayout(new BGroupLayout(B_VERTICAL, 0.0)); CreateMenuBar(); fDownloadView = new DownloadView; // BStringView* fStatusText = new BStringView("status", "Laralala"); // fStatusText->SetAlignment(B_ALIGN_LEFT); // fStatusText->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); /// fStatusText->SetExplicitMinSize(BSize(150, 12)); AddChild(BGroupLayoutBuilder(B_VERTICAL, 0.0) .Add(fMenuBar) .Add(fDownloadView->ScrollView()) /* .Add(new BSeparatorView(B_HORIZONTAL, B_PLAIN_BORDER)) .Add(BGroupLayoutBuilder(B_HORIZONTAL, spacing) .AddGlue() .Add(fRemoveMissingButton) .Add(fRemoveFinishedButton) .SetInsets(12, 5, 12, 5) )*/ ); // // // fOpenPanel = new BFilePanel(B_OPEN_PANEL, NULL, NULL, B_FILE_NODE, true, NULL, new TorrentRefFilter); // // // fPreferencesWindow = new PreferencesWindow(); // CenterOnScreen(); }
void InitGraphics(int argc, char *argv[]) { Dimension width, height; XEvent event; static String fallback_resources[] = { "*xcheck*background: #e0e0e0", "*xcheck*fontList: -*-helvetica-bold-r-normal--14-*-*-*-*-*-*-*", "*xcheck*font: -*-helvetica-bold-r-normal--14-*-*-*-*-*-*-*", "*xcheck*XmText.background: #b0e0c0", NULL, }; XtSetLanguageProc(NULL,NULL,NULL); toplevel = XtVaAppInitialize( &app,"App-Class", NULL,0, &argc,argv, fallback_resources, NULL); mainWidget = XtVaCreateManagedWidget("mw", xmMainWindowWidgetClass, toplevel, NULL); dpy = XtDisplay(mainWidget); gc = XCreateGC(dpy,DefaultRootWindow(dpy),(int)NULL,NULL); XSetLineAttributes(dpy,gc,2,LineSolid,CapButt,JoinMiter); colormap = CreateColorMap(mainWidget); menubar = CreateMenuBar(mainWidget); workwin = CreateWorkWin(mainWidget); message = CreateMessage(mainWidget); XtVaSetValues(mainWidget, XmNcolormap,colormap, XmNmenuBar,menubar, XmNworkWindow,workwin, XmNmessageWindow,message, NULL); XtRealizeWidget(toplevel); do { XtAppNextEvent(app,&event); XtDispatchEvent(&event); } while(event.type != Expose); XtVaGetValues(toplevel,XmNheight,&height,XmNwidth,&width,NULL); XtVaSetValues(toplevel, XmNwidth, width, XmNheight, height, XmNmaxWidth, width, XmNmaxHeight, height, XmNminWidth, width, XmNminHeight, height, XmNallowShellResize, False, NULL); HandleEvents(); strcpy(xval[0],"human"); strcpy(xval[1],"computer"); strcpy(xval[2],"10.0"); }
wxHexDemoFrame::wxHexDemoFrame(const wxString& title) : wxFrame(NULL, wxID_ANY, title), m_hexEditCtrl(0) { CreateMenuBar(); m_hexEditCtrl = new wxHexEditCtrl(this, wxID_ANY, wxDefaultPosition, wxSize(300, 200)); wxBoxSizer* topSizer = new wxBoxSizer(wxHORIZONTAL); topSizer->Add(m_hexEditCtrl, 1, wxEXPAND); SetSizer(topSizer); }
END_EVENT_TABLE() EDA_3D_FRAME::EDA_3D_FRAME( PCB_BASE_FRAME* parent, const wxString& title, long style ) : EDA_BASE_FRAME( parent, DISPLAY3D_FRAME_TYPE, title, wxDefaultPosition, wxDefaultSize, style, wxT( "Frame3D" ) ) { m_canvas = NULL; m_reloadRequest = false; m_ortho = false; // Give it an icon wxIcon icon; icon.CopyFromBitmap( KiBitmap( icon_3d_xpm ) ); SetIcon( icon ); GetSettings(); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); // Create the status line static const int dims[5] = { -1, 100, 100, 100, 140 }; CreateStatusBar( 5 ); SetStatusWidths( 5, dims ); CreateMenuBar(); ReCreateMainToolbar(); // Make a EDA_3D_CANVAS int attrs[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 16, 0 }; m_canvas = new EDA_3D_CANVAS( this, attrs ); m_auimgr.SetManagedWindow( this ); EDA_PANEINFO horiztb; horiztb.HorizontalToolbarPane(); m_auimgr.AddPane( m_mainToolBar, wxAuiPaneInfo( horiztb ).Name( wxT( "m_mainToolBar" ) ).Top() ); m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); m_auimgr.Update(); // Fixes bug in Windows (XP and possibly others) where the canvas requires the focus // in order to receive mouse events. Otherwise, the user has to click somewhere on // the canvas before it will respond to mouse wheel events. m_canvas->SetFocus(); }
/** * 创建所有区域. * @return 主窗体 */ GtkWidget *DialogPeer::CreateAllArea() { GtkWidget *box; GtkWidget *hpaned, *vpaned; gint position; box = gtk_vbox_new(FALSE, 0); /* 加入菜单条 */ gtk_box_pack_start(GTK_BOX(box), CreateMenuBar(), FALSE, FALSE, 0); /* 加入主区域 */ hpaned = gtk_hpaned_new(); g_datalist_set_data(&widset, "main-paned", hpaned); g_object_set_data(G_OBJECT(hpaned), "position-name", (gpointer)"main-paned-divide"); position = GPOINTER_TO_INT(g_datalist_get_data(&dtset, "main-paned-divide")); gtk_paned_set_position(GTK_PANED(hpaned), position); gtk_box_pack_start(GTK_BOX(box), hpaned, TRUE, TRUE, 0); g_signal_connect(hpaned, "notify::position", G_CALLBACK(PanedDivideChanged), &dtset); /*/* 加入聊天历史记录&输入区域 */ vpaned = gtk_vpaned_new(); g_object_set_data(G_OBJECT(vpaned), "position-name", (gpointer)"historyinput-paned-divide"); position = GPOINTER_TO_INT(g_datalist_get_data(&dtset, "historyinput-paned-divide")); gtk_paned_set_position(GTK_PANED(vpaned), position); gtk_paned_pack1(GTK_PANED(hpaned), vpaned, TRUE, TRUE); g_signal_connect(vpaned, "notify::position", G_CALLBACK(PanedDivideChanged), &dtset); gtk_paned_pack1(GTK_PANED(vpaned), CreateHistoryArea(), TRUE, TRUE); gtk_paned_pack2(GTK_PANED(vpaned), CreateInputArea(), FALSE, TRUE); /* 加入好友信息&附件区域 */ vpaned = gtk_vpaned_new(); g_object_set_data(G_OBJECT(vpaned), "position-name", (gpointer)"infoenclosure-paned-divide"); position = GPOINTER_TO_INT(g_datalist_get_data(&dtset, "infoenclosure-paned-divide")); gtk_paned_set_position(GTK_PANED(vpaned), position); gtk_paned_pack2(GTK_PANED(hpaned), vpaned, FALSE, TRUE); g_signal_connect(vpaned, "notify::position", G_CALLBACK(PanedDivideChanged), &dtset); gtk_paned_pack1(GTK_PANED(vpaned), CreateInfoArea(), TRUE, TRUE); gtk_paned_pack2(GTK_PANED(vpaned), CreateFileArea(), FALSE, TRUE); return box; }
static void gtk_ui_make_main_window(int size) { GdkWindowHints flags; GdkGeometry geom; gint winwidth, winheight; screensize = size; base = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(toplevel), base); menubar = CreateMenuBar(); gtk_box_pack_start(GTK_BOX(base), menubar, FALSE, FALSE, 0); field = CreateDrawingArea(size, size); gtk_box_pack_start(GTK_BOX(base), field, FALSE, FALSE, 0); gtk_signal_connect(GTK_OBJECT(field), "button-press-event", GTK_SIGNAL_FUNC(button_press), NULL); gtk_signal_connect(GTK_OBJECT(field), "button-release-event", GTK_SIGNAL_FUNC(button_release), NULL); gtk_signal_connect(GTK_OBJECT(field), "enter-notify-event", GTK_SIGNAL_FUNC(enter_window), NULL); gtk_signal_connect(GTK_OBJECT(field), "leave-notify-event", GTK_SIGNAL_FUNC(leave_window), NULL); gtk_signal_connect(GTK_OBJECT(field), "expose-event", GTK_SIGNAL_FUNC(redraw_window), NULL); gtk_widget_set_events(field, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_EXPOSURE_MASK); gtk_widget_show_all(toplevel); gdk_window_get_size(toplevel->window, &winwidth, &winheight); geom.min_width = geom.max_width = geom.base_width = winwidth; geom.min_height = geom.max_height = geom.base_height = winheight; geom.width_inc = geom.height_inc = 0; flags = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE | GDK_HINT_BASE_SIZE | GDK_HINT_RESIZE_INC; gdk_window_set_geometry_hints(toplevel->window, &geom, flags); gdk_color_parse("white", &white); gdk_color_parse("black", &black); }
void CPpcMainWnd::OnCreate(HWND hwnd) { m_hWnd = hwnd; CreateMenuBar(); CreateListView(); CMainWnd::OnCreate(hwnd); RegisterHotKeys(); SetTimer(m_hWnd, ID_TIMER_DISPCHECK, TIMER_DISPCHECK_INTERVAL, NULL); SetTimer(m_hWnd, ID_TIMER_DISPSTATE, TIMER_DISPSTATE_INTERVAL, NULL); memset(&m_sai, 0, sizeof(m_sai)); m_sai.cbSize = sizeof(m_sai); SetFocus(m_hwndLV); ShowWindow(m_hwndLV, SW_HIDE); }
PaintMainWindow::PaintMainWindow(QWidget* parent, const char* name) :QMainWindow(parent, name), canvas(new PaintCanvas()), viewport(new QScrollView(this)), tools(new PaintToolBar(this, "tool bar", canvas)) { //Create menubar and toolbar CreateMenuBar(); setDockMenuEnabled(false); //Set as the central widget to resize automatically setCentralWidget(viewport); //Append canvas to scroll view viewport->addChild(canvas); //Resize window to a resonable size setBaseSize(100, 100); resize(800, 600); }
void QtFront::LoadQt() { // Set the configured window size. setFixedSize(htm->GetWindowWidth(), htm->GetWindowHeight()); // Initialize the Qt display objects. CurrentInput = new QtSensoryRegion(this, htm->CurrentPattern()); HtmDisplay = new QtHtm(this, htm); // Initialize the widgets. CreatePretrainWidget(); CreateTrainingWidget(); CreateActions(); CreateMenuBar(); // Initialize the layout. DefaultLayout->setMenuBar(menuBar); setLayout(DefaultLayout); // Display the default window widget. ShowTrainingWidget(); // Display the UI from the application. this->show(); }
MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags) : QMainWindow(parent, flags) { setMinimumSize(QSize(300, 200)); setWindowTitle(TITLE); setDockNestingEnabled(true); resize(850, 650); // Set QMainWindow in the center of desktop QRect rect = geometry(); rect.moveCenter(QApplication::desktop()->availableGeometry().center()); setGeometry(rect); _mainDescTextBox = new QspTextBox(this); setCentralWidget(_mainDescTextBox); CreateDockWindows(); CreateMenuBar(); LoadSettings(); }
LRESULT CProcessorUsageDialog::OnInitDialog( UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled ) { HWND hMenuBar = CreateMenuBar( ATL_IDM_MENU_DONECANCEL ); UIAddToolBar( hMenuBar ); UIAddChildWindowContainer( m_hWnd ); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT( pLoop != NULL ); pLoop->AddMessageFilter( this ); pLoop->AddIdleHandler( this ); DoDataExchange( FALSE ); process_list_ctrl_.AddColumn( L"Process", 0 ); process_list_ctrl_.AddColumn( L"User", 1 ); process_list_ctrl_.AddColumn( L"Kernel", 2 ); process_list_ctrl_.SetExtendedListViewStyle( LVS_EX_DOUBLEBUFFER | LVS_EX_FULLROWSELECT ); CRect list_rc; process_list_ctrl_.GetClientRect( &list_rc ); process_list_ctrl_.SetColumnWidth( 0, static_cast< int >( list_rc.Width() * 0.5 ) ); process_list_ctrl_.SetColumnWidth( 1, static_cast< int >( list_rc.Width() * 0.25 ) ); process_list_ctrl_.SetColumnWidth( 2, LVSCW_AUTOSIZE_USEHEADER ); meter_.Start( boost::bind( &CProcessorUsageDialog::OnUsageUpdate, this, _1, _2 ), 3000 ); return bHandled = FALSE; }
void raise_explorer(GUI *gui, Quark *q) { GraceApp *gapp = gui->P; set_wait_cursor(); if (!gui->eui) { ExplorerUI *eui; Widget menubar, menupane, panel, form, fr; eui = xmalloc(sizeof(ExplorerUI)); gui->eui = eui; eui->a_icon = XpmToPixmap(active_xpm); eui->h_icon = XpmToPixmap(hidden_xpm); eui->top = CreateDialog(app_shell, "Explorer"); menubar = CreateMenuBar(eui->top); WidgetManage(menubar); FormAddVChild(eui->top, menubar); menupane = CreateMenu(menubar, "File", 'F', FALSE); CreateMenuButtonA(menupane, "Close", 'C', "<Key>Escape", "Esc", destroy_dialog_cb, eui->top); menupane = CreateMenu(menubar, "Edit", 'E', FALSE); eui->edit_undo_bt = CreateMenuButtonA(menupane, "Undo", 'U', "Ctrl<Key>z", "Ctrl+Z", undo_cb, gapp); eui->edit_redo_bt = CreateMenuButtonA(menupane, "Redo", 'R', "Ctrl Shift<Key>z", "Ctrl+Shift+Z", redo_cb, gapp); menupane = CreateMenu(menubar, "Insert", 'I', FALSE); eui->insert_frame_bt = CreateMenuButton(menupane, "Frame", '\0', add_frame_cb, eui); WidgetSetSensitive(eui->insert_frame_bt, FALSE); eui->insert_graph_bt = CreateMenuButton(menupane, "Graph", '\0', add_graph_cb, eui); WidgetSetSensitive(eui->insert_graph_bt, FALSE); eui->insert_ssd_bt = CreateMenuButton(menupane, "SSData", '\0', add_ssd_cb, eui); WidgetSetSensitive(eui->insert_ssd_bt, FALSE); eui->insert_set_bt = CreateMenuButton(menupane, "Set", '\0', add_set_cb, eui); WidgetSetSensitive(eui->insert_set_bt, FALSE); eui->insert_axisgrid_bt = CreateMenuButton(menupane, "Axis grid", '\0', add_axisgrid_cb, eui); WidgetSetSensitive(eui->insert_axisgrid_bt, FALSE); eui->insert_axis_bt = CreateMenuButton(menupane, "Axis", '\0', add_axis_cb, eui); WidgetSetSensitive(eui->insert_axis_bt, FALSE); eui->insert_object_pane = CreateMenu(menupane, "Annotating objects", 'o', FALSE); WidgetSetSensitive(eui->insert_object_pane, FALSE); eui->insert_text_bt = CreateMenuButton(eui->insert_object_pane, "Text", '\0', add_object_cb, eui); eui->insert_line_bt = CreateMenuButton(eui->insert_object_pane, "Line", '\0', add_object_cb, eui); eui->insert_box_bt = CreateMenuButton(eui->insert_object_pane, "Box", '\0', add_object_cb, eui); eui->insert_arc_bt = CreateMenuButton(eui->insert_object_pane, "Arc", '\0', add_object_cb, eui); menupane = CreateMenu(menubar, "Options", 'O', FALSE); eui->instantupdate = CreateMenuToggle(menupane, "Instantaneous update", 'u', NULL, NULL); ToggleButtonSetState(eui->instantupdate, gui->instant_update); menupane = CreateMenu(menubar, "Help", 'H', TRUE); CreateMenuHelpButton(menupane, "On explorer", 'e', eui->top, "doc/UsersGuide.html#explorer"); panel = CreatePanedWindow(eui->top); form = CreateForm(panel); PlaceGridChild(panel, form, 0, 0); /* in case if CreatePanedWindow creates a grid */ eui->tree = CreateTree(form); AddTreeHighlightItemsCB(eui->tree, highlight_cb, eui); AddTreeContextMenuCB(eui->tree, menu_cb, eui); AddTreeDropItemsCB(eui->tree, drop_cb, eui); FormAddVChild(form, eui->tree); fr = CreateFrame(form, NULL); eui->idstr = CreateText(fr, "ID string:"); AddTextActivateCB(eui->idstr, text_explorer_cb, eui); FormAddVChild(form, fr); FormFixateVChild(fr); eui->scrolled_window = CreateScrolledWindow(panel); PlaceGridChild(panel, eui->scrolled_window, 1, 0); /* in case if CreatePanedWindow creates a grid */ PanedWindowSetMinWidth(form, 150); WidgetSetWidth(form, 250); WidgetManage(form); #ifdef HAVE_LESSTIF # if !defined(SF_BUG_993209_FIXED) && !defined(SF_BUG_993209_NOT_FIXED) # error "You should check whether SF bug #993209 is fixed in your version of LessTif." # error "Then define either SF_BUG_993209_FIXED or SF_BUG_993209_NOT_FIXED, accordingly." # error "See http://sourceforge.net/tracker/index.php?func=detail&aid=993209&group_id=8596&atid=108596." # endif # ifdef SF_BUG_993209_NOT_FIXED /* A dirty workaround */ eui->scrolled_window = CreateVContainer(eui->scrolled_window); # endif #endif eui->project_ui = create_project_ui(eui); WidgetUnmanage(eui->project_ui->top); eui->ssd_ui = create_ssd_ui(eui); WidgetUnmanage(eui->ssd_ui->top); eui->frame_ui = create_frame_ui(eui); WidgetUnmanage(eui->frame_ui->top); eui->graph_ui = create_graph_ui(eui); WidgetUnmanage(eui->graph_ui->top); eui->set_ui = create_set_ui(eui); WidgetUnmanage(eui->set_ui->top); eui->axisgrid_ui = create_axisgrid_ui(eui); WidgetUnmanage(eui->axisgrid_ui->top); eui->axis_ui = create_axis_ui(eui); WidgetUnmanage(eui->axis_ui->top); eui->object_ui = create_object_ui(eui); WidgetUnmanage(eui->object_ui->top); eui->atext_ui = create_atext_ui(eui); WidgetUnmanage(eui->atext_ui->top); eui->region_ui = create_region_ui(eui); WidgetUnmanage(eui->region_ui->top); eui->aacbuts = CreateAACDialog(eui->top, panel, explorer_aac, eui); WidgetManage(eui->tree); /* Menu popup */ eui->popup = CreatePopupMenu(eui->tree); eui->popup_hide_bt = CreateMenuButton(eui->popup, "Hide", '\0', hide_cb, eui); eui->popup_show_bt = CreateMenuButton(eui->popup, "Show", '\0', show_cb, eui); CreateMenuSeparator(eui->popup); eui->popup_delete_bt = CreateMenuButton(eui->popup, "Delete", '\0', delete_cb, eui); eui->popup_duplicate_bt = CreateMenuButton(eui->popup, "Duplicate", '\0', duplicate_cb, eui); /* Project menu popup */ eui->project_popup = CreatePopupMenu(eui->tree); eui->project_popup_show_bt = CreateMenuButton(eui->project_popup, "Show", '\0', project_show_cb, eui); CreateMenuSeparator(eui->project_popup); eui->project_popup_save_bt = CreateMenuButton(eui->project_popup, "Save", '\0', project_save_cb, eui); eui->project_popup_save_as_bt = CreateMenuButton(eui->project_popup, "Save as...", '\0', project_save_as_cb, eui); eui->project_popup_revert_to_saved_bt = CreateMenuButton(eui->project_popup, "Revert to saved", '\0', project_revert_to_saved_cb, eui); CreateMenuSeparator(eui->project_popup); eui->project_popup_close_bt = CreateMenuButton(eui->project_popup, "Close", '\0', project_close_cb, eui); init_quark_tree(eui); if (!q && gapp->gp) { select_quark_explorer(gproject_get_top(gapp->gp)); } } #ifdef QT_GUI /* TODO: use resources */ WidgetSetSize(gui->eui->top, 650, 600); #endif DialogRaise(gui->eui->top); if (q) { select_quark_explorer(q); } update_undo_buttons(gapp->gp); unset_wait_cursor(); }
/* ** Create a new event display window */ SpaceWindow *CreatePanelSp(Display *display, int setsEventNum, int canOpenFiles, int canExit, char *windowTitle, char *eventSelectorText) { Widget appShell, main, menuBar, form; SpaceWindow *window; static Atom wmpAtom, dwAtom = NULL; Arg al[20]; int type, ac; XGCValues values; /* Allocate some memory for the new window data structure */ window = (SpaceWindow *)XtMalloc(sizeof(SpaceWindow)); /* Create an toplevel shell to hold the window */ ac = 0; XtSetArg(al[ac], XmNtitle, windowTitle); ac++; XtSetArg(al[ac], XmNdeleteResponse, XmDO_NOTHING); ac++; XtSetArg(al[ac], XmNiconName, windowTitle); ac++; /* Keep the phase name here, to same valid XDefaults.. */ appShell = XtAppCreateShell ("phase", "Space", applicationShellWidgetClass, display, al, ac); /* ** create a main window holding a menu bar and a form with the rest of ** the window contents. */ main = XmCreateMainWindow(appShell, "main", NULL, 0); XtManageChild(main); type = STDHEP_SPACE; menuBar = CreateMenuBar(main, (StdHepWindow *) window, canOpenFiles, canExit, type); XtManageChild(menuBar); form = createContents(main, window, setsEventNum, eventSelectorText); XtManageChild(form); /* add the window to the global window list */ AddToWindowList((StdHepWindow *) window); /* realize all of the widgets in the new window */ XtRealizeWidget(appShell); /* set up closeCB to be called when the user selects close from the window menu. The close menu item usually activates f.kill which sends a WM_DELETE_WINDOW protocol request for the window. */ if (dwAtom == NULL) { wmpAtom = XmInternAtom(display, "WM_PROTOCOLS", TRUE); dwAtom = XmInternAtom(display, "WM_DELETE_WINDOW", TRUE); } XmAddProtocolCallback(appShell, wmpAtom, dwAtom, closeCB, window); /* initialize window structure, including a read-only graphics contexts for drawing in scale area and highlighting in spin widget */ window->shell = appShell; window->selectedTrack = NO_TRACK; window->trackWindowShell = NULL; window->btnRotationPanel = NULL; window->absRotationPanel = NULL; window->buttonRotateDegrees = INITIAL_ROT_INCR; window->event.nParticles = 0; window->event.particles = NULL; window->colorcode.nParticles = 0; window->colorcode.particles = NULL; window->nDetectorSegments = 0; window->detectorSegments = NULL; ac = 0; XtSetArg(al[ac], XmNbackground, &values.background); ac++; XtSetArg(al[ac], XmNforeground, &values.foreground); ac++; XtGetValues(window->scaleArea, al, ac); window->scaleGC = XtGetGC(window->scaleArea, GCForeground|GCBackground, &values); window->highlightGC = SpinCopyGC(window->spin); XSetLineAttributes(display, window->highlightGC, 5, LineSolid, CapRound, JoinMiter); return window; }
AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, const wxPoint & pos, const wxSize & size):wxFrame(parent, id, "Audacity", pos, size), mRate((double) gPrefs-> Read("/SamplingRate/DefaultProjectSampleRate", 44100)), mDirty(false), mDrag(NULL), mTrackPanel(NULL), mHistoryWindow(NULL), mAutoScrolling(false), mTotalToolBarHeight(0), mDraggingToolBar(NoneID) { // // Create track list // mTracks = new TrackList(); mLastSavedTracks = NULL; // // Initialize view info (shared with TrackPanel) // // Selection mViewInfo.sel0 = 0.0; mViewInfo.sel1 = 0.0; // Horizontal scrollbar mViewInfo.total = 1.0; mViewInfo.screen = 1.0; mViewInfo.h = 0.0; mViewInfo.zoom = 44100.0 / 512.0; mViewInfo.lastZoom = mViewInfo.zoom; // Vertical scrollbar mViewInfo.vpos = 0; mViewInfo.scrollStep = 16; mViewInfo.sbarH = 0; mViewInfo.sbarScreen = 1; mViewInfo.sbarTotal = 1; // Some GUI prefs gPrefs->Read("/GUI/UpdateSpectrogram", &mViewInfo.bUpdateSpectrogram, true); gPrefs->Read("/GUI/AutoScroll", &mViewInfo.bUpdateTrackIndicator, true); // Some extra information mViewInfo.bIsPlaying = false; mViewInfo.bRedrawWaveform = false; mMenuBar = NULL; CreateMenuBar(); int left = 0, top = 0, width, height; GetClientSize(&width, &height); // // Create the Control Toolbar (if we're not using a windowed toolbar) // The control toolbar should be automatically loaded--other toolbars are optional. if (!gControlToolBarStub->GetWindowedStatus()) { int h = gControlToolBarStub->GetHeight(); ToolBar *tb = new ControlToolBar(this, 0, wxPoint(10, top), wxSize(width - 10, h)); mToolBarArray.Add((ToolBar *) tb); top += h + 1; height -= h + 1; mTotalToolBarHeight += h; } if (gEditToolBarStub) { if(gEditToolBarStub->GetLoadedStatus() && !gEditToolBarStub->GetWindowedStatus()) { int h = gEditToolBarStub->GetHeight(); ToolBar *etb = new EditToolBar(this,0 ,wxPoint(10,top), wxSize(width-10,h)); mToolBarArray.Add((ToolBar *) etb); top +=h + 1; height -= h + 1; mTotalToolBarHeight +=h; } } // // Create the status bar // int sh = GetStatusHeight(); mStatus = new AStatus(this, 0, wxPoint(0, height - sh), wxSize(width, sh), mRate, this); height -= sh; mStatus->SetField(wxString::Format("Welcome to Audacity version %s", AUDACITY_VERSION_STRING), 0); // // Create the TrackPanel and the scrollbars // mTrackPanel = new TrackPanel(this, TrackPanelID, wxPoint(left, top), wxSize(width - sbarSpaceWidth, height - sbarSpaceWidth), mTracks, &mViewInfo, this); int hoffset = mTrackPanel->GetLeftOffset() - 1; int voffset = mTrackPanel->GetRulerHeight(); #ifdef __WXMAC__ width++; height++; #endif mHsbar = new wxScrollBar(this, HSBarID, wxPoint(hoffset, top + height - sbarSpaceWidth), wxSize(width - hoffset - sbarSpaceWidth + sbarExtraLen, sbarControlWidth), wxSB_HORIZONTAL); mVsbar = new wxScrollBar(this, VSBarID, wxPoint(width - sbarSpaceWidth, top + voffset), wxSize(sbarControlWidth, height - sbarSpaceWidth - voffset + sbarExtraLen), wxSB_VERTICAL); InitialState(); FixScrollbars(); // // Set the Icon // // loads either the XPM or the windows resource, depending on the platform #ifndef __WXMAC__ wxIcon ic(wxICON(AudacityLogo)); SetIcon(ic); #endif // Min size, max size SetSizeHints(250, 200, 20000, 20000); // Create tags object mTags = new Tags(); #ifdef __WXMSW__ // Accept drag 'n' drop files DragAcceptFiles(true); #endif gAudacityProjects.Add(this); }
int main(int argc, char **argv) { register int n; Arg args[MAX_ARGS]; XmString tcs; CommonTestInit(argc, argv); n = 0; XtSetArg(args[n], XmNwidth, 200); n++; XtSetArg(args[n], XmNheight, 40); n++; XtSetValues(Shell1, args, n); XtRealizeWidget(Shell1); /* ** MenuBar1 */ MenuBar1 = CreateMenuBar(Shell1, "MenuBar1"); PullDown1 = CreatePullDown(MenuBar1, "PullDown1"); MenuBtn1 = CreateCascade("Menu1", '1', PullDown1, MenuBar1); PullDown2 = CreatePullDown(MenuBar1, "PullDown2"); MenuBtn2 = CreateCascade("Menu2", '2', PullDown2, MenuBar1); PullDown3 = CreatePullDown(MenuBar1, "PullDown3"); MenuBtn3 = CreateCascade("Menu3", '3', PullDown3, MenuBar1); /* ** Menu1 */ Label1 = CreateLabelGadget("Menu1", PullDown1); Separator1 = CreateSeparatorGadget(PullDown1, "Separator1"); PushBtn1 = CreatePushButtonGadget("pushbutton1", 'p', PullDown1); ToggleBtn1 = CreateToggleGadget("toggle1", 't', PullDown1); PullDown1A = CreatePullDown(PullDown1, "PullDown1A"); CascadeBtn1 = CreateCascadeGadget("cascade1", 'c', PullDown1A, PullDown1); /* ** Menu2 */ Label2 = CreateLabelGadget("Menu2", PullDown2); Separator2 = CreateSeparatorGadget(PullDown2, "Separator2"); ToggleBtn2 = CreateToggleGadget("toggle2", 't', PullDown2); Separator3 = CreateSeparatorGadget(PullDown2, "Separator3"); PullDown2A = CreatePullDown(PullDown2, "PullDown2A"); CascadeBtn2 = CreateCascadeGadget("cascade2", 'c', PullDown2A, PullDown2); Separator4 = CreateSeparatorGadget(PullDown2, "Separator4"); PushBtn2 = CreatePushButtonGadget("pushButton2", 'p', PullDown2); /* ** Menu3 */ Label3 = CreateLabelGadget("Menu3", PullDown3); PullDown3A = CreatePullDown(PullDown3, "PullDown3A"); CascadeBtn3 = CreateCascadeGadget("cascade3", 'c', PullDown3A, PullDown3); PushBtn3 = CreatePushButtonGadget("pushbutton3", 'p', PullDown3); ToggleBtn3 = CreateToggleGadget("toggle3", 't', PullDown3); /* ** Menu1A */ Label1A = CreateLabelGadget("Menu1A", PullDown1A); Separator1A = CreateSeparatorGadget(PullDown1A, "Separator1A"); PushBtn1A = CreatePushButtonGadget("pushbutton1A", 'A', PullDown1A); PushBtn1B = CreatePushButtonGadget("pushbutton1B", 'B', PullDown1A); PushBtn1C = CreatePushButtonGadget("pushbutton1C", 'C', PullDown1A); /* ** Menu2A */ Label2A = CreateLabelGadget("Menu2A", PullDown2A); Separator2A = CreateSeparatorGadget(PullDown2A, "Separator2A"); ToggleBtn2A = CreateToggleGadget("toggle2A", 'A', PullDown2A); ToggleBtn2B = CreateToggleGadget("toggle2B", 'B', PullDown2A); ToggleBtn2C = CreateToggleGadget("toggle2C", 'C', PullDown2A); /* ** Menu3A */ Label3A = CreateLabelGadget("Menu3A", PullDown3A); Separator3A = CreateSeparatorGadget(PullDown3A, "Separator3A"); PullDown3AA = CreatePullDown(PullDown3A, "PullDown3AA"); CascadeBtn3A = CreateCascadeGadget("cascade3A", 'A', PullDown3AA, PullDown3A); PullDown3BA = CreatePullDown(PullDown3A, "PullDown3BA"); CascadeBtn3B = CreateCascadeGadget("cascade3B", 'B', PullDown3BA, PullDown3A); PullDown3CA = CreatePullDown(PullDown3A, "PullDown3CA"); CascadeBtn3C = CreateCascadeGadget("cascade3C", 'C', PullDown3CA, PullDown3A); /* ** Menu3AA */ Label3AA = CreateLabelGadget("Menu3AA", PullDown3AA); Separator3AA = CreateSeparatorGadget(PullDown3AA, "Separator3AA"); PushBtn3AA = CreatePushButtonGadget("pushbutton3AA", 'p', PullDown3AA); /* ** Menu3BA */ Label3BA = CreateLabelGadget("Menu3BA", PullDown3BA); Separator3BA = CreateSeparatorGadget(PullDown3BA, "Separator3BA"); ToggleBtn3BA = CreateToggleGadget("toggle3BA", 't', PullDown3BA); /* ** Menu3CA */ Label3CA = CreateLabelGadget("Menu3CA", PullDown3CA); Separator3CA = CreateSeparatorGadget(PullDown3CA, "Separator3CA"); PullDown3CAA = CreatePullDown(PullDown3CA, "PullDown3CAA"); CascadeBtn3CA = CreateCascadeGadget("cascade3CA", 'c', PullDown3CAA, PullDown3CA); /* ** Menu3CAA */ Label3CAA = CreateLabelGadget("Menu3CAA", PullDown3CAA); CommonPause(); CommonPause(); CommonPause(); CommonPause(); XtAppMainLoop(app_context); }
void create_datasetop_popup(Widget but, void *data) { Widget dialog, menubar, menupane, rc; set_wait_cursor(); if (datasetopui.top == NULL) { datasetopui.top = CreateDialogForm(app_shell, "Data set operations"); SetDialogFormResizable(datasetopui.top, TRUE); menubar = CreateMenuBar(datasetopui.top); ManageChild(menubar); AddDialogFormChild(datasetopui.top, menubar); dialog = CreateVContainer(datasetopui.top); #ifdef MOTIF_GUI XtVaSetValues(dialog, XmNrecomputeSize, True, NULL); #endif datasetopui.sel = CreateSSDChoice(dialog, "Data sets:", LIST_TYPE_MULTIPLE); menupane = CreateMenu(menubar, "File", 'F', FALSE); CreateMenuButton(menupane, "Close", 'C', destroy_dialog_cb, GetParent(datasetopui.top)); menupane = CreateMenu(menubar, "Help", 'H', TRUE); CreateMenuHelpButton(menupane, "On dataset operations", 's', datasetopui.top, "doc/UsersGuide.html#data-set-operations"); datasetopui.optype_item = CreateOptionChoiceVA(dialog, "Operation type:", "Reverse", DATASETOP_REVERSE, "Transpose", DATASETOP_TRANSPOSE, "Coalesce", DATASETOP_COALESCE, #if 0 "Sort", DATASETOP_SORT, "Split", DATASETOP_SPLIT, #endif "Drop rows", DATASETOP_DROP, NULL); AddOptionChoiceCB(datasetopui.optype_item, datasetoptypeCB, NULL); rc = CreateHContainer(dialog); #ifdef MOTIF_GUI XtVaSetValues(rc, XmNrecomputeSize, True, NULL); #endif /* Sort */ datasetopui.up_down_item = CreateOptionChoiceVA(rc, "Order:", "Ascending", FALSE, "Descending", TRUE, NULL); datasettype_controls[0] = rc; /* Reverse */ rc = CreateVContainer(dialog); CreateSeparator(rc); datasettype_controls[1] = rc; /* Transpose */ rc = CreateVContainer(dialog); CreateSeparator(rc); datasettype_controls[2] = rc; /* Coalesce */ rc = CreateVContainer(dialog); CreateSeparator(rc); datasettype_controls[3] = rc; /* Split */ rc = CreateVContainer(dialog); datasetopui.length_item = CreateTextItem(rc, 6, "Length:"); datasettype_controls[4] = rc; /* Drop rows */ rc = CreateHContainer(dialog); datasetopui.start_item = CreateTextItem(rc, 6, "Start at:"); datasetopui.stop_item = CreateTextItem(rc, 6, "Stop at:"); datasettype_controls[5] = rc; UnmanageChild(datasettype_controls[0]); ManageChild(datasettype_controls[1]); UnmanageChild(datasettype_controls[2]); UnmanageChild(datasettype_controls[3]); UnmanageChild(datasettype_controls[4]); UnmanageChild(datasettype_controls[5]); CreateAACDialog(datasetopui.top, dialog, datasetop_aac_cb, &datasetopui); } RaiseWindow(GetParent(datasetopui.top)); unset_wait_cursor(); }
/* ARGSUSED */ void create_nonl_frame(Widget w, XtPointer client_data, XtPointer call_data) { int i; Widget sw, fr, title_fr, fr1, fr3, rc, rc1, rc2, rc3, lab, fitbut[4], but1[2]; Widget menubar, menupane, submenupane, cascade; set_wait_cursor(); if (nonl_frame == NULL) { char *fitlabel[4]; char *blabel[2]; fitlabel[0] = "Load as is"; fitlabel[1] = "Run 5 steps"; fitlabel[2] = "Run 20 steps"; fitlabel[3] = "Run 100 steps"; blabel[0] = "Accept"; blabel[1] = "Cancel"; nonl_frame = XmCreateDialogShell(app_shell, "Non-linear curve fitting", NULL, 0); handle_close(nonl_frame); nonl_panel = XmCreateForm(nonl_frame, "nonl_frame_rc", NULL, 0); menubar = CreateMenuBar(nonl_panel, "nonlMenuBar", NULL); menupane = CreateMenu(menubar, "nonlFileMenu", "File", 'F', NULL, NULL); CreateMenuButton(menupane, "open", "Open...", 'O', (XtCallbackProc) create_openfit_popup, (XtPointer) NULL, NULL); CreateMenuButton(menupane, "save", "Save...", 'S', (XtCallbackProc) create_savefit_popup, (XtPointer) NULL, NULL); CreateMenuSeparator(menupane, "sep1"); CreateMenuButton(menupane, "close", "Close", 'C', (XtCallbackProc) destroy_nonl_frame, (XtPointer) NONL_ACCEPT, NULL); menupane = CreateMenu(menubar, "nonlDataMenu", "Data", 'D', NULL, NULL); CreateMenuButton(menupane, "reset", "Reset", 'R', (XtCallbackProc) reset_nonl_frame, (XtPointer) NULL, 0); CreateMenuButton(menupane, "update", "Update", 'U', (XtCallbackProc) update_nonl_frame, (XtPointer) NULL, 0); menupane = CreateMenu(menubar, "nonlOptionsMenu", "Options", 'O', NULL, NULL); submenupane = CreateMenu(menupane, "nonlLoadMenu", "Load", 'L', NULL, NULL); nonl_load_item[0] = CreateMenuToggle(submenupane, "values", "Fitted values", 'v', (XtCallbackProc) do_nonl_toggle, (XtPointer) 0, NULL); nonl_load_item[1] = CreateMenuToggle(submenupane, "residuals", "Residuals", 'R', (XtCallbackProc) do_nonl_toggle, (XtPointer) 1, NULL); nonl_load_item[2] = CreateMenuToggle(submenupane, "function", "Function", 'F', (XtCallbackProc) do_nonl_toggle, (XtPointer) 2, NULL); nonl_autol_item = CreateMenuToggle(menupane, "autoload", "Autoload", 'A', (XtCallbackProc) NULL, (XtPointer) NULL, NULL); menupane = CreateMenu(menubar, "nonlHelpMenu", "Help", 'H', &cascade, NULL); XtVaSetValues(menubar, XmNmenuHelpWidget, cascade, NULL); CreateMenuButton(menupane, "onFit", "On fit", 'f', (XtCallbackProc) HelpCB, (XtPointer) "trans.html#nlcurve", 0); CreateMenuButton(menupane, "onContext", "On context", 'x', (XtCallbackProc) ContextHelpCB, (XtPointer) NULL, 0); XtManageChild(menubar); XtVaSetValues(menubar, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, NULL); fr1 = XmCreateFrame(nonl_panel, "nonl_frame", NULL, 0); nonl_set_item = CreateSetSelector(fr1, "Apply to set:", SET_SELECT_ACTIVE, FILTER_SELECT_NONE, GRAPH_SELECT_CURRENT, SELECTION_TYPE_SINGLE); XtManageChild(fr1); XtVaSetValues(fr1, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, menubar, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, NULL); fr = XmCreateFrame(nonl_panel, "nonl_frame", NULL, 0); rc = XmCreateRowColumn(fr, "nonl_rc", NULL, 0); title_fr = XmCreateFrame(rc, "nonl_title_frame", NULL, 0); XtVaSetValues(title_fr, XmNshadowType, XmSHADOW_ETCHED_OUT, NULL); nonl_title_item = XmCreateLabel(title_fr, nonl_opts.title, NULL, 0); XtManageChild(nonl_title_item); XtManageChild(title_fr); nonl_formula_item = (Widget) CreateTextItem2(rc, 35, "Formula:"); rc1 = XmCreateRowColumn(rc, "nonl_rc", NULL, 0); XtVaSetValues(rc1, XmNorientation, XmHORIZONTAL, NULL); nonl_nparm_item = CreatePanelChoice(rc1, "Number of parameters:", 12, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", NULL, NULL); for (i = 0; i < MAXPARM + 1; i++) { XtAddCallback(nonl_nparm_item[2 + i], XmNactivateCallback, (XtCallbackProc) do_nparm_toggle, (XtPointer) i); } nonl_tol_item = CreateTextItem2(rc1, 10, "Tolerance:"); XtManageChild(rc1); sw = XtVaCreateManagedWidget("sw", xmScrolledWindowWidgetClass, rc, XmNheight, 180, XmNscrollingPolicy, XmAUTOMATIC, NULL); rc2 = XmCreateRowColumn(sw, "rc2", NULL, 0); for (i = 0; i < MAXPARM; i++) { nonl_parm_item[i] = XmCreateRowColumn(rc2, "rc1", NULL, 0); XtVaSetValues(nonl_parm_item[i], XmNorientation, XmHORIZONTAL, NULL); sprintf(buf, "A%1d: ", i); nonl_value_item[i] = CreateTextItem2(nonl_parm_item[i], 10, buf); nonl_constr_item[i] = XmCreateToggleButton(nonl_parm_item[i], "Bounds:", NULL, 0); XtAddCallback(nonl_constr_item[i], XmNvalueChangedCallback, (XtCallbackProc) do_constr_toggle, (XtPointer) i); XtManageChild(nonl_constr_item[i]); nonl_lowb_item[i] = CreateTextItem2(nonl_parm_item[i], 6, ""); sprintf(buf, "< A%1d < ", i); lab = XmCreateLabel(nonl_parm_item[i], buf, NULL, 0); XtManageChild(lab); nonl_uppb_item[i] = CreateTextItem2(nonl_parm_item[i], 6, ""); XtManageChild(nonl_parm_item[i]); } XtManageChild(rc2); XtManageChild(rc); XtManageChild(fr); XtVaSetValues(fr, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, fr1, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, NULL); fr3 = XmCreateFrame(nonl_panel, "nonl_frame", NULL, 0); rc3 = XmCreateRowColumn(fr3, "rc3", NULL, 0); CreateCommandButtons(rc3, 4, fitbut, fitlabel); XtAddCallback(fitbut[0], XmNactivateCallback, (XtCallbackProc) do_nonl_proc, (XtPointer) (0)); XtAddCallback(fitbut[1], XmNactivateCallback, (XtCallbackProc) do_nonl_proc, (XtPointer) (5)); XtAddCallback(fitbut[2], XmNactivateCallback, (XtCallbackProc) do_nonl_proc, (XtPointer) (20)); XtAddCallback(fitbut[3], XmNactivateCallback, (XtCallbackProc) do_nonl_proc, (XtPointer) (100)); XtVaCreateManagedWidget("sep", xmSeparatorWidgetClass, rc3, NULL); nonl_fload_rc = XmCreateRowColumn(rc3, "nonl_fload_rc", NULL, 0); XtVaSetValues(nonl_fload_rc, XmNorientation, XmHORIZONTAL, NULL); nonl_start_item = CreateTextItem2(nonl_fload_rc, 6, "Start load at:"); nonl_stop_item = CreateTextItem2(nonl_fload_rc, 6, "Stop load at:"); nonl_npts_item = CreateTextItem2(nonl_fload_rc, 4, "# of points:"); XtManageChild(nonl_fload_rc); XtSetSensitive(nonl_fload_rc, False); CreateCommandButtons(rc3, 2, but1, blabel); XtAddCallback(but1[0], XmNactivateCallback, (XtCallbackProc) destroy_nonl_frame, (XtPointer) NONL_ACCEPT); XtAddCallback(but1[1], XmNactivateCallback, (XtCallbackProc) destroy_nonl_frame, (XtPointer) NONL_CANCEL); XtManageChild(rc3); XtManageChild(fr3); XtVaSetValues(fr3, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, fr, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); XtManageChild(nonl_panel); } update_nonl_frame(); XtRaise(nonl_frame); unset_wait_cursor(); }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { CMFCVisualManager::SetDefaultManager (RUNTIME_CLASS (CMFCVisualManagerOfficeXP)); CMFCToolBarComboBoxButton::SetFlatMode (); CMFCToolBarComboBoxButton::SetCenterVert (); CMFCFontComboBox::m_bDrawUsingFont = TRUE; if (CFrameWndEx::OnCreate(lpCreateStruct) == -1) return -1; if (!CreateMenuBar()) return -1; if (!CreateToolBar()) return -1; if (!CreateFormatBar()) return -1; if (!CreateStatusBar()) return -1; EnableDocking(CBRS_ALIGN_ANY); if (!CreateTaskPane()) return -1; if (!CreateRulerBar()) return -1; CMFCToolBar::AddToolBarForImageCollection (IDR_TOOLBAR_IMAGES); CMFCToolBar::AddToolBarForImageCollection (IDR_BORDER_TYPE); CMFCToolBar::EnableQuickCustomization (); m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY); m_wndFormatBar.EnableDocking(CBRS_ALIGN_ANY); m_wndTaskPane.EnableDocking(CBRS_ALIGN_RIGHT | CBRS_ALIGN_LEFT); DockPane(&m_wndMenuBar); DockPane(&m_wndToolBar); DockPane(&m_wndFormatBar); DockPane(&m_wndTaskPane); CWnd* pView = GetDlgItem(AFX_IDW_PANE_FIRST); if (pView != NULL) { pView->SetWindowPos(&wndBottom, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE); } //---------------------------------------- // Allow user-defined toolbars operations: //---------------------------------------- InitUserToolbars (NULL, uiFirstUserToolBarId, uiLastUserToolBarId); //-------------------- // Set basic commands: //-------------------- CList<UINT, UINT> lstBasicCommands; lstBasicCommands.AddTail (ID_FILE_NEW); lstBasicCommands.AddTail (ID_FILE_OPEN); lstBasicCommands.AddTail (ID_FILE_SAVE); lstBasicCommands.AddTail (ID_FILE_PRINT); lstBasicCommands.AddTail (ID_APP_EXIT); lstBasicCommands.AddTail (ID_EDIT_UNDO); lstBasicCommands.AddTail (ID_EDIT_CUT); lstBasicCommands.AddTail (ID_EDIT_COPY); lstBasicCommands.AddTail (ID_EDIT_PASTE); lstBasicCommands.AddTail (ID_EDIT_SELECT_ALL); lstBasicCommands.AddTail (ID_EDIT_FIND); lstBasicCommands.AddTail (ID_EDIT_REPEAT); lstBasicCommands.AddTail (ID_EDIT_REPLACE); lstBasicCommands.AddTail (ID_OLE_EDIT_PROPERTIES); lstBasicCommands.AddTail (ID_VIEW_OPTIONS); lstBasicCommands.AddTail (ID_VIEW_CUSTOMIZE); lstBasicCommands.AddTail (ID_VIEW_APP_LOOK); lstBasicCommands.AddTail (ID_VIEW_FULL_SCREEN); lstBasicCommands.AddTail (ID_OLE_INSERT_NEW); lstBasicCommands.AddTail (ID_FORMAT_FONT); lstBasicCommands.AddTail (ID_INSERT_BULLET); lstBasicCommands.AddTail (ID_CHAR_COLOR); lstBasicCommands.AddTail (ID_HELP_INDEX); lstBasicCommands.AddTail (ID_APP_ABOUT); lstBasicCommands.AddTail (ID_PARA_LEFT); lstBasicCommands.AddTail (ID_VIEW_TOOLBARS); CMFCToolBar::SetBasicCommands (lstBasicCommands); //-------------------------------------------------------------------- // Enable conttol bar context menu (list of bars + customize command): //-------------------------------------------------------------------- EnablePaneMenu ( TRUE, ID_VIEW_CUSTOMIZE, _T("Customize..."), ID_VIEW_TOOLBARS, FALSE, TRUE); EnableFullScreenMode (ID_VIEW_FULL_SCREEN); EnableFullScreenMainMenu (FALSE); return 0; }
MainWindow::MainWindow(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos,const wxSize& size, const long style) : wxMDIParentFrame(parent, id, title, pos, size, style),note(0) { Centre(); treeVisible=true; xmlEditorVisible=false; editionVisible=false; slider=true; popmenu=true; design_slider=true; state=0; managewindow=new ManageWindows(); treeStruc=false; showLinks=false; #if wxUSE_STATUSBAR CreateStatusBar(); SetStatusText(wxT("Welcome to APOLO")); #endif // wxUSE_STATUSBAR CreateMenuBar(); SetIcon(wxIcon(apolo_xpm)); GetClientSize(&w,&h); CreateToolBar(wxNO_BORDER | wxTB_FLAT | wxTB_HORIZONTAL); InitToolBar(GetToolBar()); wxSashLayoutWindow* aux=new wxSashLayoutWindow(this,wxID_ANY,wxDefaultPosition, wxDefaultSize,wxSW_NOBORDER); aux->SetDefaultSize(wxSize(25,35)); aux->SetOrientation(wxLAYOUT_HORIZONTAL); aux->SetAlignment(wxLAYOUT_TOP); aux->SetSashVisible(wxSASH_TOP, false); s=new wxSashLayoutWindow(this, ID_DRAG,wxDefaultPosition, wxDefaultSize, wxSW_3D); s->SetDefaultSize(wxSize(w/4, h)); s->SetOrientation(wxLAYOUT_VERTICAL); s->SetAlignment(wxLAYOUT_LEFT); s->SetSashVisible(wxSASH_RIGHT, true); treeToolbar=new wxToolBar(); treeToolbar->Create(aux,wxID_ANY,wxDefaultPosition,wxSize(100,30),wxDOUBLE_BORDER,wxT("Views")); wxBitmap bitmaps[2]; bitmaps[0]=wxBitmap(Links_xpm); bitmaps[1]=wxBitmap(treeStructure_xpm); wxStaticText *text = new wxStaticText(treeToolbar, wxID_ANY, wxT("Tree view")); treeToolbar->AddSeparator(); treeToolbar->AddControl(text); treeToolbar->AddSeparator(); treeToolbar->AddCheckTool(ID_SHOWLINKS,wxT("Show Links"),bitmaps[0],wxNullBitmap); treeToolbar->AddCheckTool(ID_TREESTRUCTURE,wxT("Tree structure"),bitmaps[1],wxNullBitmap); treeToolbar->AddSeparator(); treeToolbar->SetBackgroundColour(wxColour(200,230,255)); treeToolbar->Realize(); //make a Aui Notebook note = new wxAuiNotebook(s, wxID_ANY,wxDefaultPosition,wxDefaultSize, wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_CLOSE_ON_ACTIVE_TAB | wxAUI_NB_TAB_EXTERNAL_MOVE); tree = new Tree(note, ID_TREE); CreatePanelXML(); tree->m_mainWin = this; tree->XMLPanel=NULL; m_root = tree->AddRoot(wxT("Universe"), 0, 47, new TreeItemData(wxT("Root item"))); tree->Parent(m_root); note->AddPage(tree, wxT("Universe")); SetAutoLayout(true); rToogle=false; SimulatedWorld::tree = tree; SimulatedWorld::mainWin = this; port=new ApoloPort(12000,&listWorlds); connection=new RobotConnection(this,wxT("Server Configuration")); }
AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, const wxPoint & pos, const wxSize & size): wxFrame(parent, id, "Audacity", pos, size), mRate((double) gPrefs->Read("/SamplingRate/DefaultProjectSampleRate", 44100)), mDirty(false), mAPalette(NULL), mDrag(NULL), mTrackPanel(NULL), mHistoryWindow(NULL), mAutoScrolling(false) { // // Create track list // mTracks = new TrackList(); mLastSavedTracks = NULL; // // Initialize view info (shared with TrackPanel) // // Selection mViewInfo.sel0 = 0.0; mViewInfo.sel1 = 0.0; // Horizontal scrollbar mViewInfo.total = 1.0; mViewInfo.screen = 1.0; mViewInfo.h = 0.0; mViewInfo.zoom = 44100.0 / 512.0; mViewInfo.lastZoom = mViewInfo.zoom; // Vertical scrollbar mViewInfo.vpos = 0; mViewInfo.scrollStep = 16; mViewInfo.sbarH = 0; mViewInfo.sbarScreen = 1; mViewInfo.sbarTotal = 1; mMenuBar = NULL; CreateMenuBar(); int left = 0, top = 0, width, height; GetClientSize(&width, &height); // // Create the Palette (if we're not using a windowed palette) // if (!gWindowedPalette) { int h = GetAPaletteHeight(); int ptop = 0; #ifdef __WXMSW__ ptop++; #endif mAPalette = new APalette(this, 0, wxPoint(10, ptop), wxSize(width - 10, h)); top += h + 1 + ptop; height -= h + 1 + ptop; } // // Create the status bar // int sh = GetStatusHeight(); mStatus = new AStatus(this, 0, wxPoint(0, height - sh), wxSize(width, sh), mRate, this); height -= sh; mStatus->SetField(wxString::Format("Welcome to Audacity version %s", AUDACITY_VERSION_STRING), 0); // // Create the TrackPanel and the scrollbars // mTrackPanel = new TrackPanel(this, TrackPanelID, wxPoint(left, top), wxSize(width - sbarSpaceWidth, height - sbarSpaceWidth), mTracks, &mViewInfo, this); int hoffset = mTrackPanel->GetLeftOffset() - 1; int voffset = mTrackPanel->GetRulerHeight(); #ifdef __WXMAC__ width++; height++; #endif mHsbar = new wxScrollBar(this, HSBarID, wxPoint(hoffset, top + height - sbarSpaceWidth), wxSize(width - hoffset - sbarSpaceWidth + sbarExtraLen, sbarControlWidth), wxSB_HORIZONTAL); mVsbar = new wxScrollBar(this, VSBarID, wxPoint(width - sbarSpaceWidth, top + voffset), wxSize(sbarControlWidth, height - sbarSpaceWidth - voffset + sbarExtraLen), wxSB_VERTICAL); InitialState(); FixScrollbars(); // // Set the Icon // // loads either the XPM or the windows resource, depending on the platform #ifndef __WXMAC__ wxIcon ic(wxICON(AudacityLogo)); SetIcon(ic); #endif // Min size, max size SetSizeHints(250, 200, 20000, 20000); // Create tags object mTags = new Tags(); #ifdef __WXMSW__ // Accept drag 'n' drop files DragAcceptFiles(true); #endif gAudacityProjects.Add(this); }
/* Main window procedure */ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_COMMAND: if(HIWORD(wParam) == 0 && lParam == 0) { /* The message came from the menu bar */ if(LOWORD(wParam) >= 100) { /* Ignore std. messages like IDCANCEL et al. */ TCHAR buffer[64]; _sntprintf(buffer, 64, _T("Received WM_COMMAND from menuitem ID %d."), (int) LOWORD(wParam)); MessageBox(hWnd, buffer, _T("Click!"), MB_ICONINFORMATION | MB_OK); return 0; } } break; case WM_NOTIFY: { /* Handle notifications for the ReBar control */ NMHDR* hdr = (NMHDR*) lParam; if(hdr->hwndFrom == hwndRebar) { switch(hdr->code) { /* Cancel drag'n'drop for the menubar's band, so it is * always on the top just below window caption. */ case RBN_BEGINDRAG: { NMREBAR* nm = (NMREBAR*) hdr; if(nm->wID == BAND_MENUBAR) return -1; break; } /* Handle chevron for the menubar's band. */ case RBN_CHEVRONPUSHED: { NMREBARCHEVRON* nm = (NMREBARCHEVRON*) hdr; if(nm->wID == BAND_MENUBAR) mcMenubar_HandleRebarChevronPushed(hwndMenubar, nm); break; } } } break; } case WM_SIZE: /* Ensure the ReBar is resized on top of the main window */ SendMessage(hwndRebar, WM_SIZE, 0, 0); break; case WM_CREATE: CreateMenuBar(hWnd); CreateMenuBarSm(hWnd); return 0; case WM_DESTROY: PostQuitMessage(0); return 0; } return DefWindowProc(hWnd, uMsg, wParam, lParam); }
EDA_3D_FRAME::EDA_3D_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent, const wxString& aTitle, long style ) : KIWAY_PLAYER( aKiway, aParent, FRAME_PCB_DISPLAY3D, aTitle, wxDefaultPosition, wxDefaultSize, style, wxT( "Frame3D" ) ) { m_canvas = NULL; m_reloadRequest = false; m_ortho = false; // Give it an icon wxIcon icon; icon.CopyFromBitmap( KiBitmap( icon_3d_xpm ) ); SetIcon( icon ); LoadSettings( config() ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); // Create the status line static const int status_dims[4] = { -1, 130, 130, 170 }; CreateStatusBar( DIM( status_dims ) ); SetStatusWidths( DIM( status_dims ), status_dims ); CreateMenuBar(); ReCreateMainToolbar(); // Make a EDA_3D_CANVAS // Note: We try to use anti aliasing if the graphic card allows that, // but only on wxWidgets >= 3.0.0 (this option does not exist on wxWidgets 2.8) int attrs[] = { // This array should be 2*n+1 // Sadly wxwidgets / glx < 13 allowed // a thing named "boolean attributes" that don't take a value. // (See src/unix/glx11.cpp -> wxGLCanvasX11::ConvertWXAttrsToGL() ). // To avoid problems due to this, just specify those attributes twice. // Only WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_STEREO are such boolean // attributes. // Boolean attributes (using itself at padding): WX_GL_RGBA, WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DOUBLEBUFFER, // Normal attributes with values: WX_GL_DEPTH_SIZE, 16, WX_GL_STENCIL_SIZE, 1, WX_GL_SAMPLE_BUFFERS, 1, // Enable multisampling support (antialiasing). WX_GL_SAMPLES, 0, // Disable AA for the start. 0 }; // NULL termination // Check if the canvas supports multisampling. if( EDA_3D_CANVAS::IsDisplaySupported( attrs ) ) { // Check for possible sample sizes, start form the top. int maxSamples = 8; // Any higher doesn't change anything. int samplesOffset = 0; for( unsigned int ii = 0; ii < DIM( attrs ); ii += 2 ) { if( attrs[ii] == WX_GL_SAMPLES ) { samplesOffset = ii+1; break; } } attrs[samplesOffset] = maxSamples; for( ; maxSamples > 0 && !EDA_3D_CANVAS::IsDisplaySupported( attrs ); maxSamples = maxSamples>>1 ) { attrs[samplesOffset] = maxSamples; } } else { // Disable multisampling for( unsigned int ii = 0; ii < DIM( attrs ); ii += 2 )
int main(int argc, char* argv[]) { CefMainArgs main_args(argc, argv); CefRefPtr<ClientApp> app(new ClientApp); // Execute the secondary process, if any. int exit_code = CefExecuteProcess(main_args, app.get()); if (exit_code >= 0) return exit_code; if (!getcwd(szWorkingDir, sizeof (szWorkingDir))) return -1; GtkWidget* window; gtk_init(&argc, &argv); // Parse command line arguments. AppInitCommandLine(argc, argv); CefSettings settings; // Populate the settings based on command line arguments. AppGetSettings(settings, app); // Initialize CEF. CefInitialize(main_args, settings, app.get()); // Register the scheme handler. scheme_test::InitTest(); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size(GTK_WINDOW(window), 800, 600); g_signal_connect(window, "focus", G_CALLBACK(&HandleFocus), NULL); GtkWidget* vbox = gtk_vbox_new(FALSE, 0); GtkWidget* menu_bar = CreateMenuBar(); gtk_box_pack_start(GTK_BOX(vbox), menu_bar, FALSE, FALSE, 0); GtkWidget* toolbar = gtk_toolbar_new(); // Turn off the labels on the toolbar buttons. gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS); GtkToolItem* back = gtk_tool_button_new_from_stock(GTK_STOCK_GO_BACK); g_signal_connect(back, "clicked", G_CALLBACK(BackButtonClicked), NULL); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), back, -1 /* append */); GtkToolItem* forward = gtk_tool_button_new_from_stock(GTK_STOCK_GO_FORWARD); g_signal_connect(forward, "clicked", G_CALLBACK(ForwardButtonClicked), NULL); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), forward, -1 /* append */); GtkToolItem* reload = gtk_tool_button_new_from_stock(GTK_STOCK_REFRESH); g_signal_connect(reload, "clicked", G_CALLBACK(ReloadButtonClicked), NULL); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), reload, -1 /* append */); GtkToolItem* stop = gtk_tool_button_new_from_stock(GTK_STOCK_STOP); g_signal_connect(stop, "clicked", G_CALLBACK(StopButtonClicked), NULL); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), stop, -1 /* append */); GtkWidget* m_editWnd = gtk_entry_new(); g_signal_connect(G_OBJECT(m_editWnd), "activate", G_CALLBACK(URLEntryActivate), NULL); GtkToolItem* tool_item = gtk_tool_item_new(); gtk_container_add(GTK_CONTAINER(tool_item), m_editWnd); gtk_tool_item_set_expand(tool_item, TRUE); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), tool_item, -1); // append gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_widget_destroyed), &window); g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(destroy), NULL); // Create the handler. g_handler = new ClientHandler(); g_handler->SetMainHwnd(vbox); g_handler->SetEditHwnd(m_editWnd); g_handler->SetButtonHwnds(GTK_WIDGET(back), GTK_WIDGET(forward), GTK_WIDGET(reload), GTK_WIDGET(stop)); // Create the browser view. CefWindowInfo window_info; CefBrowserSettings browserSettings; // Populate the settings based on command line arguments. AppGetBrowserSettings(browserSettings); window_info.SetAsChild(vbox); CefBrowserHost::CreateBrowserSync( window_info, g_handler.get(), g_handler->GetStartupURL(), browserSettings); gtk_container_add(GTK_CONTAINER(window), vbox); gtk_widget_show_all(GTK_WIDGET(window)); // Install an signal handler so we clean up after ourselves. signal(SIGINT, TerminationSignalHandler); signal(SIGTERM, TerminationSignalHandler); CefRunMessageLoop(); CefShutdown(); return 0; }
void create_datasetprop_popup(Widget but, void *data) { set_wait_cursor(); if (tui.top == NULL) { Widget menubar, menupane, fr; int i, j; char *rowlabels[MAX_SET_COLS]; char *collabels[DATA_STAT_COLS] = {"Min", "at", "Max", "at", "Mean", "Stdev"}; int column_widths[DATA_STAT_COLS] = {12, 6, 12, 6, 12, 12}; GraceApp *gapp = (GraceApp *) data; tui.top = CreateDialogForm(app_shell, "Data set statistics"); menubar = CreateMenuBar(tui.top); ManageChild(menubar); AddDialogFormChild(tui.top, menubar); tui.sel = CreateGraphSetSelector(tui.top, "Data sets:", LIST_TYPE_SINGLE); AddDialogFormChild(tui.top, tui.sel->frame); AddStorageChoiceCB(tui.sel->set_sel, changetypeCB, tui.sel); menupane = CreateMenu(menubar, "File", 'F', FALSE); CreateMenuCloseButton(menupane, tui.top); menupane = CreateMenu(menubar, "Help", 'H', TRUE); CreateMenuHelpButton(menupane, "On data sets", 's', tui.top, "doc/UsersGuide.html#data-sets"); for (i = 0; i < MAX_SET_COLS; i++) { rowlabels[i] = copy_string(NULL, dataset_col_name(gapp->grace, i)); for (j = 0; j < DATA_STAT_COLS; j++) { tui.rows[i][j] = NULL; } } fr = CreateFrame(tui.top, "Statistics"); tui.mw = CreateTable("mw", fr, MAX_SET_COLS, DATA_STAT_COLS, MAX_SET_COLS, 4); TableDataSetPropInit(tui.mw); TableSetColLabels(tui.mw, collabels); TableSetColWidths(tui.mw, column_widths); TableSetDefaultColAlignment(tui.mw, ALIGN_END); TableSetDefaultColLabelAlignment(tui.mw, ALIGN_CENTER); TableSetRowLabels(tui.mw, rowlabels); TableSetDefaultRowLabelWidth(tui.mw, 3); TableSetDefaultRowLabelAlignment(tui.mw, ALIGN_CENTER); TableUpdateVisibleRowsCols(tui.mw); AddTableEnterCellCB(tui.mw, enterCB, NULL); AddDialogFormChild(tui.top, fr); ManageChild(tui.top); } RaiseWindow(GetParent(tui.top)); unset_wait_cursor(); }
EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway, PCB_BASE_FRAME *aParent, const wxString &aTitle, long style ) : KIWAY_PLAYER( aKiway, aParent, FRAME_PCB_DISPLAY3D, aTitle, wxDefaultPosition, wxDefaultSize, style, VIEWER3D_FRAMENAME ) { wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::EDA_3D_VIEWER %s" ), aTitle ); m_canvas = NULL; m_defaultFileName = ""; // Give it an icon wxIcon icon; icon.CopyFromBitmap( KiBitmap( icon_3d_xpm ) ); SetIcon( icon ); LoadSettings( config() ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); // Create the status line static const int status_dims[4] = { -1, 130, 130, 170 }; wxStatusBar *status_bar = CreateStatusBar( DIM( status_dims ) ); SetStatusWidths( DIM( status_dims ), status_dims ); CreateMenuBar(); ReCreateMainToolbar(); m_canvas = new EDA_3D_CANVAS( this, COGL_ATT_LIST::GetAttributesList( true ), aParent->GetBoard(), m_settings, Prj().Get3DCacheManager() ); if( m_canvas ) m_canvas->SetStatusBar( status_bar ); m_auimgr.SetManagedWindow( this ); EDA_PANEINFO horiztb; horiztb.HorizontalToolbarPane(); m_auimgr.AddPane( m_mainToolBar, wxAuiPaneInfo( horiztb ).Name( wxT( "m_mainToolBar" ) ).Top() ); if( m_canvas ) m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); m_auimgr.Update(); m_mainToolBar->EnableTool( ID_RENDER_CURRENT_VIEW, (m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY) ); // Fixes bug in Windows (XP and possibly others) where the canvas requires the focus // in order to receive mouse events. Otherwise, the user has to click somewhere on // the canvas before it will respond to mouse wheel events. if( m_canvas ) m_canvas->SetFocus(); }
/*! \brief Init user interface regardless of the parameter of constructor. */ void EventEditorMainWindow::InitUI() { ClearUI(); MainView = new BView( BWindow::Bounds(), "Event Editor Main View", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS ); if ( MainView != NULL ) { MainView->SetViewColor( ui_color(B_PANEL_BACKGROUND_COLOR ) ); BWindow::AddChild( MainView ); } else { global_toReturn = B_NO_MEMORY; be_app->PostMessage( B_QUIT_REQUESTED ); } BGridLayout* layout = new BGridLayout( B_VERTICAL ); if ( !layout ) { global_toReturn = B_NO_MEMORY; be_app->PostMessage( B_QUIT_REQUESTED ); } MainView->SetLayout( layout ); layout->SetInsets( 0, 0, 0, 5 ); layout->SetSpacing( 0, 2 ); menuBar = CreateMenuBar(); layout->AddView( menuBar, 0, 0 ); BTabView* tabView = new BTabView( Bounds().InsetBySelf( 5, 30 ), "Tab view" ); if ( !tabView ) { global_toReturn = B_NO_MEMORY; be_app->PostMessage( B_QUIT_REQUESTED ); } BLayoutItem* layoutItem = layout->AddView( tabView, 0, 1 ); if ( layoutItem ) { layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_USE_FULL_WIDTH, B_ALIGN_USE_FULL_HEIGHT ) ); } BRect individualTab = tabView->Bounds(); individualTab.bottom -= ( tabView->TabHeight() + 20 + menuBar->Bounds().Height() ); // Enable firing the activity in any case fData.SetEventActivityFired( false ); // General view genView = new EventEditor_GeneralView( individualTab, &fData ); if ( !genView || genView->InitCheck() != B_OK ) { global_toReturn = B_NO_MEMORY; be_app->PostMessage( B_QUIT_REQUESTED ); } BTab* tab = new BTab(); tabView->AddTab( genView, tab ); tab->SetLabel( "General" ); // Reminder view remView = new EventEditor_ReminderView( individualTab, &fData ); if ( !remView || remView->InitCheck() != B_OK ) { global_toReturn = B_NO_MEMORY; be_app->PostMessage( B_QUIT_REQUESTED ); } tab = new BTab(); tabView->AddTab( remView, tab ); tab->SetLabel( "Reminder" ); // Event activity actView = new ActivityView( individualTab.InsetByCopy( 5, 5 ), "Event activity", fData.GetEventActivity() ); if ( !actView || actView->InitCheck() != B_OK ) { global_toReturn = B_NO_MEMORY; be_app->PostMessage( B_QUIT_REQUESTED ); } tab = new BTab(); tabView->AddTab( actView, tab ); tab->SetLabel( "Activity" ); // Note view noteView = new EventEditor_NoteView( individualTab.InsetByCopy( 5, 5 ), &fData ); if ( !noteView || noteView->InitCheck() != B_OK ) { global_toReturn = B_NO_MEMORY; be_app->PostMessage( B_QUIT_REQUESTED ); } tab = new BTab(); tabView->AddTab( noteView, tab ); tab->SetLabel( "Note" ); menuBar->SetTargetForItems( this ); // Save button saveAndClose = new BButton( BRect( 0, 0, 1, 1 ), "Save", "Save", new BMessage( kFileSave ) ); if ( !saveAndClose ) { global_toReturn = B_NO_MEMORY; be_app->PostMessage( B_QUIT_REQUESTED ); } BLayoutItem* layoutItem2 = layout->AddView( saveAndClose, 0, 2 ); if ( layoutItem ) { layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_RIGHT, B_ALIGN_BOTTOM ) ); } saveAndClose->SetTarget( this ); layout->SetMaxRowHeight( 1, 520 ); layout->SetMinRowHeight( 2, 25 ); // Refresh view InvalidateLayout(); MainView->Invalidate(); } // <-- end of UI initialization for MainWindow
// ---------------------------------------------------------------------------- bool ThreadSearchFrame::InitThreadSearchFrame(wxFrame* appFrame, const wxString& title) // ---------------------------------------------------------------------------- { GetConfig()->SetThreadSearchFrame( this ); // create a menu bar CreateMenuBar(); // create a status bar with some information about the used wxWidgets version CreateStatusBar(2); SetStatusText(_("CodeSnippets Search"),0); SetStatusText(wxbuildinfo(short_f), 1); InitializeRecentFilesHistory(); // -not used yet- // allocate a separate EditorManager/Notebook if (not GetConfig()->GetEditorManager(this)) { SEditorManager* m_pEdMan = new SEditorManager(this); GetConfig()->RegisterEditorManager(this, m_pEdMan); }//if GetEditorManager // create ThreadSearch and alter its menu items m_pThreadSearch = new ThreadSearch( this ); if ( m_pThreadSearch ) do { m_pThreadSearch->ThreadSearch::m_IsAttached = true; m_pThreadSearch->OnAttach(); PushEventHandler(m_pThreadSearch); m_pThreadSearch->SetEvtHandlerEnabled( true ); // add View and Search menu items wxMenuBar* pMenuBar = this->GetMenuBar(); wxMenu* pMenuView = new wxMenu(); //-wxMenu* pMenuSearch = pMenuBar->GetMenu( pMenuBar->FindMenu(_T("Search"))); pMenuBar->Insert( 1, pMenuView, _T("View")); //-pMenuBar->Insert( 2, pMenuSearch, _T("Search")); m_pThreadSearch->BuildMenu( pMenuBar ); // Change 'View/ThreadSearch' to 'View/Options' int idOptionsThreadSearch = pMenuBar->FindMenuItem(_T("View"),_T("Snippets search")); if (idOptionsThreadSearch not_eq wxNOT_FOUND) { pMenuBar->SetLabel( idOptionsThreadSearch, _T("Options...") ); m_pThreadSearch->Connect(idOptionsThreadSearch, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(ThreadSearchFrame::OnMenuOptions), NULL, this); } // create tool bar and hide it (avoids bar reference crashes) wxToolBar* pToolBar = new wxToolBar(this, -1); if ( m_pThreadSearch ) m_pThreadSearch->BuildToolBar( pToolBar ); pToolBar->Hide(); // move frame to last know frame position ConfigManager* pCfg = Manager::Get()->GetConfigManager(_T("SnippetsSearch")); int xPos = pCfg->ReadInt( wxT("/FramePosX"), 120); int yPos = pCfg->ReadInt( wxT("/FramePosY"), 60); int width = pCfg->ReadInt( wxT("/FrameWidth"), 120); int height = pCfg->ReadInt( wxT("/FrameHeight"), 60); SetSize( xPos, yPos, width, height); // Catch Destroyed windows Connect( wxEVT_DESTROY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) &ThreadSearchFrame::OnWindowDestroy); // Allow filenames to be dropped/opened on ThreadSearchFrame SetDropTarget(new wxMyFileDropTarget(this)); GetConfig()->GetEditorManager(this)->GetNotebook()->SetDropTarget(new wxMyFileDropTarget(this)); }while(false);//if m_pThreadSearch do return m_pThreadSearch; }//initThreadSearchFrame ctor