Explorer frame window base class. More...
#include <mainframe.h>
Public Types | |
typedef PreTranslateWindow | super |
Public Member Functions | |
MainFrameBase (HWND hwnd) | |
~MainFrameBase () | |
Static Public Member Functions | |
static HWND | Create (const ExplorerCmd &cmd) |
static int | OpenShellFolders (LPIDA pida, HWND hFrameWnd) |
Public Attributes | |
WindowHandle | _hwndrebar |
WindowHandle | _htoolbar |
WindowHandle | _hstatusbar |
WindowHandle | _haddressedit |
WindowHandle | _hcommandedit |
WindowHandle | _hsidebar |
HIMAGELIST | _himl |
HMENU | _hMenuFrame |
HMENU | _hMenuWindow |
MenuInfo | _menu_info |
Protected Member Functions | |
LRESULT | WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam) |
bool | ProcessMessage (UINT nmsg, WPARAM wparam, LPARAM lparam, LRESULT *pres) |
int | Command (int id, int code) |
int | Notify (int id, NMHDR *pnmh) |
virtual BOOL | TranslateMsg (MSG *pmsg) |
void | toggle_child (HWND hwnd, UINT cmd, HWND hchild, int band_idx=-1) |
void | resize_frame_client () |
virtual void | resize_frame (int cx, int cy) |
virtual void | frame_get_clientspace (PRECT prect) |
BOOL | toggle_fullscreen () |
void | fullscreen_move () |
void | FillBookmarks () |
virtual bool | go_to (LPCTSTR url, bool new_window) |
void | ExecuteCommandbar (LPCTSTR dir) |
Protected Attributes | |
FullScreenParameters | _fullscreen |
HACCEL | _hAccel |
HIMAGELIST | _himl_old |
Explorer frame window base class.
Definition at line 41 of file mainframe.h.
Reimplemented from PreTranslateWindow.
Reimplemented in MDIMainFrame, SDIMainFrame, ShellBrowserChildT< MainFrameBase >, and ExtContextMenuHandlerT< ShellBrowserChildT< MainFrameBase > >.
Definition at line 43 of file mainframe.h.
MainFrameBase::MainFrameBase | ( | HWND | hwnd ) |
Definition at line 152 of file mainframe.cpp.
References _hAccel, _haddressedit, _hcommandedit, _himl, _himl_old, ExplorerGlobals::_hInstance, _hMenuFrame, MenuInfo::_hMenuView, _hMenuWindow, _hsidebar, _hstatusbar, _htoolbar, WindowHandle::_hwnd, _hwndrebar, _menu_info, g_Globals, ID_GO_BACK, ID_GO_FORWARD, ID_GO_HOME, ID_GO_SEARCH, ID_GO_UP, ID_REFRESH, ID_STOP, ID_VIEW_SIDE_BAR, ID_VIEW_STATUSBAR, ID_VIEW_TOOL_BAR, IDA_EXPLORER, IDB_TOOLBAR, IDW_ADDRESSBAR, IDW_COMMANDBAR, IDW_SIDEBAR, IDW_STATUSBAR, IDW_TOOLBAR, RBBS_HIDETITLE, and TEXT.
: super(hwnd) { _himl = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_MASK|ILC_COLOR24, 2, 0); _hMenuFrame = GetMenu(hwnd); _hMenuWindow = GetSubMenu(_hMenuFrame, GetMenuItemCount(_hMenuFrame)-3); _menu_info._hMenuView = GetSubMenu(_hMenuFrame, 1); _hAccel = LoadAccelerators(g_Globals._hInstance, MAKEINTRESOURCE(IDA_EXPLORER)); TBBUTTON toolbarBtns[] = { #ifdef _NO_REBAR {0, 0, 0, BTNS_SEP, {0, 0}, 0, 0}, #endif {7, ID_GO_BACK, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0}, {8, ID_GO_FORWARD, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0}, {9, ID_GO_UP, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0}, {10, ID_GO_HOME, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0}, {11, ID_GO_SEARCH, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0}, {12, ID_REFRESH, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0}, {13, ID_STOP, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0} }; _htoolbar = CreateToolbarEx(hwnd, #ifndef _NO_REBAR CCS_NOPARENTALIGN|CCS_NORESIZE|CCS_NODIVIDER| #endif WS_CHILD|TBSTYLE_FLAT|WS_VISIBLE, IDW_TOOLBAR, 2, g_Globals._hInstance, IDB_TOOLBAR, toolbarBtns, sizeof(toolbarBtns)/sizeof(TBBUTTON), 16, 15, 16, 15, sizeof(TBBUTTON)); CheckMenuItem(_menu_info._hMenuView, ID_VIEW_TOOL_BAR, MF_BYCOMMAND|MF_CHECKED); // address & command bar WindowCanvas canvas(hwnd); RECT rect = {0, 0, 0, 0}; DrawText(canvas, TEXT("My"), -1, &rect, DT_SINGLELINE|DT_NOPREFIX|DT_CALCRECT); HFONT hfont = GetStockFont(DEFAULT_GUI_FONT); _haddressedit = CreateWindow(TEXT("EDIT"), NULL, WS_CHILD|WS_VISIBLE, 0, 0, 0, rect.bottom, hwnd, (HMENU)IDW_ADDRESSBAR, g_Globals._hInstance, 0); SetWindowFont(_haddressedit, hfont, FALSE); new EditController(_haddressedit); _hcommandedit = CreateWindow(TEXT("EDIT"), TEXT("> "), WS_CHILD|WS_VISIBLE, 0, 0, 0, rect.bottom, hwnd, (HMENU)IDW_COMMANDBAR, g_Globals._hInstance, 0); SetWindowFont(_hcommandedit, hfont, FALSE); new EditController(_hcommandedit); /* CreateStatusWindow does not accept WS_BORDER _hstatusbar = CreateWindowEx(WS_EX_NOPARENTNOTIFY, STATUSCLASSNAME, 0, WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_BORDER|CCS_NODIVIDER, 0,0,0,0, hwnd, (HMENU)IDW_STATUSBAR, g_Globals._hInstance, 0);*/ _hstatusbar = CreateStatusWindow(WS_CHILD|WS_VISIBLE, 0, hwnd, IDW_STATUSBAR); CheckMenuItem(_menu_info._hMenuView, ID_VIEW_STATUSBAR, MF_BYCOMMAND|MF_CHECKED); _hsidebar = CreateWindowEx(WS_EX_STATICEDGE, WC_TREEVIEW, TEXT("Sidebar"), WS_CHILD|WS_TABSTOP|WS_BORDER|/*WS_VISIBLE|*/WS_CHILD|TVS_HASLINES|TVS_HASBUTTONS|TVS_SHOWSELALWAYS|TVS_INFOTIP, -1, -1, 200, 0, _hwnd, (HMENU)IDW_SIDEBAR, g_Globals._hInstance, 0); _himl_old = TreeView_SetImageList(_hsidebar, _himl, TVSIL_NORMAL); CheckMenuItem(_menu_info._hMenuView, ID_VIEW_SIDE_BAR, MF_BYCOMMAND|MF_UNCHECKED/*MF_CHECKED*/); // create rebar window to manage toolbar and drivebar #ifndef _NO_REBAR _hwndrebar = CreateWindowEx(WS_EX_TOOLWINDOW, REBARCLASSNAME, NULL, WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN| RBS_VARHEIGHT|RBS_DBLCLKTOGGLE| WS_BORDER|RBS_AUTOSIZE|RBS_BANDBORDERS, 0, 0, 0, 0, _hwnd, 0, g_Globals._hInstance, 0); int btn_hgt = HIWORD(SendMessage(_htoolbar, TB_GETBUTTONSIZE, 0, 0)); REBARBANDINFO rbBand; rbBand.cbSize = sizeof(REBARBANDINFO); rbBand.fMask = RBBIM_TEXT|RBBIM_STYLE|RBBIM_CHILD|RBBIM_CHILDSIZE|RBBIM_SIZE; #ifndef RBBS_HIDETITLE // missing in MinGW headers as of 25.02.2004 #define RBBS_HIDETITLE 0x400 #endif rbBand.fStyle = RBBS_CHILDEDGE|RBBS_GRIPPERALWAYS|RBBS_HIDETITLE; rbBand.cxMinChild = 0; rbBand.cyMinChild = 0; rbBand.cyChild = 0; rbBand.cyMaxChild = 0; rbBand.cyIntegral = btn_hgt; rbBand.lpText = NULL;//TEXT("Toolbar"); rbBand.hwndChild = _htoolbar; rbBand.cxMinChild = 0; rbBand.cyMinChild = btn_hgt; rbBand.cx = 284; SendMessage(_hwndrebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand); #endif }
MainFrameBase::~MainFrameBase | ( | ) |
Definition at line 257 of file mainframe.cpp.
References ExplorerGlobals::_desktop_mode, _himl, _himl_old, ExplorerGlobals::_hMainWnd, _hsidebar, WindowHandle::_hwnd, and g_Globals.
int MainFrameBase::Command | ( | int | id, |
int | code | ||
) | [protected, virtual] |
Reimplemented from Window.
Reimplemented in MDIMainFrame, and SDIMainFrame.
Definition at line 360 of file mainframe.cpp.
References _haddressedit, ExplorerGlobals::_hInstance, MenuInfo::_hMenuView, _hsidebar, _hstatusbar, _htoolbar, WindowHandle::_hwnd, _menu_info, BUFFER_LEN, CONTEXT, display_error(), Dialog::DoModal(), ExecuteCommandbar(), explorer_about(), FillBookmarks(), g_Globals, go_to(), ID_ABOUT_EXPLORER, ID_ABOUT_WINDOWS, ID_EXECUTE, ID_EXPLORER_FAQ, ID_FILE_EXIT, ID_HELP, ID_TOOLS_OPTIONS, ID_VIEW_FULLSCREEN, ID_VIEW_SIDE_BAR, ID_VIEW_STATUSBAR, ID_VIEW_TOOL_BAR, IDD_EXECUTE, IDD_MDI_SDI, IDS_TITLE, IDW_ADDRESSBAR, IDW_COMMANDBAR, launch_file(), TEXT, toggle_child(), toggle_fullscreen(), WINDOW_CREATOR, and ExecuteDialog::WndProc().
Referenced by SDIMainFrame::Command(), and MDIMainFrame::Command().
{ CONTEXT("MainFrameBase::Command()"); switch(id) { case ID_FILE_EXIT: SendMessage(_hwnd, WM_CLOSE, 0, 0); break; case ID_VIEW_TOOL_BAR: toggle_child(_hwnd, id, _htoolbar, 0); break; case ID_VIEW_STATUSBAR: toggle_child(_hwnd, id, _hstatusbar); break; case ID_VIEW_SIDE_BAR: // lazy initialization if (!TreeView_GetCount(_hsidebar)) FillBookmarks(); toggle_child(_hwnd, id, _hsidebar); break; case ID_EXECUTE: { ExecuteDialog dlg = {{0}, 0}; if (DialogBoxParam(g_Globals._hInstance, MAKEINTRESOURCE(IDD_EXECUTE), _hwnd, ExecuteDialog::WndProc, (LPARAM)&dlg) == IDOK) { CONTEXT("ID_EXECUTE - ShellExecute()"); HINSTANCE hinst = ShellExecute(_hwnd, NULL/*operation*/, dlg.cmd/*file*/, NULL/*parameters*/, NULL/*dir*/, dlg.cmdshow); if ((int)hinst <= 32) display_error(_hwnd, GetLastError()); } break;} case ID_HELP: WinHelp(_hwnd, TEXT("explorer")/*file explorer.hlp*/, HELP_INDEX, 0); break; case ID_VIEW_FULLSCREEN: CheckMenuItem(_menu_info._hMenuView, id, toggle_fullscreen()?MF_CHECKED:0); break; case ID_TOOLS_OPTIONS: Dialog::DoModal(IDD_MDI_SDI, WINDOW_CREATOR(MdiSdiDlg), _hwnd); break; case ID_ABOUT_WINDOWS: ShellAbout(_hwnd, ResString(IDS_TITLE), NULL, 0); break; case ID_ABOUT_EXPLORER: explorer_about(_hwnd); break; case ID_EXPLORER_FAQ: launch_file(_hwnd, TEXT("http://www.foxplanet.de/explorer/"), SW_SHOW); break; case IDW_ADDRESSBAR: if (code == 1) { TCHAR url[BUFFER_LEN]; if (GetWindowText(_haddressedit, url, BUFFER_LEN)) go_to(url, false); } break; case IDW_COMMANDBAR: if (code == 1) ExecuteCommandbar(NULL); break; default: return 1; // no command handlers in Window::Command() } return 0; }
HWND MainFrameBase::Create | ( | const ExplorerCmd & | cmd ) | [static] |
Definition at line 42 of file mainframe.cpp.
References ExplorerCmd::_cmdShow, ExplorerCmd::_flags, ExplorerGlobals::_hMainWnd, ExplorerCmd::_mdi, ExplorerCmd::_path, g_Globals, HWND, ExplorerCmd::IsValidPath(), OWM_DETAILS, OWM_EXPLORE, and PM_OPEN_WINDOW.
Referenced by explorer_show_frame(), and OpenShellFolders().
{ HWND hFrame; #ifndef _NO_MDI if (cmd._mdi) hFrame = MDIMainFrame::Create(); else #endif hFrame = SDIMainFrame::Create(); if (hFrame) { HWND hwndOld = g_Globals._hMainWnd; g_Globals._hMainWnd = hFrame; if (hwndOld) DestroyWindow(hwndOld); ShowWindow(hFrame, cmd._cmdShow); UpdateWindow(hFrame); // Open the first child window after initializing the application if (cmd.IsValidPath()) { // We use the static s_path variable to store the path string in order // to avoid accessing prematurely freed memory in the PostMessage handlers. static String s_path = cmd._path; PostMessage(hFrame, PM_OPEN_WINDOW, cmd._flags, (LPARAM)(LPCTSTR)s_path); } else PostMessage(hFrame, PM_OPEN_WINDOW, OWM_EXPLORE|OWM_DETAILS, 0); } return hFrame; }
void MainFrameBase::ExecuteCommandbar | ( | LPCTSTR | dir ) | [protected] |
Definition at line 444 of file mainframe.cpp.
References _hcommandedit, WindowHandle::_hwnd, _tcsnicmp, BUFFER_LEN, CONTEXT, display_error(), and TEXT.
Referenced by SDIMainFrame::Command(), MDIMainFrame::Command(), and Command().
{ TCHAR cmd[BUFFER_LEN]; if (GetWindowText(_hcommandedit, cmd, BUFFER_LEN)) { CONTEXT("ExecuteCommandbar - ShellExecute()"); // remove command prompt from 'cmd' string LPCTSTR p = cmd; if (*p == '>') ++p; while(*p == ' ') ++p; if (dir) { // remove "file://" from directory URL if (!_tcsnicmp(dir, TEXT("file://"), 7)) dir += 7; } ///@todo use SHGetFileInfo() with SHGFI_EXETYPE flag to determine EXE type and open console window HINSTANCE hinst = ShellExecute(_hwnd, NULL, p, NULL, dir, SW_SHOWNORMAL); if ((int)hinst <= 32) display_error(_hwnd, GetLastError()); } }
void MainFrameBase::FillBookmarks | ( | ) | [protected] |
Definition at line 677 of file mainframe.cpp.
References ExplorerGlobals::_favorites, _himl, _hsidebar, WindowHandle::_hwnd, ExplorerGlobals::_icon_cache, Icon::add_to_imagelist(), BookmarkList::fill_tree(), g_Globals, IconCache::get_icon(), ICID_BOOKMARK, ICID_FAVORITES, ICID_FOLDER, IDI_DOT, IDS_FAVORITES, ImageList_AddAlphaIcon(), and String::str().
Referenced by Command().
{ HiddenWindow hide(_hsidebar); WindowCanvas canvas(_hwnd); TreeView_DeleteAllItems(_hsidebar); g_Globals._icon_cache.get_icon(ICID_FAVORITES).add_to_imagelist(_himl, canvas); g_Globals._icon_cache.get_icon(ICID_BOOKMARK).add_to_imagelist(_himl, canvas); ImageList_AddAlphaIcon(_himl, SmallIcon(IDI_DOT), GetStockBrush(WHITE_BRUSH), canvas); g_Globals._icon_cache.get_icon(ICID_FOLDER).add_to_imagelist(_himl, canvas); g_Globals._icon_cache.get_icon(ICID_FOLDER).add_to_imagelist(_himl, canvas); TV_INSERTSTRUCT tvi; tvi.hParent = TVI_ROOT; tvi.hInsertAfter = TVI_LAST; tvi.item.mask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE; ResString sFavorites(IDS_FAVORITES); tvi.item.pszText = sFavorites.str(); tvi.item.iSelectedImage = tvi.item.iImage = 0; HTREEITEM hitem_bookmarks = TreeView_InsertItem(_hsidebar, &tvi); g_Globals._favorites.fill_tree(_hsidebar, hitem_bookmarks, _himl, canvas); TreeView_Expand(_hsidebar, hitem_bookmarks, TVE_EXPAND); }
void MainFrameBase::frame_get_clientspace | ( | PRECT | prect ) | [protected, virtual] |
Reimplemented in MDIMainFrame.
Definition at line 584 of file mainframe.cpp.
References _hstatusbar, _htoolbar, and WindowHandle::_hwnd.
Referenced by MDIMainFrame::frame_get_clientspace(), and ProcessMessage().
{ if (!IsIconic(_hwnd)) GetClientRect(_hwnd, prect); else { WINDOWPLACEMENT wp; GetWindowPlacement(_hwnd, &wp); prect->left = prect->top = 0; prect->right = wp.rcNormalPosition.right-wp.rcNormalPosition.left- 2*(GetSystemMetrics(SM_CXSIZEFRAME)+GetSystemMetrics(SM_CXEDGE)); prect->bottom = wp.rcNormalPosition.bottom-wp.rcNormalPosition.top- 2*(GetSystemMetrics(SM_CYSIZEFRAME)+GetSystemMetrics(SM_CYEDGE))- GetSystemMetrics(SM_CYCAPTION)-GetSystemMetrics(SM_CYMENUSIZE); } if (IsWindowVisible(_htoolbar)) { ClientRect rt(_htoolbar); prect->top += rt.bottom+2; } if (IsWindowVisible(_hstatusbar)) { ClientRect rt(_hstatusbar); prect->bottom -= rt.bottom; } }
void MainFrameBase::fullscreen_move | ( | ) | [protected] |
Definition at line 642 of file mainframe.cpp.
References WindowHandle::_hwnd, ClientToScreen(), and Frame_CalcFrameClient.
Referenced by toggle_child().
{ RECT rt, pos; GetWindowRect(_hwnd, &pos); Frame_CalcFrameClient(_hwnd, &rt); ClientToScreen(_hwnd, (LPPOINT)&rt.left); ClientToScreen(_hwnd, (LPPOINT)&rt.right); rt.left = pos.left-rt.left; rt.top = pos.top-rt.top; rt.right = GetSystemMetrics(SM_CXSCREEN)+pos.right-rt.right; rt.bottom = GetSystemMetrics(SM_CYSCREEN)+pos.bottom-rt.bottom; MoveWindow(_hwnd, rt.left, rt.top, rt.right-rt.left, rt.bottom-rt.top, TRUE); }
bool MainFrameBase::go_to | ( | LPCTSTR | url, |
bool | new_window | ||
) | [protected, virtual] |
Reimplemented in MDIMainFrame.
Definition at line 707 of file mainframe.cpp.
Referenced by Command(), MDIMainFrame::go_to(), and Notify().
{ ///@todo SDI implementation return false; }
int MainFrameBase::Notify | ( | int | id, |
NMHDR * | pnmh | ||
) | [protected, virtual] |
Reimplemented from Window.
Reimplemented in ShellBrowserChildT< MainFrameBase >.
Definition at line 476 of file mainframe.cpp.
References Bookmark::_description, BookmarkFolder::_description, _hsidebar, BookmarkNode::_pbookmark, BookmarkNode::_pfolder, BookmarkNode::_type, Bookmark::_url, BookmarkNode::BMNT_BOOKMARK, BookmarkNode::BMNT_FOLDER, go_to(), resize_frame_client(), TEXT, and TreeView_GetItemData().
{ switch(pnmh->code) { // resize children windows when the rebar size changes case RBN_AUTOSIZE: resize_frame_client(); break; case TVN_GETINFOTIP: { NMTVGETINFOTIP* pnmgit = (NMTVGETINFOTIP*)pnmh; if (pnmgit->lParam) { const BookmarkNode& node = *(BookmarkNode*)pnmgit->lParam; if (node._type == BookmarkNode::BMNT_FOLDER) { // display tooltips for bookmark folders if (!node._pfolder->_description.empty()) lstrcpyn(pnmgit->pszText, node._pfolder->_description.c_str(), pnmgit->cchTextMax); } else if (node._type == BookmarkNode::BMNT_BOOKMARK) { // display tooltips for bookmark folders String txt = node._pbookmark->_description; if (!node._pbookmark->_url.empty()) { if (!txt.empty()) txt += TEXT(" - "); txt += node._pbookmark->_url; } lstrcpyn(pnmgit->pszText, txt.c_str(), pnmgit->cchTextMax); } } break;} case NM_DBLCLK: { HTREEITEM hitem = TreeView_GetSelection(_hsidebar); LPARAM lparam = TreeView_GetItemData(_hsidebar, hitem); if (lparam) { const BookmarkNode& node = *(BookmarkNode*)lparam; if (node._type == BookmarkNode::BMNT_BOOKMARK) { bool new_window = GetAsyncKeyState(VK_SHIFT)<0; go_to(node._pbookmark->_url, new_window); } } break;} } return 0; }
int MainFrameBase::OpenShellFolders | ( | LPIDA | pida, |
HWND | hFrameWnd | ||
) | [static] |
Definition at line 79 of file mainframe.cpp.
References ExplorerGlobals::_hMainWnd, Create(), ShellPath::create_absolute_pidl(), g_Globals, ExplorerGlobals::get_cfg(), HandleException(), HWND, LOG, OWM_PIDL, OWM_SEPARATE, PM_OPEN_WINDOW, and TEXT.
Referenced by ShellBrowser::OnDefaultCommand(), and DesktopWindow::OnDefaultCommand().
{ int cnt = 0; LPCITEMIDLIST parent_pidl = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[0]); ShellFolder folder(parent_pidl); LOG(FmtString(TEXT("MainFrameBase::OpenShellFolders(): parent_pidl=%s"), (LPCTSTR)FileSysShellPath(parent_pidl))); for(int i=pida->cidl; i>0; --i) { LPCITEMIDLIST pidl = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[i]); SFGAOF attribs = SFGAO_FOLDER; HRESULT hr = folder->GetAttributesOf(1, &pidl, &attribs); if (SUCCEEDED(hr)) if (attribs & SFGAO_FOLDER) { try { XMLPos explorer_options = g_Globals.get_cfg("general/explorer"); bool mdi = XMLBool(explorer_options, "mdi", true); bool separateFolders = XMLBool(explorer_options, "separate-folders", true); ShellPath pidl_abs = ShellPath(pidl).create_absolute_pidl(parent_pidl); LOG(FmtString(TEXT("MainFrameBase::OpenShellFolders(): pidl_abs=%s"), (LPCTSTR)FileSysShellPath(pidl_abs))); if (hFrameWnd && (mdi || !separateFolders)) { int flags = OWM_PIDL; if (separateFolders) flags |= OWM_SEPARATE; if (SendMessage(hFrameWnd, PM_OPEN_WINDOW, flags, (LPARAM)(LPCITEMIDLIST)pidl_abs)) ++cnt; } else { HWND hwnd; #ifndef _NO_MDI if (mdi) hwnd = MDIMainFrame::Create(pidl_abs, 0); else #endif hwnd = SDIMainFrame::Create(pidl_abs, 0); if (hwnd) ++cnt; } } catch(COMException& e) { HandleException(e, g_Globals._hMainWnd); } }/*TEST else { // !(attribs & SFGAO_FOLDER)) SHELLEXECUTEINFOA shexinfo; shexinfo.cbSize = sizeof(SHELLEXECUTEINFOA); shexinfo.fMask = SEE_MASK_INVOKEIDLIST; shexinfo.hwnd = NULL; shexinfo.lpVerb = NULL; shexinfo.lpFile = NULL; shexinfo.lpParameters = NULL; shexinfo.lpDirectory = NULL; shexinfo.nShow = SW_NORMAL; shexinfo.lpIDList = ILCombine(parent_pidl, pidl); if (ShellExecuteExA(&shexinfo)) ++cnt; ILFree((LPITEMIDLIST)shexinfo.lpIDList); }*/ } return cnt; }
bool MainFrameBase::ProcessMessage | ( | UINT | nmsg, |
WPARAM | wparam, | ||
LPARAM | lparam, | ||
LRESULT * | pres | ||
) | [protected] |
Definition at line 279 of file mainframe.cpp.
References _haddressedit, ExplorerGlobals::_hMainWnd, _hstatusbar, WindowHandle::_hwnd, _hwndrebar, _menu_info, frame_get_clientspace(), g_Globals, HWND, PM_FRM_CALC_CLIENT, PM_FRM_GET_MENUINFO, PM_GET_CONTROLWINDOW, PM_SETSTATUSTEXT, PM_TRANSLATE_MSG, PM_URL_CHANGED, resize_frame(), resize_frame_client(), and TranslateMsg().
Referenced by MDIMainFrame::WndProc(), and WndProc().
{ switch(nmsg) { case PM_TRANSLATE_MSG: *pres = TranslateMsg((MSG*)lparam); return true; case WM_SHOWWINDOW: if (wparam) { // trigger child resizing after window creation - now we can succesfully call IsWindowVisible() int height = SendMessage(_hwndrebar, RB_GETBARHEIGHT, 0, 0); MoveWindow(_hwndrebar, 0, 0, LOWORD(lparam), height, TRUE); resize_frame_client(); } return false; // goto def; case WM_CLOSE: DestroyWindow(_hwnd); g_Globals._hMainWnd = 0; break; case WM_DESTROY: break; case WM_SIZE: { #ifdef __REACTOS__ ///@todo Work around to display rebar in ROS (with flickering) as long as the control isn't fixed int height = SendMessage(_hwndrebar, RB_GETBARHEIGHT, 0, 0); MoveWindow(_hwndrebar, 0, 0, LOWORD(lparam), height, TRUE); #else resize_frame(LOWORD(lparam), HIWORD(lparam)); SendMessage(_hwndrebar, WM_SIZE, 0, 0); #endif break;} // do not pass message to DefFrameProc case WM_GETMINMAXINFO: { LPMINMAXINFO lpmmi = (LPMINMAXINFO)lparam; lpmmi->ptMaxTrackSize.x <<= 1;/*2*GetSystemMetrics(SM_CXSCREEN) / SM_CXVIRTUALSCREEN */ lpmmi->ptMaxTrackSize.y <<= 1;/*2*GetSystemMetrics(SM_CYSCREEN) / SM_CYVIRTUALSCREEN */ break;} case PM_FRM_CALC_CLIENT: frame_get_clientspace((PRECT)lparam); *pres = TRUE; return true; case PM_FRM_GET_MENUINFO: *pres = (LPARAM)&_menu_info; return true; case PM_GET_CONTROLWINDOW: if (wparam == FCW_STATUS) { *pres = (LRESULT)(HWND)_hstatusbar; return true; } break; case PM_SETSTATUSTEXT: SendMessage(_hstatusbar, SB_SETTEXT, 0, lparam); break; case PM_URL_CHANGED: SetWindowText(_haddressedit, (LPCTSTR)lparam); break; default: return false; } *pres = 0; return true; }
void MainFrameBase::resize_frame | ( | int | cx, |
int | cy | ||
) | [protected, virtual] |
Reimplemented in MDIMainFrame, and SDIMainFrame.
Definition at line 531 of file mainframe.cpp.
References _haddressedit, _hcommandedit, _hsidebar, _hstatusbar, _htoolbar, and _hwndrebar.
Referenced by ProcessMessage(), and resize_frame_client().
{ if (cy <= 0) return; // avoid resizing children when receiving RBN_AUTOSIZE while getting minimized RECT rect = {0, 0, cx, cy}; if (_hwndrebar) { int height = SendMessage(_hwndrebar, RB_GETBARHEIGHT, 0, 0); rect.top += height; rect.top += 5; } else { if (IsWindowVisible(_htoolbar)) { SendMessage(_htoolbar, WM_SIZE, 0, 0); WindowRect rt(_htoolbar); rect.top = rt.bottom; // rect.bottom -= rt.bottom; } } if (IsWindowVisible(_hstatusbar)) { int parts[] = {300, 500}; SendMessage(_hstatusbar, WM_SIZE, 0, 0); SendMessage(_hstatusbar, SB_SETPARTS, 2, (LPARAM)&parts); ClientRect rt(_hstatusbar); rect.bottom -= rt.bottom; } if (IsWindowVisible(_haddressedit) || IsWindowVisible(_hcommandedit)) { ClientRect rt(_haddressedit); rect.bottom -= rt.bottom; int mid = (rect.right-rect.left) / 2; ///@todo use split bar SetWindowPos(_haddressedit, 0, 0, rect.bottom, mid, rt.bottom, SWP_NOACTIVATE|SWP_NOZORDER); SetWindowPos(_hcommandedit, 0, mid+1, rect.bottom, rect.right-(mid+1), rt.bottom, SWP_NOACTIVATE|SWP_NOZORDER); } if (IsWindowVisible(_hsidebar)) { WindowRect rt(_hsidebar); rect.left += rt.right-rt.left; SetWindowPos(_hsidebar, 0, -1, rect.top-1, rt.right-rt.left, rect.bottom-rect.top+1, SWP_NOACTIVATE|SWP_NOZORDER); } }
void MainFrameBase::resize_frame_client | ( | ) | [protected] |
Definition at line 577 of file mainframe.cpp.
References WindowHandle::_hwnd, and resize_frame().
Referenced by Notify(), ProcessMessage(), and toggle_child().
{ ClientRect rect(_hwnd); resize_frame(rect.right, rect.bottom); }
void MainFrameBase::toggle_child | ( | HWND | hwnd, |
UINT | cmd, | ||
HWND | hchild, | ||
int | band_idx = -1 |
||
) | [protected] |
Definition at line 660 of file mainframe.cpp.
References _fullscreen, MenuInfo::_hMenuView, _hwndrebar, _menu_info, FullScreenParameters::_mode, fullscreen_move(), and resize_frame_client().
Referenced by MDIMainFrame::Command(), and Command().
{ BOOL vis = IsWindowVisible(hchild); CheckMenuItem(_menu_info._hMenuView, cmd, vis?MF_BYCOMMAND:MF_BYCOMMAND|MF_CHECKED); if (band_idx != -1) SendMessage(_hwndrebar, RB_SHOWBAND, band_idx, !vis); else ShowWindow(hchild, vis? SW_HIDE: SW_SHOW); if (_fullscreen._mode) fullscreen_move(); resize_frame_client(); }
BOOL MainFrameBase::toggle_fullscreen | ( | ) | [protected] |
Definition at line 612 of file mainframe.cpp.
References _fullscreen, WindowHandle::_hwnd, FullScreenParameters::_mode, FullScreenParameters::_orgPos, FullScreenParameters::_wasZoomed, ClientToScreen(), and Frame_CalcFrameClient.
Referenced by Command().
{ RECT rt; if ((_fullscreen._mode=!_fullscreen._mode)) { GetWindowRect(_hwnd, &_fullscreen._orgPos); _fullscreen._wasZoomed = IsZoomed(_hwnd); Frame_CalcFrameClient(_hwnd, &rt); ClientToScreen(_hwnd, (LPPOINT)&rt.left); ClientToScreen(_hwnd, (LPPOINT)&rt.right); rt.left = _fullscreen._orgPos.left-rt.left; rt.top = _fullscreen._orgPos.top-rt.top; rt.right = GetSystemMetrics(SM_CXSCREEN)+_fullscreen._orgPos.right-rt.right; rt.bottom = GetSystemMetrics(SM_CYSCREEN)+_fullscreen._orgPos.bottom-rt.bottom; MoveWindow(_hwnd, rt.left, rt.top, rt.right-rt.left, rt.bottom-rt.top, TRUE); } else { MoveWindow(_hwnd, _fullscreen._orgPos.left, _fullscreen._orgPos.top, _fullscreen._orgPos.right-_fullscreen._orgPos.left, _fullscreen._orgPos.bottom-_fullscreen._orgPos.top, TRUE); if (_fullscreen._wasZoomed) ShowWindow(_hwnd, WS_MAXIMIZE); } return _fullscreen._mode; }
BOOL MainFrameBase::TranslateMsg | ( | MSG * | pmsg ) | [protected, virtual] |
Reimplemented in MDIMainFrame.
Definition at line 351 of file mainframe.cpp.
References _hAccel, and WindowHandle::_hwnd.
Referenced by ProcessMessage(), and MDIMainFrame::TranslateMsg().
LRESULT MainFrameBase::WndProc | ( | UINT | nmsg, |
WPARAM | wparam, | ||
LPARAM | lparam | ||
) | [protected, virtual] |
Reimplemented from Window.
Reimplemented in MDIMainFrame, SDIMainFrame, ShellBrowserChildT< MainFrameBase >, and ExtContextMenuHandlerT< ShellBrowserChildT< MainFrameBase > >.
Definition at line 269 of file mainframe.cpp.
References ProcessMessage(), and Window::WndProc().
{ LRESULT res; if (ProcessMessage(nmsg, wparam, lparam, &res)) return res; else return super::WndProc(nmsg, wparam, lparam); }
FullScreenParameters MainFrameBase::_fullscreen [protected] |
Definition at line 68 of file mainframe.h.
Referenced by toggle_child(), and toggle_fullscreen().
HACCEL MainFrameBase::_hAccel [protected] |
Definition at line 70 of file mainframe.h.
Referenced by MainFrameBase(), and TranslateMsg().
Definition at line 56 of file mainframe.h.
Referenced by MDIMainFrame::Command(), Command(), MainFrameBase(), ProcessMessage(), SDIMainFrame::resize_frame(), MDIMainFrame::resize_frame(), resize_frame(), and SDIMainFrame::set_url().
Definition at line 57 of file mainframe.h.
Referenced by ExecuteCommandbar(), MainFrameBase(), SDIMainFrame::resize_frame(), MDIMainFrame::resize_frame(), and resize_frame().
HIMAGELIST MainFrameBase::_himl |
Definition at line 60 of file mainframe.h.
Referenced by FillBookmarks(), MainFrameBase(), and ~MainFrameBase().
HIMAGELIST MainFrameBase::_himl_old [protected] |
Definition at line 71 of file mainframe.h.
Referenced by MainFrameBase(), and ~MainFrameBase().
Definition at line 62 of file mainframe.h.
Referenced by MainFrameBase().
Definition at line 63 of file mainframe.h.
Referenced by MainFrameBase(), and MDIMainFrame::MDIMainFrame().
Definition at line 59 of file mainframe.h.
Referenced by Command(), FillBookmarks(), MainFrameBase(), Notify(), SDIMainFrame::resize_frame(), MDIMainFrame::resize_frame(), resize_frame(), and ~MainFrameBase().
Definition at line 54 of file mainframe.h.
Referenced by Command(), frame_get_clientspace(), MainFrameBase(), ProcessMessage(), SDIMainFrame::resize_frame(), MDIMainFrame::resize_frame(), and resize_frame().
Definition at line 53 of file mainframe.h.
Referenced by Command(), frame_get_clientspace(), MainFrameBase(), MDIMainFrame::MDIMainFrame(), SDIMainFrame::resize_frame(), MDIMainFrame::resize_frame(), and resize_frame().
Definition at line 51 of file mainframe.h.
Referenced by MainFrameBase(), MDIMainFrame::MDIMainFrame(), ProcessMessage(), SDIMainFrame::resize_frame(), MDIMainFrame::resize_frame(), resize_frame(), and toggle_child().
Definition at line 65 of file mainframe.h.
Referenced by Command(), MainFrameBase(), MDIMainFrame::MDIMainFrame(), ProcessMessage(), and toggle_child().
ROS Explorer Source Code Documentation
generated on 02.01.2013 by ![]() |