From eee41448252c96b9052ebb7434df30db008ea8e4 Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Sun, 18 Jan 2004 18:45:26 +0000 Subject: [PATCH] moved setings dialogs in separate file svn path=/trunk/; revision=7743 --- .../system/explorer/desktop/desktop.cpp | 4 +- .../system/explorer/dialogs/settings.cpp | 163 ++++++++++++++++++ .../subsys/system/explorer/dialogs/settings.h | 77 +++++++++ 3 files changed, 243 insertions(+), 1 deletion(-) create mode 100644 reactos/subsys/system/explorer/dialogs/settings.cpp create mode 100644 reactos/subsys/system/explorer/dialogs/settings.h diff --git a/reactos/subsys/system/explorer/desktop/desktop.cpp b/reactos/subsys/system/explorer/desktop/desktop.cpp index 73512e82291..8ebc9a7571c 100644 --- a/reactos/subsys/system/explorer/desktop/desktop.cpp +++ b/reactos/subsys/system/explorer/desktop/desktop.cpp @@ -164,7 +164,7 @@ LRESULT DesktopWindow::Init(LPCREATESTRUCT pcs) FOLDERSETTINGS fs; fs.ViewMode = FVM_ICON; - fs.fFlags = FWF_DESKTOP|FWF_NOCLIENTEDGE|FWF_NOSCROLL|FWF_BESTFITWINDOW|FWF_SNAPTOGRID; + fs.fFlags = FWF_DESKTOP|FWF_NOCLIENTEDGE|FWF_NOSCROLL|FWF_BESTFITWINDOW|FWF_SNAPTOGRID; //|FWF_AUTOARRANGE; ClientRect rect(_hwnd); @@ -208,6 +208,8 @@ LRESULT DesktopWindow::Init(LPCREATESTRUCT pcs) HWND hwndFolderView = ::GetNextWindow(hWndView, GW_CHILD); + SetWindowStyle(hwndFolderView, (GetWindowStyle(hwndFolderView)&~LVS_ALIGNLEFT)|LVS_ALIGNTOP|LVS_AUTOARRANGE); + // work around for Windows NT, Win 98, ... // Without this the desktop has mysteriously only a size of 800x600 pixels. MoveWindow(hwndFolderView, 0, 0, rect.right, rect.bottom, TRUE); diff --git a/reactos/subsys/system/explorer/dialogs/settings.cpp b/reactos/subsys/system/explorer/dialogs/settings.cpp new file mode 100644 index 00000000000..e54e17bf41d --- /dev/null +++ b/reactos/subsys/system/explorer/dialogs/settings.cpp @@ -0,0 +1,163 @@ +/* + * Copyright 2003 Martin Fuchs + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + + // + // Explorer clone + // + // dialogs/settings.cpp + // + // Explorer dialogs + // + // Martin Fuchs, 18.01.2004 + // + + +#include "../utility/utility.h" + +#include "../explorer.h" +#include "../globals.h" +#include "../externals.h" +#include "../explorer_intres.h" + +#include "settings.h" + + +void ExplorerPropertySheet(HWND hparent) +{ + PropertySheetDialog ps(hparent); + + ps.dwFlags |= PSH_USEICONID | PSH_PROPTITLE; + ps.pszIcon = MAKEINTRESOURCE(IDI_REACTOS); + ps.pszCaption = TEXT("Explorer"); + + PropSheetPage psp1(IDD_DESKBAR_DESKTOP, WINDOW_CREATOR(DesktopSettingsDlg)); + psp1.dwFlags |= PSP_USETITLE; + psp1.pszTitle = MAKEINTRESOURCE(IDS_DESKTOP); + ps.add(psp1); + + PropSheetPage psp2(IDD_DESKBAR_TASKBAR, WINDOW_CREATOR(TaskbarSettingsDlg)); + psp2.dwFlags |= PSP_USETITLE; + psp2.pszTitle = MAKEINTRESOURCE(IDS_TASKBAR); + ps.add(psp2); + + PropSheetPage psp3(IDD_DESKBAR_STARTMENU, WINDOW_CREATOR(StartmenuSettingsDlg)); + psp3.dwFlags |= PSP_USETITLE; + psp3.pszTitle = MAKEINTRESOURCE(IDS_STARTMENU); + ps.add(psp3); + + ps.DoModal(); +} + + +DesktopSettingsDlg::DesktopSettingsDlg(HWND hwnd) + : super(hwnd), + _bmp0(IDB_ICON_ALIGN_0), + _bmp1(IDB_ICON_ALIGN_1), + _bmp2(IDB_ICON_ALIGN_2), + _bmp3(IDB_ICON_ALIGN_3), + _bmp4(IDB_ICON_ALIGN_4), + _bmp5(IDB_ICON_ALIGN_5), + _bmp6(IDB_ICON_ALIGN_6), + _bmp7(IDB_ICON_ALIGN_7) +{ + new PictureButton(_hwnd, IDC_ICON_ALIGN_0, _bmp0); + new PictureButton(_hwnd, IDC_ICON_ALIGN_1, _bmp1); + new PictureButton(_hwnd, IDC_ICON_ALIGN_2, _bmp2); + new PictureButton(_hwnd, IDC_ICON_ALIGN_3, _bmp3); + new PictureButton(_hwnd, IDC_ICON_ALIGN_4, _bmp4); + new PictureButton(_hwnd, IDC_ICON_ALIGN_5, _bmp5); + new PictureButton(_hwnd, IDC_ICON_ALIGN_6, _bmp6); + new PictureButton(_hwnd, IDC_ICON_ALIGN_7, _bmp7); + + _alignment = 0; +} + +#ifndef PSN_QUERYINITIALFOCUS // currently (as of 18.01.2004) missing in MinGW headers +#define PSN_QUERYINITIALFOCUS (-213) +#endif + +int DesktopSettingsDlg::Notify(int id, NMHDR* pnmh) +{ + switch(pnmh->code) { + case PSN_QUERYINITIALFOCUS: + SetWindowLong(_hwnd, DWL_MSGRESULT, (LPARAM)GetDlgItem(_hwnd, IDC_ICON_ALIGN_0+_alignment)); + break; + + default: + return super::Notify(id, pnmh); + } + + return 0; +} + +int DesktopSettingsDlg::Command(int id, int code) +{ + if (id>=IDC_ICON_ALIGN_0 && id<=IDC_ICON_ALIGN_7) { + int alignment = id - IDC_ICON_ALIGN_0; + + if (alignment != _alignment) { + _alignment = alignment; + PropSheet_Changed(GetParent(_hwnd), _hwnd); + } + } + + return 1; +} + + +TaskbarSettingsDlg::TaskbarSettingsDlg(HWND hwnd) + : super(hwnd) +{ +} + +LRESULT TaskbarSettingsDlg::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam) +{ + switch(nmsg) { + case WM_PAINT: { + PaintCanvas canvas(_hwnd); + FillRect(canvas, &canvas.rcPaint, GetStockBrush(GRAY_BRUSH)); + break;} + + default: + return super::WndProc(nmsg, wparam, lparam); + } + + return 0; +} + + +StartmenuSettingsDlg::StartmenuSettingsDlg(HWND hwnd) + : super(hwnd) +{ +} + +LRESULT StartmenuSettingsDlg::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam) +{ + switch(nmsg) { + case WM_PAINT: { + PaintCanvas canvas(_hwnd); + FillRect(canvas, &canvas.rcPaint, GetStockBrush(DKGRAY_BRUSH)); + break;} + + default: + return super::WndProc(nmsg, wparam, lparam); + } + + return 0; +} diff --git a/reactos/subsys/system/explorer/dialogs/settings.h b/reactos/subsys/system/explorer/dialogs/settings.h new file mode 100644 index 00000000000..5f496c00bcf --- /dev/null +++ b/reactos/subsys/system/explorer/dialogs/settings.h @@ -0,0 +1,77 @@ +/* + * Copyright 2003 Martin Fuchs + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + + // + // Explorer clone + // + // dialogs/settings.h + // + // Explorer dialogs + // + // Martin Fuchs, 18.01.2004 + // + + +void ExplorerPropertySheet(HWND hparent); + + + /// "Desktopbar Settings" Property Sheet Dialog +struct DesktopSettingsDlg : public OwnerDrawParent +{ + typedef OwnerDrawParent super; + + DesktopSettingsDlg(HWND hwnd); + +protected: + ResBitmap _bmp0; + ResBitmap _bmp1; + ResBitmap _bmp2; + ResBitmap _bmp3; + ResBitmap _bmp4; + ResBitmap _bmp5; + ResBitmap _bmp6; + ResBitmap _bmp7; + + int _alignment; + + virtual int Command(int id, int code); + virtual int Notify(int id, NMHDR* pnmh); +}; + + + /// "Taskbar Settings" Property Sheet Dialog +struct TaskbarSettingsDlg : public PropSheetPageDlg +{ + typedef PropSheetPageDlg super; + + TaskbarSettingsDlg(HWND hwnd); + + LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam); +}; + + + /// "Startmenu Settings" Property Sheet Dialog +struct StartmenuSettingsDlg : public PropSheetPageDlg +{ + typedef PropSheetPageDlg super; + + StartmenuSettingsDlg(HWND hwnd); + + LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam); +};