LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // create command bar window HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // attach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.LoadImages(IDR_MAINFRAME); // remove old menu SetMenu(NULL); HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(hWndToolBar, NULL, TRUE); CreateSimpleStatusBar(); m_hWndClient = m_view.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_HSCROLL | WS_VSCROLL, WS_EX_CLIENTEDGE); m_view.SetScrollSize(1,1); UIAddToolBar(hWndToolBar); UISetCheck(ID_VIEW_TOOLBAR, 1); UISetCheck(ID_VIEW_STATUS_BAR, 1); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); return 0; }
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // create command bar window HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // attach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.LoadImages(IDR_MAINFRAME); // remove old menu SetMenu(NULL); HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(hWndToolBar, NULL, TRUE); CreateSimpleStatusBar(); UIAddToolBar(hWndToolBar); UISetCheck(ID_VIEW_TOOLBAR, 1); UISetCheck(ID_VIEW_STATUS_BAR, 1); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); // Create the splitter windows. const DWORD dwSplitStyle = CHILD_WND_STYLE; m_wndVerSplit1.Create (*this, rcDefault, NULL, dwSplitStyle); m_wndVerSplit1.m_bFullDrag = false; m_wndVerSplit1.m_cxyMin = 200; m_wndVerSplit1.SetSplitterPos(200); m_wndVerSplit2.Create(m_wndVerSplit1, rcDefault, NULL, dwSplitStyle); m_wndVerSplit2.m_bFullDrag = false; m_wndVerSplit2.m_cxyMin = 200; m_wndVerSplit2.SetSplitterPos(200); // Create splitter view const DWORD dwViewStyle = CHILD_WND_STYLE; const DWORD dwViewStyleEx = WS_EX_CLIENTEDGE; m_wndLeftView.Create(m_wndVerSplit1, rcDefault, NULL, dwViewStyle, dwViewStyleEx); m_wndMiddleView.Create(m_wndVerSplit2, rcDefault, NULL, dwViewStyle, dwViewStyleEx); m_wndRightView.Create(m_wndVerSplit2, rcDefault, NULL, dwViewStyle, dwViewStyleEx); m_wndVerSplit1.SetSplitterPanes(m_wndLeftView, m_wndVerSplit2); m_wndVerSplit2.SetSplitterPanes(m_wndMiddleView, m_wndRightView); m_hWndClient = m_wndVerSplit1; // Set the splitter as the client area window, and resize the splitter // to match the frame size. UpdateLayout(); return 0; }
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // Check if Common Controls 6.0 are used. If yes, use 32-bit (alpha) images // for the toolbar and command bar. If not, use the old, 4-bit images. UINT uResID = IDR_MAINFRAME_OLD; DWORD dwMajor = 0; DWORD dwMinor = 0; HRESULT hRet = AtlGetCommCtrlVersion(&dwMajor, &dwMinor); if(SUCCEEDED(hRet) && dwMajor >= 6) uResID = IDR_MAINFRAME; // Set values to be displayed in the view window m_view.m_dwCommCtrlMajor = dwMajor; m_view.m_dwCommCtrlMinor = dwMinor; m_view.m_bAlpha = (uResID == IDR_MAINFRAME); // create command bar window HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // attach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.LoadImages(uResID); // remove old menu SetMenu(NULL); HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, uResID, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(hWndToolBar, NULL, TRUE); CreateSimpleStatusBar(); _createVerticalSplitter(); _createCanvas(); _createHoricalSplitter(); _createTreeView(); _createAnimationBox(); UpdateLayout(); UIAddToolBar(hWndToolBar); UISetCheck(ID_VIEW_TOOLBAR, 1); UISetCheck(ID_VIEW_RENDER_BAR, 1); UISetCheck(ID_VIEW_STATUS_BAR, 1); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); UIEnable(ID_EDIT_PASTE, FALSE); _canvas = NULL; // return 0; }
void MainFrame::SetupToolbar() { CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); AddSimpleReBarBand(m_CmdBar); HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); AddSimpleReBarBand(hWndToolBar, NULL, TRUE); UIAddToolBar(hWndToolBar); }
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { hThread = 0; // create command bar window HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // attach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.LoadImages(IDR_MAINFRAME); // remove old menu SetMenu(NULL); HICON hIconSmall = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR); InstallIcon(_T("Tooltip text"), hIconSmall, IDR_TRAYPOPUP); SetDefaultItem(ID_SHOW); HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(hWndToolBar, NULL, TRUE); CreateSimpleStatusBar(); WTL::CRect r(0, 0, 800, 600); m_hWndClient = m_view.Create(m_hWnd, r, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | LBS_NOINTEGRALHEIGHT | LBS_NOTIFY | LBS_WANTKEYBOARDINPUT, WS_EX_CLIENTEDGE); m_view.SetFont(AtlGetDefaultGuiFont()); UIAddToolBar(hWndToolBar); UISetCheck(ID_VIEW_TOOLBAR, 1); UISetCheck(ID_VIEW_STATUS_BAR, 1); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); return 0; }
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { CNCaptureApplication::Instance()->m_pMainFrame = this; // create command bar window HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // attach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.LoadImages(IDR_MAINFRAME); // remove old menu SetMenu(NULL); HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(hWndToolBar, NULL, TRUE); CreateSimpleStatusBar(); m_hWndClient = m_view.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE); m_view.Initialize(); #ifdef FTL_DEBUG HRESULT hr = E_FAIL; CWindowDC dcScreen(NULL); m_bitmap.CreateCompatibleBitmap(dcScreen, 100, 100); CCapImageObj* pImageObj = new CCapImageObj(TEXT("G:\\TestImage.PNG"), NULL); COM_VERIFY(pImageObj->Load(TEXT("G:\\TestImage.PNG"))); if (SUCCEEDED(hr)) { CNCaptureApplication::Instance()->GetDocument()->SetCurCaptureImage(pImageObj); } #endif UIAddToolBar(hWndToolBar); UISetCheck(ID_VIEW_TOOLBAR, 1); UISetCheck(ID_VIEW_STATUS_BAR, 1); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); return 0; }
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // create command bar window HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // attach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.LoadImages(IDR_MAINFRAME); // remove old menu SetMenu(NULL); HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(hWndToolBar, NULL, TRUE); CString szAddress; szAddress.LoadString(IDS_ADDRESS); m_URL.Create(m_hWnd,CRect(0,0,0,18),NULL,WS_CHILD|WS_VISIBLE,WS_EX_STATICEDGE); AddSimpleReBarBand(m_URL,szAddress.GetBuffer(0),TRUE); m_URL.SetFont(AtlGetDefaultGuiFont()); SHAutoComplete(m_URL,SHACF_URLALL); CreateSimpleStatusBar(); m_StatusBar.SubclassWindow(m_hWndStatusBar); int nPanes[]={ID_DEFAULT_PANE,IDR_LOCK,IDR_PROGRESS}; m_StatusBar.SetPanes(nPanes,sizeof(nPanes)/sizeof(int),false); m_StatusBar.SetPaneWidth(IDR_LOCK,30); m_StatusBar.SetPaneWidth(IDR_PROGRESS,50); //TODO: Replace with a URL of your choice m_hWndClient = m_view.Create(m_hWnd, rcDefault, _T("about:blank"), WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_HSCROLL | WS_VSCROLL, WS_EX_CLIENTEDGE); UIAddToolBar(hWndToolBar); UISetCheck(ID_VIEW_TOOLBAR, 1); UISetCheck(ID_VIEW_STATUS_BAR, 1); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); m_view.GoHome(); return 0; }
void MainFrameBase::SetupToolbar() { HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); AddSimpleReBarBand(hWndToolBar, NULL, TRUE); UIAddToolBar(hWndToolBar); UISetCheck(ID_VIEW_TOOLBAR, 1); }
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // create command bar window HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // attach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.LoadImages(IDR_MAINFRAME); // remove old menu SetMenu(NULL); HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(hWndToolBar, NULL, TRUE); CreateSimpleStatusBar(); m_hWndClient = m_splitter.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN); m_pane.SetPaneContainerExtendedStyle(PANECNT_NOBORDER); m_pane.Create(m_splitter, _T("Tree"), WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN); m_treeview.Create(m_pane, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS | TVS_SHOWSELALWAYS, WS_EX_CLIENTEDGE); m_pane.SetClient(m_treeview); m_view.Create(m_splitter, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE); m_splitter.SetSplitterPanes(m_pane, m_view); UpdateLayout(); m_splitter.SetSplitterPos(300); UIAddToolBar(hWndToolBar); UISetCheck(ID_VIEW_TOOLBAR, 1); UISetCheck(ID_VIEW_STATUS_BAR, 1); UISetCheck(ID_VIEW_TREEPANE, 1); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); return 0; }
LRESULT CMainFrame::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { CRect rect; AtlAxWinInit(); // create command bar window HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // atach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.LoadImages(IDR_MAINFRAME); // remove old menu SetMenu(NULL); HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); CreateSimpleReBar(ATL_SIMPLE_REBAR_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(hWndToolBar, NULL, TRUE); CreateSimpleStatusBar(); m_sbar.SubclassWindow(m_hWndStatusBar); m_sbar.SetPanes(arrParts, sizeof(arrParts) / sizeof(int), false); GetClientRect(&rect); m_hWndClient = m_wndScriptEidor.Create(m_hWnd, rect, _T(""), WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); m_spScriptEditor.CoCreateInstance(CLSID_CxScriptEditor); CComPtr<IAxWinHostWindow> spContainer; m_wndScriptEidor.QueryHost(&spContainer); // Attach the browser control to the container spContainer->AttachControl(m_spScriptEditor, m_wndScriptEidor); DispEventAdvise(m_spScriptEditor); UIAddToolBar(hWndToolBar); UISetCheck(ID_VIEW_SYMBOL, 1); return 0; }
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // create command bar window HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // attach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.LoadImages(IDR_MAINFRAME); // remove old menu SetMenu(NULL); HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(hWndToolBar, NULL, TRUE); CreateSimpleStatusBar(); CReBarCtrl bar = m_hWndToolBar; int nBandIndex = bar.IdToIndex(ATL_IDW_BAND_FIRST + 1); // toolbar is 2nd added band bar.ShowBand(nBandIndex, FALSE); ::ShowWindow(m_hWndStatusBar, SW_HIDE); UpdateLayout(); m_hWndClient = m_view.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE); UIAddToolBar(hWndToolBar); UISetCheck(ID_VIEW_TOOLBAR, 0); UISetCheck(ID_VIEW_STATUS_BAR, 0); UISetCheck(ID_VIEW_SHOWBALLVECTORS, m_simcontrol.GetShowVectors()); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); m_simcontrol.SetView(&m_view); m_simcontrol.Init(); SetTimer(TIMER_FRAME, 10); return 0; }
void MainFrameBase::SetupCmdbar() { HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); m_CmdBar.AttachMenu(GetMenu()); m_CmdBar.LoadImages(IDR_MAINFRAME); SetMenu(NULL); AddSimpleReBarBand(hWndCmdBar); }
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { m_pView = new CDispView(); m_pParameterDialog = new CParameterDialog(); m_pParameterDialog->Create(m_hWnd, rcDefault); CRect rec; GetWindowRect(rec); m_pParameterDialog->CenterWindow(m_hWnd); m_pParameterDialog->m_onParameterChangeDelegate.bind(this, &CMainFrame::onParameterChange); // create command bar window HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // attach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.LoadImages(IDR_MAINFRAME); // remove old menu SetMenu(NULL); HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(hWndToolBar, NULL, TRUE); CreateSimpleStatusBar(); m_hWndClient = m_pView->Create(m_hWnd); UIAddToolBar(hWndToolBar); UISetCheck(ID_VIEW_TOOLBAR, 1); UISetCheck(ID_VIEW_STATUS_BAR, 1); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); ::DragAcceptFiles(m_hWnd, TRUE); return 0; }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { g_pMainFrame = this; // create command bar window HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // attach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.LoadImages(IDR_MAINFRAME); // remove old menu SetMenu(NULL); HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(hWndToolBar, NULL, TRUE); //CreateSimpleStatusBar(); int anPanes[] = { ID_DEFAULT_PANE, ID_PANE_TILE_GRID };//, IDPANE_STATUS, IDPANE_CAPS_INDICATOR }; m_hWndStatusBar = m_wndStatusBar.Create ( *this ); UIAddStatusBar ( m_hWndStatusBar ); m_wndStatusBar.SetPanes(anPanes, _countof(anPanes), false); CreateMDIClient(); m_CmdBar.SetMDIClient(m_hWndMDIClient); UIAddToolBar(hWndToolBar); UISetCheck(ID_VIEW_TOOLBAR, 1); UISetCheck(ID_VIEW_STATUS_BAR, 1); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); return 0; }
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // create command bar window RECT rcCmdBar = {0, 0, 100, 100}; HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcCmdBar, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // attach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.LoadImages(IDR_MAINFRAME); // remove old menu SetMenu(NULL); HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(hWndToolBar, NULL, TRUE); CreateSimpleStatusBar(); // Add toolbars and stuff UIAddToolBar(m_CmdBar); UISetCheck(ID_VIEW_TOOLBAR, 1); UISetCheck(ID_VIEW_STATUS_BAR, 1); UpdateLayout(); RECT ClientRect; GetClientRect(&ClientRect); // Set the button parameters. You must set these before you create the navwindow. If you don't, don't expect it to work ;) m_navwindow.SetButtonHeight(31); // The button height is the height of the big buttons and the command bar m_navwindow.SetSmallButtonWidth(24); // The small button width is the width of the little buttons on the command bar. // Drop in our control. m_hWndClient = m_navwindow.Create(m_hWnd, ClientRect, L"Nav_Main", WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN); m_navwindow.SetPopBack(150); // Set the distance from the top of the client rect of the window where the buttons start popping back. // If not set or set to 0, the buttons will pop back when the buttons are pushed past the top of the window. // For the sake of example, there is only one sample window for all the buttons. // If you want a different window for each button (you probably do), // you will want a different line and class for each window in your Mainframe. // As these are for example, the following two lines and the for loop are to be erased and replaced with whatever you want. button_view.resize(9); button_view_top.resize(9); for (size_t view_increment = 0; view_increment < button_view.size(); view_increment++) { button_view[view_increment].Create(m_navwindow, rcDefault, L"Right Window", WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN); button_view_top[view_increment].Create(m_navwindow.m_HorizontalSplitter, rcDefault, L"Top Window", WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN); std::wostringstream vertical_caption; vertical_caption << L"Vertical " << view_increment; button_view[view_increment].window_caption = vertical_caption.str(); button_view[view_increment].is_horizontal = false; std::wostringstream horizontal_caption; horizontal_caption << L"Horizontal " << view_increment; button_view_top[view_increment].window_caption = horizontal_caption.str(); button_view_top[view_increment].is_horizontal = true; button_view_top[view_increment].pop_back_amount = m_navwindow.m_HorizontalSplitter.pop_back_y; } // Don't erase anything past here...it contains the rest of the parameters needed ;) // Set the button font. m_navwindow.SetButtonFont(L"Arial", 8, FontStyleBold); // Add all of our buttons to our button view. Use a for loop if you have the necessary arrays of strings. m_navwindow.AddButtonWithView(L"Print", L"RolloutIcons\\Print_2.tif", L"RolloutIcons\\Print_2_Small.tif", button_view[0], button_view_top[0]); m_navwindow.AddButtonWithView(L"Add", L"RolloutIcons\\Add_2.tif", L"RolloutIcons\\Add_2_Small.tif", button_view[1], button_view_top[1]); m_navwindow.AddButtonWithView(L"Edit", L"RolloutIcons\\Edit_2.tif", L"RolloutIcons\\Edit_2_Small.tif", button_view[2], button_view_top[2]); m_navwindow.AddButtonWithView(L"Delete", L"RolloutIcons\\Delete_2.tif", L"RolloutIcons\\Delete_2_Small.tif", button_view[3], button_view_top[3]); m_navwindow.AddButtonWithView(L"Search", L"RolloutIcons\\Search_2.tif", L"RolloutIcons\\Search_2_Small.tif", button_view[4], button_view_top[4]); m_navwindow.AddButtonWithView(L"Back", L"RolloutIcons\\Back_2.tif", L"RolloutIcons\\Back_2_Small.tif", button_view[5], button_view_top[5]); m_navwindow.AddButtonWithView(L"Forward", L"RolloutIcons\\Forward_2.tif", L"RolloutIcons\\Forward_2_Small.tif", button_view[6], button_view_top[6]); m_navwindow.AddButtonWithView(L"Save", L"RolloutIcons\\Save_2.tif", L"RolloutIcons\\Save_2_Small.tif", button_view[7], button_view_top[7]); m_navwindow.AddButtonWithView(L"Exit", L"RolloutIcons\\Exit_2.tif", L"RolloutIcons\\Exit_2_Small.tif", button_view[8], button_view_top[8]); m_navwindow.SetSplitterPos(242); // Set this to be where the vertical splitter will be located on your window. m_navwindow.SetDefaultButtons(5); // Set this to be 1 higher than the buttons you want to show initially. If none at all, put 1. If not even the command bar, put 0. return 0; }
LRESULT CMainFrame::OnCreate(LPCREATESTRUCT /*lParam*/) { // // create command bar window // HWND hWndCmdBar = m_CmdBar.Create( m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // attach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.SetImageSize(CSize(9,9)); // m_CmdBar.LoadImages(IDR_MAINFRAME); // remove old menu SetMenu(NULL); // set title CString strTitle; strTitle.LoadString( IDS_APPLICATION ); SetWindowText(strTitle); // // setting up a tool bar // // patria: // // We are loading an empty tool bar. // If we directly load a tool bar using a bitmap which does not // match with windows system palette, the application may crash // in Windows 2000. // As an workaround, we just create a simple tool bar with // an empty bitmap and replace them later. // HWND hWndToolBar = CreateSimpleToolBarCtrl( m_hWnd, IDR_EMPTY_TOOLBAR, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE | TBSTYLE_LIST); m_wndToolBar.Attach( hWndToolBar ); m_wndToolBar.SetExtendedStyle( TBSTYLE_EX_MIXEDBUTTONS | TBSTYLE_EX_DRAWDDARROWS ); // // patria: // // Some bitmaps are distorted when used with TB_ADDBITMAP // which is sent from CreateSimpleToolBarCtrl when the bitmap is not true color. // This is the case with IO-DATA's tool bar image. // As an workaround, we can directly create a image list directly // and replace the image list of the tool bar, which corrects such misbehaviors. // { CImageList imageList; WORD wWidth = 32; // we are using 32 x 32 buttons imageList.CreateFromImage( IDR_MAINFRAME, wWidth, 1, CLR_DEFAULT, IMAGE_BITMAP, LR_CREATEDIBSECTION | LR_DEFAULTSIZE); m_wndToolBar.SetImageList(imageList); } TBBUTTON tbButton = { 0 }; TBBUTTONINFO tbButtonInfo = { 0 }; TBREPLACEBITMAP replaceBitmap = { 0 }; // Add strings to the tool bar m_wndToolBar.SetButtonStructSize(sizeof(TBBUTTON)); for ( int i=0; i < m_wndToolBar.GetButtonCount(); i++ ) { CString strCommand; m_wndToolBar.GetButton( i, &tbButton ); tbButtonInfo.cbSize = sizeof(TBBUTTONINFO); tbButtonInfo.dwMask = TBIF_STYLE; m_wndToolBar.GetButtonInfo( tbButton.idCommand, &tbButtonInfo ); tbButtonInfo.dwMask = TBIF_TEXT | TBIF_STYLE; strCommand.LoadString( tbButton.idCommand ); strCommand = strCommand.Right( strCommand.GetLength() - strCommand.Find('\n') - 1 ); tbButtonInfo.pszText = const_cast<LPTSTR>(static_cast<LPCTSTR>(strCommand)); tbButtonInfo.cchText = strCommand.GetLength(); tbButtonInfo.fsStyle |= BTNS_SHOWTEXT | BTNS_AUTOSIZE; m_wndToolBar.AddString( tbButton.idCommand ); m_wndToolBar.SetButtonInfo( tbButton.idCommand, &tbButtonInfo ); } #define ATL_CUSTOM_REBAR_STYLE \ ((ATL_SIMPLE_REBAR_STYLE & ~RBS_AUTOSIZE) | CCS_NODIVIDER) // // patria: reason to use ATL_CUSTOM_REBAR_STYLE // // ATL_SIMPLE_REBAR_STYLE (not a NO_BRODER style) has a problem // with theme-enabled Windows XP, // rendering some transparent lines above the rebar. // CreateSimpleReBar(ATL_CUSTOM_REBAR_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(m_wndToolBar.m_hWnd, NULL, TRUE); CReBarCtrl reBar = m_hWndToolBar; DWORD cBands = reBar.GetBandCount(); for (DWORD i = 0; i < cBands; ++i) { REBARBANDINFO rbi = {0}; rbi.cbSize = sizeof(REBARBANDINFO); rbi.fMask = RBBIM_STYLE; reBar.GetBandInfo(i, &rbi); rbi.fStyle |= RBBS_NOGRIPPER; reBar.SetBandInfo(i, &rbi); } // work on status bar, progress bar CreateSimpleStatusBar(); CRect rectPgs; ::GetClientRect(m_hWndStatusBar, &rectPgs); rectPgs.DeflateRect(1,2,1,2); rectPgs.right = 300; m_wndRefreshProgress.Create(m_hWndStatusBar, &rectPgs, NULL, WS_CHILD | WS_VISIBLE); m_wndRefreshProgress.SetRange32(0, 100); m_wndRefreshProgress.SetPos(50); m_wndRefreshProgress.ShowWindow(SW_HIDE); // // Comments from the author // (http://www.viksoe.dk/code/treelistview.htm) // // It is wise to add the TVS_DISABLEDRAGDROP and TVS_SHOWSELALWAYS // styles to the tree control for best result. // m_viewTreeList.Create( *this, rcDefault, NULL, WS_BORDER | WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | TVS_SHOWSELALWAYS | TVS_DISABLEDRAGDROP /* | TVS_HASLINES */ ); m_viewTreeList.Initialize(); m_viewTreeList.GetTreeControl().SetIndent(24); m_hWndClient = m_viewTreeList; UIAddToolBar(m_wndToolBar); UISetCheck(ID_VIEW_TOOLBAR, 1); UISetCheck(ID_VIEW_STATUS_BAR, 1); // TODO : It will be better if we display splash window while // the treeview is initialized PostMessage(WM_COMMAND, IDM_TOOL_REFRESH, 0); m_hEventCallback = ::NdasRegisterEventCallback(NdasEventCallback,m_hWnd); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); // FIXME : We need to remember the window size //CRect rectResize; //GetClientRect( rectResize ); //rectResize = CRect( rectResize.TopLeft(), CSize(500, 500) ); //ClientToScreen( rectResize ); //MoveWindow( rectResize ); //CenterWindow(); return 0; }
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { #ifndef BTNS_SHOWTEXT #define BTNS_SHOWTEXT 0x0040 #endif // set title WTL::CString strTitle; strTitle.LoadString( IDS_APPLICATION ); SetWindowText(strTitle); CreateSimpleStatusBar(); HWND hWndToolBar = CreateSimpleToolBarCtrl( m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_STYLE | BTNS_SHOWTEXT | TBSTYLE_LIST | TBSTYLE_FLAT | TBSTYLE_FLAT); TBBUTTON tbButton = { 0 }; TBBUTTONINFO tbButtonInfo = { 0 }; TBREPLACEBITMAP replaceBitmap = { 0 }; m_wndToolBar.Attach( hWndToolBar ); m_wndToolBar.SetExtendedStyle( TBSTYLE_EX_DRAWDDARROWS ); // Replace toolbar bitmap to display true color image replaceBitmap.hInstNew = _Module.GetResourceInstance(); replaceBitmap.hInstOld = _Module.GetResourceInstance(); replaceBitmap.nIDOld = IDR_MAINFRAME; replaceBitmap.nIDNew = IDB_MAINFRAME; replaceBitmap.nButtons = 4; m_wndToolBar.ReplaceBitmap( &replaceBitmap ); // Add strings to the toolbar m_wndToolBar.SetButtonStructSize(sizeof(TBBUTTON)); for ( int i=0; i < m_wndToolBar.GetButtonCount(); i++ ) { WTL::CString strCommand; m_wndToolBar.GetButton( i, &tbButton ); tbButtonInfo.cbSize = sizeof(TBBUTTONINFO); tbButtonInfo.dwMask = TBIF_STYLE; m_wndToolBar.GetButtonInfo( tbButton.idCommand, &tbButtonInfo ); tbButtonInfo.dwMask = TBIF_TEXT | TBIF_STYLE; strCommand.LoadString( tbButton.idCommand ); strCommand = strCommand.Right( strCommand.GetLength() - strCommand.Find('\n') - 1 ); tbButtonInfo.pszText = const_cast<LPTSTR>(static_cast<LPCTSTR>(strCommand)); tbButtonInfo.cchText = strCommand.GetLength(); tbButtonInfo.fsState |= BTNS_SHOWTEXT; m_wndToolBar.AddString( tbButton.idCommand ); m_wndToolBar.SetButtonInfo( tbButton.idCommand, &tbButtonInfo ); } // Modify mirror button as dropdown button m_wndToolBar.GetButton( m_wndToolBar.CommandToIndex(IDM_AGGR_MIRROR), &tbButton ); tbButtonInfo.cbSize = sizeof(TBBUTTONINFO); tbButtonInfo.dwMask = TBIF_STYLE; tbButtonInfo.fsStyle = tbButton.fsStyle | TBSTYLE_DROPDOWN; m_wndToolBar.SetButtonInfo( IDM_AGGR_MIRROR, &tbButtonInfo ); CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); AddSimpleReBarBand(m_wndToolBar); UIAddToolBar(m_wndToolBar); m_hWndClient = m_view.Create( m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TVS_HASLINES | /* TVS_LINESATROOT | */ TVS_SHOWSELALWAYS, WS_EX_CLIENTEDGE ); UISetCheck(ID_VIEW_TOOLBAR, 1); UISetCheck(ID_VIEW_STATUS_BAR, 1); // TODO : It will be better if we display splash window while // the treeview is initialized m_bRefreshing = FALSE; ::InitializeCriticalSection(&m_csThreadRefreshStatus); StartRefreshStatus(); m_hEventCallback = ::NdasRegisterEventCallback(pNdasEventProc,m_hWnd); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); // FIXME : We need to remember the window size CRect rectResize; GetClientRect( rectResize ); rectResize = CRect( rectResize.TopLeft(), CSize(500, 500) ); ClientToScreen( rectResize ); MoveWindow( rectResize ); CenterWindow(); return 0; }
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { // create command bar window HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // attach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.LoadImages(IDR_MAINFRAME); // remove old menu SetMenu(NULL); HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(hWndToolBar, NULL, TRUE); CreateSimpleStatusBar(); m_wndVertSplit.Create( *this, rcDefault, NULL, 0, WS_EX_CLIENTEDGE); m_view.Create(m_wndVertSplit, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE); m_TreeView.Create(m_wndVertSplit, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE); // this didn't work //m_TreeView.ModifyStyle(NULL, TVS_HASBUTTONS | TVS_HASLINES | TVS_TRACKSELECT | TVS_SINGLEEXPAND | TVS_SHOWSELALWAYS); LONG lStyle; lStyle = ::GetWindowLong(m_TreeView.m_hWnd, GWL_STYLE); lStyle |= (TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS | TVS_SHOWSELALWAYS | TVS_DISABLEDRAGDROP | TVS_TRACKSELECT); ::SetWindowLong(m_TreeView.m_hWnd, GWL_STYLE, lStyle); m_wndVertSplit.SetSplitterPanes ( m_TreeView, m_view ); m_wndVertSplit.SetSplitterExtendedStyle(SPLIT_PROPORTIONAL & SPLIT_RIGHTALIGNED); m_hWndClient = m_wndVertSplit; m_wndVertSplit.m_cxyMin = 150; m_wndVertSplit.m_cxySplitBar = 1; m_wndVertSplit.m_nDefActivePane = 0; m_wndVertSplit.m_cxyDragOffset = 0; UpdateLayout(); m_wndVertSplit.SetSplitterPos(150); //m_TreeView.SetBkColor(RGB(255, 255, 255)); //m_TreeView.SetLineColor(RGB(0, 0, 255)); //m_TreeView.SetTextColor(RGB(255, 255, 255)); //m_TreeView.SetLineColor(RGB(0, 0, 0)); m_TreeView.FillTree(_T("molecules")); UIAddToolBar(hWndToolBar); UISetCheck(ID_VIEW_TOOLBAR, 1); UISetCheck(ID_VIEW_STATUS_BAR, 1); UISetCheck(ID_VIEW_LINKS, 1); m_view.SetShowLinks(true); UISetCheck(ID_VIEW_LABELS, 0); m_view.SetShowLabels(false); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); bHandled = FALSE; // pass message to the chain return 0; }
LRESULT CMainFrame::OnCreate( LPCREATESTRUCT /*lpCreateStruct*/ ) { if ( FAILED( TtlCreateControl() ) ) { LPTSTR lpBuffer = _T("Unknown Error"); DWORD bFreeIt = ::FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM , NULL, TtlGetLastError(), 0, (LPTSTR) &lpBuffer, 0, NULL ); CString sz; sz.Format( _T("An error occured trying to get the TTLive interface.\n" "The error was:\n" "%s") , lpBuffer ); MessageBox( sz, _T("Error"), MB_OK | MB_ICONERROR ); if ( bFreeIt ) ::LocalFree( lpBuffer ); return -1; // fail OnCreate } TtlPnPRegister(); // wizard generated UI: HWND hWndCmdBar = m_CmdBar.Create( m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE ); m_CmdBar.AttachMenu( GetMenu() ); m_CmdBar.LoadImages( IDR_MAINFRAME ); SetMenu( NULL ); HWND hWndToolBar = CreateSimpleToolBarCtrl( m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE ); CreateSimpleReBar( ATL_SIMPLE_REBAR_NOBORDER_STYLE ); AddSimpleReBarBand( hWndCmdBar ); AddSimpleReBarBand( hWndToolBar, NULL, TRUE ); CreateSimpleStatusBar(); UIAddToolBar( hWndToolBar ); UISetCheck( ID_VIEW_TOOLBAR, 1 ); UISetCheck( ID_VIEW_STATUS_BAR, 1 ); CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT( pLoop != NULL ); pLoop->AddMessageFilter( this ); pLoop->AddIdleHandler( this ); // create remainder of UI: m_hWndClient = m_wndVSplitter.Create( *this, rcDefault, NULL , WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS ); m_wndGraphs.Create( m_wndVSplitter, rcDefault, NULL , WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS , WS_EX_CLIENTEDGE ); m_wndConfig.Create( m_wndVSplitter, _T("Explorer") , WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS ); m_wndVSplitter.SetSplitterPanes( m_wndConfig, m_wndGraphs ); m_wndVSplitter.m_nProportionalPos = m_wndVSplitter.m_nPropMax / 3; UISetBlockAccelerators( true ); UISetCheck( ID_OPTIONS_KEEPEXISTING , m_bKeepExisting ); UISetCheck( ID_OPTIONS_AUTODETECT , m_bAutoDetect ); UISetCheck( ID_OPTIONS_FORCEPROTOCOL , m_bForceProtocol ); UISetCheck( ID_OPTIONS_FILLGAPS , m_bFillGaps ); UISetCheck( ID_OPTIONS_AUTOSETUP , m_bAutoSetup ); UISetCheck( ID_OPTIONS_FORCEALL , m_bForceAll ); UISetCheck( ID_OPTIONS_DISACTIVATE , m_bDisactivate ); UISetCheck( ID_OPTIONS_SETSENSORTYPE , m_bSetSensorType ); UISetCheck( ID_OPTIONS_SHORTREADS , m_bShortReads ); UISetCheck( ID_OPTIONS_SYNCHRONIZE , m_bSynchronize ); UISetCheck( ID_OPTIONS_SYNCH_INTERNAL, m_bSynchInternal ); UISetCheck( ID_OPTIONS_SYNCH_PERIODIC, m_bSynchPeriodic ); UISetCheck( ID_DAC_RECORD , m_bRecord ); UISetCheck( m_idUnitType, true ); UISetCheck( m_idFilter, true ); #ifdef USE_TTLLIVE_2 // all options available #else UIEnable( ID_OPTIONS_FILLGAPS , false ); UIEnable( ID_OPTIONS_SHORTREADS , false ); UIEnable( ID_OPTIONS_SYNCHRONIZE , false ); UIEnable( ID_OPTIONS_SYNCH_INTERNAL, false ); UIEnable( ID_OPTIONS_SYNCH_PERIODIC, false ); #endif UIUpdate(); SetMsgHandled( false ); return 0; }
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // create command bar window HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // attach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.LoadImages(IDR_MAINFRAME); // remove old menu SetMenu(NULL); HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(hWndToolBar, NULL, TRUE); CreateSimpleStatusBar(); m_hWndClient = m_splitter.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN); m_pane.SetPaneContainerExtendedStyle(PANECNT_NOBORDER); m_pane.Create(m_splitter, _T("Workspace"), WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN); m_Workspace.Create(m_pane, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN , WS_EX_CLIENTEDGE); m_Workspace.SetFont(AtlGetDefaultGuiFont()); m_pane.SetClient(m_Workspace); /* m_Editspace.Create(m_splitter, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE); m_Editspace.SetFont(AtlGetDefaultGuiFont()); m_Editspace.SetTitleBarWindow(m_hWnd); m_splitter.SetSplitterPanes(m_pane, m_Editspace); */ m_Documents.Create(m_splitter, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE); m_Documents.SetFont(AtlGetDefaultGuiFont()); m_Documents.SetTitleBarWindow(m_hWnd); m_splitter.SetSplitterPanes(m_pane, m_Documents); UpdateLayout(); m_splitter.SetSplitterPosPct(25); UIAddToolBar(hWndToolBar); UISetCheck(ID_VIEW_TOOLBAR, 1); UISetCheck(ID_VIEW_STATUS_BAR, 1); UISetCheck(ID_VIEW_TREEPANE, 1); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); CMenuHandle menuMain = m_CmdBar.GetMenu(); // m_Editspace.SetWindowMenu(menuMain.GetSubMenu(WINDOW_MENU_POSITION)); m_Documents.SetWindowMenu(menuMain.GetSubMenu(WINDOW_MENU_POSITION)); //drag files DragAcceptFiles(TRUE); m_PluginManager.LoadPlugins(GetModulePath(_Module.m_hInst)+_T("\\plugins")); m_PluginManager.ConnectionAll(this,NULL); // FireWorkspaceNew(_T("Undefine Workspace")); // this->m_Solution.Open(_T("Undefine")); // this->m_Solution.m_projs.AddProject(_T("Undefine")); this->m_Solution.Create(_T("Undefine")); return 0; }
/* void SetPaneWidths(int* arrWidths, int nPanes) { // find the size of the borders int arrBorders[3]; m_status.GetBorders(arrBorders); // calculate right edge of default pane (0) arrWidths[0] += arrBorders[2]; for (int i = 1; i < nPanes; i++) arrWidths[0] += arrWidths[i]; // calculate right edge of remaining panes (1 thru nPanes-1) for (int j = 1; j < nPanes; j++) arrWidths[j] += arrBorders[2] + arrWidths[j - 1]; // set the pane widths m_status.SetParts(m_status.m_nPanes, arrWidths); } */ LRESULT CMainFrame::OnCreate(LPCREATESTRUCT /*lParam*/) { // // create command bar window // HWND hWndCmdBar = m_CmdBar.Create( m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // attach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.SetImageSize(CSize(9,9)); // m_CmdBar.LoadImages(IDR_MAINFRAME); // remove old menu SetMenu(NULL); // set title WTL::CString strTitle; strTitle.LoadString( IDS_APPLICATION ); SetWindowText(strTitle); // // setting up a tool bar // HWND hWndToolBar = CreateSimpleToolBarCtrl( m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE | TBSTYLE_LIST); m_wndToolBar.Attach( hWndToolBar ); m_wndToolBar.SetExtendedStyle( TBSTYLE_EX_MIXEDBUTTONS | TBSTYLE_EX_DRAWDDARROWS ); // // patria: // // Some bitmaps are distorted when used with TB_ADDBITMAP // which is sent from CreateSimpleToolBarCtrl when the bitmap is not true color. // This is the case with IO-DATA's tool bar image. // As an workaround, we can directly create a image list directly // and replace the image list of the tool bar, which corrects such misbehaviors. // { CImageList imageList; WORD wWidth = 32; // we are using 32 x 32 buttons imageList.CreateFromImage( IDR_MAINFRAME, wWidth, 1, CLR_DEFAULT, IMAGE_BITMAP, LR_CREATEDIBSECTION | LR_DEFAULTSIZE); m_wndToolBar.SetImageList(imageList); } TBBUTTON tbButton = { 0 }; TBBUTTONINFO tbButtonInfo = { 0 }; TBREPLACEBITMAP replaceBitmap = { 0 }; // Add strings to the tool bar m_wndToolBar.SetButtonStructSize(sizeof(TBBUTTON)); for ( int i=0; i < m_wndToolBar.GetButtonCount(); i++ ) { WTL::CString strCommand; m_wndToolBar.GetButton( i, &tbButton ); tbButtonInfo.cbSize = sizeof(TBBUTTONINFO); tbButtonInfo.dwMask = TBIF_STYLE; m_wndToolBar.GetButtonInfo( tbButton.idCommand, &tbButtonInfo ); tbButtonInfo.dwMask = TBIF_TEXT | TBIF_STYLE; strCommand.LoadString( tbButton.idCommand ); strCommand = strCommand.Right( strCommand.GetLength() - strCommand.Find('\n') - 1 ); tbButtonInfo.pszText = const_cast<LPTSTR>(static_cast<LPCTSTR>(strCommand)); tbButtonInfo.cchText = strCommand.GetLength(); tbButtonInfo.fsStyle |= BTNS_SHOWTEXT | BTNS_AUTOSIZE; m_wndToolBar.AddString( tbButton.idCommand ); m_wndToolBar.SetButtonInfo( tbButton.idCommand, &tbButtonInfo ); } // // Modify mirror button as drop down button // { TBBUTTON tb; m_wndToolBar.GetButton( m_wndToolBar.CommandToIndex(IDM_AGGR_MIRROR), &tb); TBBUTTONINFO tbi = {0}; tbi.cbSize = sizeof(TBBUTTONINFO); tbi.dwMask = TBIF_STYLE; m_wndToolBar.GetButtonInfo(IDM_AGGR_MIRROR, &tbi); tbi.fsStyle |= TBSTYLE_DROPDOWN; m_wndToolBar.SetButtonInfo( IDM_AGGR_MIRROR, &tbi); } #define ATL_CUSTOM_REBAR_STYLE \ ((ATL_SIMPLE_REBAR_STYLE & ~RBS_AUTOSIZE) | CCS_NODIVIDER) // // patria: reason to use ATL_CUSTOM_REBAR_STYLE // // ATL_SIMPLE_REBAR_STYLE (not a NO_BRODER style) has a problem // with theme-enabled Windows XP, // rendering some transparent lines above the rebar. // CreateSimpleReBar(ATL_CUSTOM_REBAR_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(m_wndToolBar.m_hWnd, NULL, TRUE); CReBarCtrl reBar = m_hWndToolBar; DWORD cBands = reBar.GetBandCount(); for (DWORD i = 0; i < cBands; ++i) { REBARBANDINFO rbi = {0}; rbi.cbSize = sizeof(REBARBANDINFO); rbi.fMask = RBBIM_STYLE; reBar.GetBandInfo(i, &rbi); rbi.fStyle |= RBBS_NOGRIPPER; reBar.SetBandInfo(i, &rbi); } // work on status bar, progress bar CreateSimpleStatusBar(); // m_wndStatusBar.SubclassWindow(m_hWndStatusBar); RECT rectRefreshProgress; /* #define ID_PANE_REFRESH_STATUS 1 int anPanes[] = {ID_DEFAULT_PANE, ID_PANE_REFRESH_STATUS}; m_wndStatusBar.SetPanes(anPanes, sizeof(anPanes) / sizeof(int), false); int anWidths[] = {400, -1}; m_wndStatusBar.SetParts(sizeof(anWidths) / sizeof(int), anWidths); m_wndStatusBar.GetPaneRect(ID_DEFAULT_PANE, &rectRefreshProgress); m_wndStatusBar.GetPaneRect(ID_PANE_REFRESH_STATUS, &rectRefreshProgress); */ // m_wndStatusBar.GetWindowRect(&rectRefreshProgress); ::GetClientRect(m_hWndStatusBar, &rectRefreshProgress); rectRefreshProgress.right = 300; m_wndRefreshProgress.Create(m_hWndStatusBar, &rectRefreshProgress, NULL, WS_CHILD | WS_VISIBLE); m_wndRefreshProgress.SetRange32(0, 100); m_wndRefreshProgress.SetPos(50); m_wndRefreshProgress.ShowWindow(SW_HIDE); /* m_wndStatusBar.SetPaneText(ID_DEFAULT_PANE, _T("text1")); m_wndStatusBar.SetPaneText(ID_PANE_REFRESH_STATUS, _T("text2")); */ m_wndHorzSplit.Create(*this, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); m_viewTree.Create( m_wndHorzSplit, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TVS_HASLINES | /* TVS_LINESATROOT | */ TVS_SHOWSELALWAYS, WS_EX_CLIENTEDGE ); m_viewList.Create( m_wndHorzSplit, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | LVS_ICON | LVS_REPORT | LVS_SINGLESEL | LVS_NOSORTHEADER | LVS_SHOWSELALWAYS, WS_EX_CLIENTEDGE ); m_viewList.Initialize(); m_wndHorzSplit.SetSplitterPanes(m_viewList, m_viewTree); m_wndHorzSplit.m_cxyMin = 130; m_viewTreeList.Create( *this, rcDefault, NULL, WS_BORDER | WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); m_viewTreeList.Initialize(); // m_viewTreeList._Init(); // m_viewTreeList.SubclassWindow(m_hWnd); m_hWndClient = m_wndHorzSplit; m_hWndClient = m_viewTreeList; UIAddToolBar(m_wndToolBar); UISetCheck(ID_VIEW_TOOLBAR, 1); UISetCheck(ID_VIEW_STATUS_BAR, 1); // TODO : It will be better if we display splash window while // the treeview is initialized m_bRefreshing = FALSE; ::InitializeCriticalSection(&m_csThreadRefreshStatus); // StartRefreshStatus(); // PostMessage(WM_COMMAND, IDM_AGGR_REFRESH, 0); m_hEventCallback = ::NdasRegisterEventCallback(pNdasEventProc,m_hWnd); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); // FIXME : We need to remember the window size CRect rectResize; GetClientRect( rectResize ); rectResize = CRect( rectResize.TopLeft(), CSize(500, 500) ); ClientToScreen( rectResize ); MoveWindow( rectResize ); CenterWindow(); return 0; }
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // Check if Common Controls 6.0 are used. If yes, use 32-bit (alpha) images // for the toolbar and command bar. If not, use the old, 4-bit images. UINT uResID = IDR_MAINFRAME_OLD; DWORD dwMajor = 0; DWORD dwMinor = 0; HRESULT hRet = AtlGetCommCtrlVersion(&dwMajor, &dwMinor); if(SUCCEEDED(hRet) && dwMajor >= 6) uResID = IDR_MAINFRAME; // Set values to be displayed in the view window m_view.m_dwCommCtrlMajor = dwMajor; m_view.m_dwCommCtrlMinor = dwMinor; m_view.m_bAlpha = (uResID == IDR_MAINFRAME); // create command bar window HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // attach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.LoadImages(uResID); // remove old menu SetMenu(NULL); HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, uResID, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(hWndToolBar, NULL, TRUE); CreateSimpleStatusBar(); // //m_hWndClient = m_view.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE); { m_hWndClient = m_wndSplitter.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN); HWND hWndFolderTree = m_wndFolderTree.Create(m_wndSplitter, _T("Folders"), WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN); RECT rc = { 50, 0, 300, 100 }; m_wndCombo.Create(hWndFolderTree, rc, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBS_DROPDOWN | CBS_AUTOHSCROLL); m_wndTreeView.Create(m_wndFolderTree, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS | TVS_SHOWSELALWAYS, WS_EX_CLIENTEDGE); m_wndFolderTree.SetClient(m_wndTreeView); m_wndListView.Create(m_wndSplitter, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | LVS_REPORT | LVS_AUTOARRANGE | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS, WS_EX_CLIENTEDGE); m_wndListView.SetExtendedListViewStyle(LVS_EX_TRACKSELECT | LVS_EX_ONECLICKACTIVATE | LVS_EX_UNDERLINEHOT); InitViews(); UpdateLayout(); m_wndSplitter.SetSplitterPanes(m_wndFolderTree, m_wndListView); RECT rect; GetClientRect(&rect); m_wndSplitter.SetSplitterPos((rect.right - rect.left) / 4); } UIAddToolBar(hWndToolBar); UISetCheck(ID_VIEW_TOOLBAR, 1); UISetCheck(ID_VIEW_STATUS_BAR, 1); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); UIEnable(ID_EDIT_PASTE, FALSE); // _canvas = NULL; //_canvas = new Canvas(m_hWndClient); //_canvas = new Canvas(m_hWndClient); // return 0; }