示例#1
0
MainWindow :: MainWindow(HINSTANCE instance, const wchar_t* caption, _Controller* controller, Model* model)
   : SDIWindow(instance, caption), _windowList(10, IDM_WINDOW_WINDOWS), _recentFiles(10, IDM_FILE_FILES), _recentProjects(10, IDM_FILE_PROJECTS), _contextBrowser(model)
{
   _controller = controller;
   _model = model;
   _tabTTHandle = NULL;

   _controlCount = 14;
   _controls = (_BaseControl**)malloc(_controlCount << 2);

   _controls[0] = NULL;
   _controls[CTRL_MENU] = new Menu(instance, IDR_IDE_ACCELERATORS, ::GetMenu(getHandle()));
   _controls[CTRL_CONTEXTMENU] = new ContextMenu();

   _windowList.assign((Menu*)_controls[CTRL_MENU]);
   _recentFiles.assign((Menu*)_controls[CTRL_MENU]);
   _recentProjects.assign((Menu*)_controls[CTRL_MENU]);

   ContextMenu* contextMenu = (ContextMenu*)_controls[CTRL_CONTEXTMENU];

   contextMenu->create(8, contextMenuInfo);

   _controls[CTRL_STATUSBAR] = new StatusBar(this, 5, StatusBarWidths);
   _controls[CTRL_TOOLBAR] = new ToolBar(this, 16, AppToolBarButtonNumber, AppToolBarButtons);
   _controls[CTRL_EDITFRAME] = new EditFrame(this, true, contextMenu, model);
   _controls[CTRL_TABBAR] = new TabBar(this, _model->tabWithAboveScore);
   _controls[CTRL_OUTPUT] = new Output((Control*)_controls[CTRL_TABBAR], this);
   _controls[CTRL_MESSAGELIST] = new MessageLog((Control*)_controls[CTRL_TABBAR]);
   _controls[CTRL_CALLLIST] = new CallStackLog((Control*)_controls[CTRL_TABBAR]);
   _controls[CTRL_BSPLITTER] = new Splitter(this, (Control*)_controls[CTRL_TABBAR], false, IDM_LAYOUT_CHANGED);
   _controls[CTRL_CONTEXTBOWSER] = new TreeView((Control*)_controls[CTRL_TABBAR], true);
   _controls[CTRL_PROJECTVIEW] = new TreeView(this, false);
   _controls[CTRL_HSPLITTER] = new Splitter(this, (Control*)_controls[CTRL_PROJECTVIEW], true, IDM_LAYOUT_CHANGED);

   ((Control*)_controls[CTRL_TABBAR])->_setHeight(120);
   ((Control*)_controls[CTRL_BSPLITTER])->_setConstraint(60, 100);
   ((Control*)_controls[CTRL_PROJECTVIEW])->_setWidth(200);

   _statusBar = (StatusBar*)_controls[CTRL_STATUSBAR];

   EditFrame* frame = (EditFrame*)_controls[CTRL_EDITFRAME];
   TextView* textView = new TextView(frame, 5, 28, 400, 400);
   frame->populate(textView);
   textView->setReceptor(this);
   _contextBrowser.assign((Control*)_controls[CTRL_CONTEXTBOWSER]);
   
   setLeft(CTRL_HSPLITTER);
   setTop(CTRL_TOOLBAR);
   setClient(CTRL_EDITFRAME);
   setBottom(CTRL_BSPLITTER);

   frame->init(model);

   showControls(CTRL_STATUSBAR, CTRL_EDITFRAME);

   showControls(CTRL_PROJECTVIEW, CTRL_PROJECTVIEW);
}
示例#2
0
WIN32IDE :: WIN32IDE(HINSTANCE instance, AppDebugController* debugController)
   : IDE(debugController), controls(NULL, _ELENA_::freeobj)
{
   this->instance = instance;

   // create main window & menu
   _appWindow = new MainWindow(instance, _T("IDE"), this);
   _appMenu = new Menu(instance, IDR_IDE_ACCELERATORS, ::GetMenu(_appWindow->getHandle()));
   contextMenu.create(8, contextMenuInfo);

   _appToolBar = new ToolBar(_appWindow, 16, AppToolBarButtonNumber, AppToolBarButtons);
   _statusBar = new StatusBar(_appWindow, 5, StatusBarWidths);
   _outputBar = createOutputBar();
   _contextBrowser = createContextBrowser();

   _mainFrame = new EditFrame(_appWindow, true, &contextMenu);
   TextView* textView = new TextView(_mainFrame, 5, 28, 400, 400);
   _mainFrame->populate(textView);
   textView->setReceptor(_appWindow);

   _mainFrame->show();
   _appToolBar->show();
   _statusBar->show();

   _appWindow->_getLayoutManager()->setAsTop(_appToolBar);
   _appWindow->_setStatusBar(_statusBar);
   _appWindow->_getLayoutManager()->setAsClient(_mainFrame);

   controls.add(_mainFrame);
   controls.add(textView);
   controls.add(_statusBar);
   controls.add(_appToolBar);
   controls.add(_appMenu);
   controls.add(_appWindow);

   // initialize recent files / projects / windows manager
   _recentFiles.assign(_appMenu);
   _recentProjects.assign(_appMenu);
   _windowList.assign(_appMenu);
}