desktop settings dialog sheet (for now only too look at it - no real functionality)

svn path=/trunk/; revision=7739
This commit is contained in:
Martin Fuchs 2004-01-18 13:59:43 +00:00
parent 5a57e066ec
commit c78c696293
26 changed files with 224 additions and 178 deletions

View file

@ -35,6 +35,7 @@ exe explorer :
utility/utility.cpp
utility/window.cpp
dialogs/searchprogram.cpp
dialogs/settings.cpp
i386-stub-win32.c
: <define>WIN32 <define>_ROS_ <define>_WIN32_IE=0x0501 <define>_WIN32_WINNT=0x0501
<cxxflags>-I$(INCLUDE)

View file

@ -91,6 +91,7 @@ OBJECTS = \
traynotify.o \
quicklaunch.o \
searchprogram.o \
settings.o \
i386-stub-win32.o
LIBS = gdi32 comctl32 ole32 uuid wsock32

View file

@ -65,6 +65,7 @@ OBJECTS = \
traynotify.o \
quicklaunch.o \
searchprogram.o \
settings.o \
i386-stub-win32.o
LIBS = gdi32 comctl32 ole32 uuid wsock32

View file

@ -34,7 +34,8 @@ CPP_SRCS = \
taskbar/startmenu.cpp \
taskbar/traynotify.cpp \
taskbar/quicklaunch.cpp \
dialogs/searchprogram.cpp
dialogs/searchprogram.cpp \
dialogs/settings.cpp
RC_SRCS = explorer_intres.rc
EXTRARCFLAGS = -D__WRC__ -D_WIN32

View file

@ -32,14 +32,14 @@
#include "../utility/dragdropimpl.h"
#include "../utility/window.h"
#include "desktop.h"
#include "../taskbar/desktopbar.h"
#include "../shell/mainframe.h" // for MainFrame::Create()
#include "../globals.h"
#include "../externals.h"
#include "../explorer_intres.h"
#include "desktop.h"
#include "../taskbar/desktopbar.h"
#include "../shell/mainframe.h" // for MainFrame::Create()
static BOOL (WINAPI*SetShellWindow)(HWND);
static BOOL (WINAPI*SetShellWindowEx)(HWND, HWND);
@ -224,6 +224,7 @@ LRESULT DesktopWindow::Init(LPCREATESTRUCT pcs)
// create the explorer bar
_desktopBar = DesktopBar::Create();
g_Globals._hwndDesktopBar = _desktopBar;
return 0;
}

View file

@ -20,7 +20,7 @@
//
// Explorer clone
//
// searchprogram.cpp
// dialogs/searchprogram.cpp
//
// Explorer dialogs
//

View file

@ -20,7 +20,7 @@
//
// Explorer clone
//
// searchprogram.h
// dialogs/searchprogram.h
//
// Explorer dialogs
//

View file

@ -56,3 +56,5 @@ If you search for more information, look into the CVS repository.
04.01.2004 m. fuchs implemented icon cache
11.01.2004 m. fuchs keyboard navigation in start menu
14.01.2004 m. fuchs automatically adjusted size of notification area and quicklaunch bar in desktop bar
18.01.2004 m. fuchs explorer/desktop settings property sheet

View file

@ -495,6 +495,38 @@ SOURCE=.\res\folder.ico
# End Source File
# Begin Source File
SOURCE=.\res\icoalig0.bmp
# End Source File
# Begin Source File
SOURCE=.\res\icoalig1.bmp
# End Source File
# Begin Source File
SOURCE=.\res\icoalig2.bmp
# End Source File
# Begin Source File
SOURCE=.\res\icoalig3.bmp
# End Source File
# Begin Source File
SOURCE=.\res\icoalig4.bmp
# End Source File
# Begin Source File
SOURCE=.\res\icoalig5.bmp
# End Source File
# Begin Source File
SOURCE=.\res\icoalig6.bmp
# End Source File
# Begin Source File
SOURCE=.\res\icoalig7.bmp
# End Source File
# Begin Source File
SOURCE=.\res\images.bmp
# End Source File
# Begin Source File
@ -754,6 +786,14 @@ SOURCE=.\dialogs\searchprogram.cpp
SOURCE=.\dialogs\searchprogram.h
# End Source File
# Begin Source File
SOURCE=.\dialogs\settings.cpp
# End Source File
# Begin Source File
SOURCE=.\dialogs\settings.h
# End Source File
# End Group
# Begin Source File

View file

@ -30,6 +30,7 @@
#define IDS_SEARCH 26
#define IDS_ABOUT_EXPLORER 27
#define IDS_LAUNCH_MANY_PROGRAMS 28
#define IDS_DESKTOPBAR_SETTINGS 29
#define IDI_REACTOS 100
#define IDI_EXPLORER 101
#define IDI_STARTMENU 102
@ -70,7 +71,15 @@
#define IDI_COMPUTER 149
#define IDM_DESKTOPBAR 150
#define IDD_DESKBAR_TASKBAR 153
#define IDB_ICON_ALIGN_0 153
#define IDD_DESKBAR_STARTMENU 154
#define IDB_ICON_ALIGN_1 154
#define IDB_ICON_ALIGN_2 155
#define IDB_ICON_ALIGN_3 156
#define IDB_ICON_ALIGN_4 157
#define IDB_ICON_ALIGN_5 158
#define IDB_ICON_ALIGN_6 159
#define IDB_ICON_ALIGN_7 160
#define ID_VIEW_NAME 401
#define ID_VIEW_ALL_ATTRIBUTES 402
#define ID_VIEW_SELECTED_ATTRIBUTES 403
@ -78,6 +87,15 @@
#define ID_VIEW_DRIVE_BAR 507
#define ID_VIEW_TOOL_BAR 508
#define IDC_ROS_EXPLORER 1000
#define IDC_BUTTON1 1002
#define IDC_ICON_ALIGN_0 1002
#define IDC_ICON_ALIGN_1 1003
#define IDC_ICON_ALIGN_2 1006
#define IDC_ICON_ALIGN_3 1007
#define IDC_ICON_ALIGN_4 1008
#define IDC_ICON_ALIGN_5 1009
#define IDC_ICON_ALIGN_6 1010
#define IDC_ICON_ALIGN_7 1011
#define IDC_WWW 1012
#define IDC_TOPIC 1017
#define IDC_MAILS_FOUND 1018
@ -111,9 +129,9 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 153
#define _APS_NEXT_RESOURCE_VALUE 161
#define _APS_NEXT_COMMAND_VALUE 40006
#define _APS_NEXT_CONTROL_VALUE 1002
#define _APS_NEXT_CONTROL_VALUE 1003
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View file

@ -118,6 +118,7 @@ BEGIN
IDS_ABOUT_EXPLORER "&Despre Explorer..."
IDS_LAUNCH_MANY_PROGRAMS
"You have selected more than one program.\nAre you sure you want to launch all of them?"
IDS_DESKTOPBAR_SETTINGS "Desktop Settings"
END
#endif // Romanian resources
@ -353,6 +354,20 @@ BEGIN
END
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_ICON_ALIGN_0 BITMAP DISCARDABLE "res/icoalig0.bmp"
IDB_ICON_ALIGN_1 BITMAP DISCARDABLE "res/icoalig1.bmp"
IDB_ICON_ALIGN_2 BITMAP DISCARDABLE "res/icoalig2.bmp"
IDB_ICON_ALIGN_3 BITMAP DISCARDABLE "res/icoalig3.bmp"
IDB_ICON_ALIGN_4 BITMAP DISCARDABLE "res/icoalig4.bmp"
IDB_ICON_ALIGN_5 BITMAP DISCARDABLE "res/icoalig5.bmp"
IDB_ICON_ALIGN_6 BITMAP DISCARDABLE "res/icoalig6.bmp"
IDB_ICON_ALIGN_7 BITMAP DISCARDABLE "res/icoalig7.bmp"
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
@ -467,6 +482,7 @@ BEGIN
IDS_ABOUT_EXPLORER "&Über Explorer..."
IDS_LAUNCH_MANY_PROGRAMS
"Sie haben mehrere Programme ausgewählt.\nSind Sie sicher, daß sie diese alle starten wollen?"
IDS_DESKTOPBAR_SETTINGS "Desktop-Einstellungen"
END
#endif // German (Germany) resources
@ -675,8 +691,24 @@ STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Desktop Properties"
FONT 8, "MS Sans Serif"
BEGIN
CONTROL IDC_STATIC,"Static",SS_BITMAP,74,20,21,98
// 130,
LTEXT "Please select your prefered icon alignment algorithm:",
IDC_STATIC,7,7,166,8
CONTROL "left/top dwn",IDC_ICON_ALIGN_0,"Button",BS_OWNERDRAW |
BS_BOTTOM | WS_TABSTOP,7,25,44,41
CONTROL "left/top right",IDC_ICON_ALIGN_1,"Button",BS_OWNERDRAW |
BS_BOTTOM | WS_TABSTOP,56,25,44,41
CONTROL "right/top left",IDC_ICON_ALIGN_2,"Button",BS_OWNERDRAW |
BS_BOTTOM | WS_TABSTOP,111,25,44,41
CONTROL "right/top up",IDC_ICON_ALIGN_3,"Button",BS_OWNERDRAW |
BS_BOTTOM | WS_TABSTOP,159,25,44,41
CONTROL "left/bot. up",IDC_ICON_ALIGN_4,"Button",BS_OWNERDRAW |
BS_BOTTOM | WS_TABSTOP,7,76,44,41
CONTROL "left/bot. right",IDC_ICON_ALIGN_5,"Button",BS_OWNERDRAW |
BS_BOTTOM | WS_TABSTOP,56,76,44,41
CONTROL "right/bot. left",IDC_ICON_ALIGN_6,"Button",BS_OWNERDRAW |
BS_BOTTOM | WS_TABSTOP,111,76,44,41
CONTROL "right/bot. up",IDC_ICON_ALIGN_7,"Button",BS_OWNERDRAW |
BS_BOTTOM | WS_TABSTOP,159,76,44,41
END
IDD_DESKBAR_TASKBAR DIALOG DISCARDABLE 0, 0, 210, 154
@ -684,8 +716,7 @@ STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Taskbar Properties"
FONT 8, "MS Sans Serif"
BEGIN
CONTROL IDC_STATIC,"Static",SS_BITMAP,129,19,21,98
//129,
CONTROL 129,IDC_STATIC,"Static",SS_BITMAP,129,19,21,98
END
IDD_DESKBAR_STARTMENU DIALOG DISCARDABLE 0, 0, 210, 154
@ -693,8 +724,7 @@ STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Startmenu Properties"
FONT 8, "MS Sans Serif"
BEGIN
CONTROL IDC_STATIC,"Static",SS_BITMAP,74,20,21,98
// 130,
CONTROL 130,IDC_STATIC,"Static",SS_BITMAP,74,20,21,98
END
@ -781,6 +811,7 @@ BEGIN
IDS_ABOUT_EXPLORER "&About Explorer..."
IDS_LAUNCH_MANY_PROGRAMS
"You have selected more than one program.\nAre you sure you want to launch all of them?"
IDS_DESKTOPBAR_SETTINGS "Desktop Settings"
END
#endif // English (U.S.) resources
@ -893,6 +924,7 @@ BEGIN
IDS_ABOUT_EXPLORER "A propos de l'explorateur..."
IDS_LAUNCH_MANY_PROGRAMS
"You have selected more than one program.\nAre you sure you want to launch all of them?"
IDS_DESKTOPBAR_SETTINGS "Desktop Settings"
END
#endif // French (France) resources

View file

@ -159,6 +159,8 @@ extern struct ExplorerGlobals
FileTypeManager _ftype_mgr;
IconCache _icon_cache;
HWND _hwndDesktopBar;
} g_Globals;

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -39,6 +39,8 @@
#include "traynotify.h"
#include "quicklaunch.h"
#include "../dialogs/settings.h"
DesktopBar::DesktopBar(HWND hwnd)
: super(hwnd),
@ -230,7 +232,7 @@ int DesktopBar::Command(int id, int code)
break;
case ID_DESKTOPBAR_SETTINGS:
DoPropertySheet();
ExplorerPropertySheet(_hwnd);
break;
default:
@ -272,99 +274,3 @@ LRESULT DesktopBar::ProcessCopyData(COPYDATASTRUCT* pcd)
return 0;
}
void DesktopBar::DoPropertySheet()
{
PropertySheetDialog ps(_hwnd);
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 = TEXT("Desktop");//MAKEINTRESOURCE(IDS_DESKTOP);
ps.add(psp1);
PropSheetPage psp2(IDD_DESKBAR_TASKBAR, WINDOW_CREATOR(TaskbarSettingsDlg));
psp2.dwFlags |= PSP_USETITLE;
psp2.pszTitle = TEXT("Taskbar");//MAKEINTRESOURCE(IDS_DESKTOP);
ps.add(psp2);
PropSheetPage psp3(IDD_DESKBAR_STARTMENU, WINDOW_CREATOR(StartmenuSettingsDlg));
psp3.dwFlags |= PSP_USETITLE;
psp3.pszTitle = TEXT("Start Menu");//MAKEINTRESOURCE(IDS_DESKTOP);
ps.add(psp3);
ps.DoModal();
}
DesktopSettingsDlg::DesktopSettingsDlg(HWND hwnd)
: super(hwnd)
{
}
LRESULT DesktopSettingsDlg::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
{
switch(nmsg) {
case WM_PAINT:
Paint();
break;
default:
return super::WndProc(nmsg, wparam, lparam);
}
return 0;
}
void DesktopSettingsDlg::Paint()
{
PaintCanvas canvas(_hwnd);
FillRect(canvas, &canvas.rcPaint, GetStockBrush(WHITE_BRUSH));
}
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;
}

View file

@ -94,41 +94,4 @@ protected:
WindowHandle _hwndQuickLaunch;
struct StartMenuRoot* _startMenuRoot;
void DoPropertySheet();
};
/// "Desktopbar Settings" Property Sheet Dialog
struct DesktopSettingsDlg : public PropSheetPageDlg
{
typedef PropSheetPageDlg super;
DesktopSettingsDlg(HWND hwnd);
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
void Paint();
};
/// "Desktopbar 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);
};

View file

@ -39,7 +39,9 @@
#include "desktopbar.h"
#include "startmenu.h"
#include "../dialogs/searchprogram.h"
#include "../dialogs/settings.h"
StartMenu::StartMenu(HWND hwnd)
@ -1274,9 +1276,9 @@ StartMenuRoot::StartMenuRoot(HWND hwnd)
}
HWND StartMenuRoot::Create(HWND hwndDesktopBar)
HWND StartMenuRoot::Create(HWND hwndOwner)
{
WindowRect pos(hwndDesktopBar);
WindowRect pos(hwndOwner);
RECT rect = {pos.left, pos.top-STARTMENU_LINE_HEIGHT-4, pos.left+STARTMENU_WIDTH_MIN, pos.top};
@ -1288,7 +1290,7 @@ HWND StartMenuRoot::Create(HWND hwndDesktopBar)
return Window::Create(WINDOW_CREATOR(StartMenuRoot), 0, GetWndClasss(), TITLE_STARTMENU,
WS_POPUP|WS_THICKFRAME|WS_CLIPCHILDREN,
rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, hwndDesktopBar);
rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, hwndOwner);
}
@ -1539,11 +1541,10 @@ int StartMenuHandler::Command(int id, int code)
explorer_show_frame(_hwnd, SW_SHOWNORMAL);
break;
case IDC_LAUNCH: {
HWND hwndDesktopBar = GetWindow(_hwnd, GW_OWNER);
case IDC_LAUNCH:
CloseStartMenu(id);
ShowLaunchDialog(hwndDesktopBar);
break;}
ShowLaunchDialog(g_Globals._hwndDesktopBar);
break;
case IDC_DOCUMENTS:
CreateSubmenu(id, CSIDL_PERSONAL, ResString(IDS_DOCUMENTS));
@ -1569,29 +1570,31 @@ int StartMenuHandler::Command(int id, int code)
CreateSubmenu(id, ResString(IDS_SEARCH), STARTMENU_CREATOR(SearchMenu));
break;
case IDC_START_HELP: {
HWND hwndDesktopBar = GetWindow(_hwnd, GW_OWNER);
case IDC_START_HELP:
CloseStartMenu(id);
MessageBox(hwndDesktopBar, TEXT("Help not yet implemented"), ResString(IDS_TITLE), MB_OK);
break;}
MessageBox(g_Globals._hwndDesktopBar, TEXT("Help not yet implemented"), ResString(IDS_TITLE), MB_OK);
break;
case IDC_LOGOFF:
/* The shell32 Dialog prompts about some system setting change. This is not what we want to display here.
HWND hwndDesktopBar = GetWindow(_hwnd, GW_OWNER);
CloseStartMenu(id);
ShowRestartDialog(hwndDesktopBar, EWX_LOGOFF);*/
ShowRestartDialog(g_Globals._hwndDesktopBar, EWX_LOGOFF);*/
DestroyWindow(GetParent(_hwnd));
break;
case IDC_SHUTDOWN: {
HWND hwndDesktopBar = GetWindow(_hwnd, GW_OWNER);
case IDC_SHUTDOWN:
CloseStartMenu(id);
ShowExitWindowsDialog(hwndDesktopBar);
break;}
ShowExitWindowsDialog(g_Globals._hwndDesktopBar);
break;
// settings menu
case ID_DESKTOPBAR_SETTINGS:
CloseStartMenu(id);
ExplorerPropertySheet(g_Globals._hwndDesktopBar);
break;
case IDC_SETTINGS_MENU:
CreateSubmenu(id, CSIDL_CONTROLS, ResString(IDS_SETTINGS_MENU));
break;
@ -1672,7 +1675,7 @@ void StartMenuHandler::ShowSearchComputer()
MessageBox(0, TEXT("SHFindComputer() not yet implemented in SHELL32"), ResString(IDS_TITLE), MB_OK);
}
void StartMenuHandler::ShowLaunchDialog(HWND hwndDesktopBar)
void StartMenuHandler::ShowLaunchDialog(HWND hwndOwner)
{
///@todo All text phrases should be put into the resources.
static LPCSTR szTitle = "Create New Task";
@ -1689,10 +1692,10 @@ void StartMenuHandler::ShowLaunchDialog(HWND hwndDesktopBar)
MultiByteToWideChar(CP_ACP, 0, szTitle, -1, wTitle, 40);
MultiByteToWideChar(CP_ACP, 0, szText, -1, wText, 256);
(*RunFileDlg)(hwndDesktopBar, 0, NULL, (LPCSTR)wTitle, (LPCSTR)wText, RFF_CALCDIRECTORY);
(*RunFileDlg)(hwndOwner, 0, NULL, (LPCSTR)wTitle, (LPCSTR)wText, RFF_CALCDIRECTORY);
}
else
(*RunFileDlg)(hwndDesktopBar, 0, NULL, szTitle, szText, RFF_CALCDIRECTORY);
(*RunFileDlg)(hwndOwner, 0, NULL, szTitle, szText, RFF_CALCDIRECTORY);
}
}
@ -1734,6 +1737,8 @@ void SettingsMenu::AddEntries()
if (!g_Globals._SHRestricted || !SHRestricted(REST_NOCONTROLPANEL))
#endif
AddButton(ResString(IDS_SETTINGS_MENU), ICID_CONFIG, true, IDC_SETTINGS_MENU);
AddButton(ResString(IDS_DESKTOPBAR_SETTINGS), ICID_CONFIG, false, ID_DESKTOPBAR_SETTINGS);
}
void BrowseMenu::AddEntries()

View file

@ -333,7 +333,7 @@ struct StartMenuHandler : public StartMenu
protected:
int Command(int id, int code);
static void ShowLaunchDialog(HWND hwndDesktopBar);
static void ShowLaunchDialog(HWND hwndOwner);
static void ShowRestartDialog(HWND hwndOwner, UINT flags);
static void ShowSearchDialog();
static void ShowSearchComputer();

View file

@ -900,16 +900,42 @@ void ColorButton::DrawItem(LPDRAWITEMSTRUCT dis)
void PictureButton::DrawItem(LPDRAWITEMSTRUCT dis)
{
UINT state = DFCS_BUTTONPUSH;
int style = GetWindowStyle(_hwnd);
if (dis->itemState & ODS_DISABLED)
state |= DFCS_INACTIVE;
POINT iconPos = {dis->rcItem.left+2, (dis->rcItem.top+dis->rcItem.bottom-16)/2};
RECT textRect = {dis->rcItem.left+16+4, dis->rcItem.top+2, dis->rcItem.right-4, dis->rcItem.bottom-4};
POINT imagePos;
RECT textRect;
int dt_flags;
if (style & BS_BOTTOM) {
// align horizontal centered, vertical floating
imagePos.x = (dis->rcItem.left + dis->rcItem.right - _cx) / 2;
imagePos.y = dis->rcItem.top + 2;
textRect.left = dis->rcItem.left + 2;
textRect.top = dis->rcItem.top + _cy + 4;
textRect.right = dis->rcItem.right - 4;
textRect.bottom = dis->rcItem.bottom - 4;
dt_flags = DT_SINGLELINE|DT_CENTER|DT_VCENTER;
} else {
// horizontal floating, vertical centered
imagePos.x = dis->rcItem.left + 2;
imagePos.y = (dis->rcItem.top + dis->rcItem.bottom - _cy)/2;
textRect.left = dis->rcItem.left + _cx + 4;
textRect.top = dis->rcItem.top + 2;
textRect.right = dis->rcItem.right - 4;
textRect.bottom = dis->rcItem.bottom - 4;
dt_flags = DT_SINGLELINE|DT_VCENTER/*|DT_CENTER*/;
}
if (dis->itemState & ODS_SELECTED) {
state |= DFCS_PUSHED;
++iconPos.x; ++iconPos.y;
++imagePos.x; ++imagePos.y;
++textRect.left; ++textRect.top;
++textRect.right; ++textRect.bottom;
}
@ -917,13 +943,19 @@ void PictureButton::DrawItem(LPDRAWITEMSTRUCT dis)
if (_flat) {
FillRect(dis->hDC, &dis->rcItem, _hBrush);
if (GetWindowStyle(_hwnd) & BS_FLAT) // Only with BS_FLAT set, there will be drawn a frame without highlight.
if (style & BS_FLAT) // Only with BS_FLAT set, there will be drawn a frame without highlight.
DrawEdge(dis->hDC, &dis->rcItem, EDGE_RAISED, BF_RECT|BF_FLAT);
} else
//DrawFrameControl(dis->hDC, &dis->rcItem, DFC_BUTTON, state);
DrawButton(dis->hDC, &dis->rcItem, state, _hBrush);
DrawIconEx(dis->hDC, iconPos.x, iconPos.y, _hIcon, 16, 16, 0, _hBrush, DI_NORMAL);
if (_hIcon)
DrawIconEx(dis->hDC, imagePos.x, imagePos.y, _hIcon, _cx, _cy, 0, _hBrush, DI_NORMAL);
else {
MemCanvas mem_dc;
BitmapSelection sel(mem_dc, _hBmp);
BitBlt(dis->hDC, imagePos.x, imagePos.y, _cx, _cy, mem_dc, 0, 0, SRCCOPY);
}
TCHAR title[BUFFER_LEN];
GetWindowText(_hwnd, title, BUFFER_LEN);
@ -931,10 +963,10 @@ void PictureButton::DrawItem(LPDRAWITEMSTRUCT dis)
BkMode bk_mode(dis->hDC, TRANSPARENT);
if (dis->itemState & (ODS_DISABLED|ODS_GRAYED))
DrawGrayText(dis->hDC, &textRect, title, DT_SINGLELINE|DT_VCENTER/*|DT_CENTER*/);
DrawGrayText(dis->hDC, &textRect, title, dt_flags);
else {
TextColor lcColor(dis->hDC, GetSysColor(COLOR_BTNTEXT));
DrawText(dis->hDC, title, -1, &textRect, DT_SINGLELINE|DT_VCENTER/*|DT_CENTER*/);
DrawText(dis->hDC, title, -1, &textRect, dt_flags);
}
if (dis->itemState & ODS_FOCUS) {
@ -1343,3 +1375,10 @@ INT_PTR CALLBACK PropSheetPageDlg::DialogProc(HWND hwnd, UINT nmsg, WPARAM wpara
return FALSE; // message has not been processed
}
int PropSheetPageDlg::Command(int id, int code)
{
// override call to EndDialog in Dialog::Command();
return FALSE;
}

View file

@ -402,6 +402,8 @@ protected:
friend struct PropSheetPage;
static INT_PTR CALLBACK DialogProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam);
int Command(int id, int code);
};
@ -686,15 +688,47 @@ struct PictureButton : public OwnerdrawnButton
typedef OwnerdrawnButton super;
PictureButton(HWND hwnd, HICON hIcon, HBRUSH hbrush=GetSysColorBrush(COLOR_BTNFACE), bool flat=false)
: super(hwnd), _hIcon(hIcon), _hBrush(hbrush), _flat(flat)
: super(hwnd), _hIcon(hIcon), _hBmp(0), _hBrush(hbrush), _flat(flat)
{
_cx = 16;
_cy = 16;
}
PictureButton(HWND hparent, int id, HICON hIcon, HBRUSH hbrush=GetSysColorBrush(COLOR_BTNFACE), bool flat=false)
: super(GetDlgItem(hparent, id)), _hIcon(hIcon), _hBmp(0), _hBrush(hbrush), _flat(flat)
{
_cx = 16;
_cy = 16;
}
PictureButton(HWND hwnd, HBITMAP hBmp, HBRUSH hbrush=GetSysColorBrush(COLOR_BTNFACE), bool flat=false)
: super(hwnd), _hIcon(0), _hBmp(hBmp), _hBrush(hbrush), _flat(flat)
{
BITMAP bmp;
GetObject(hBmp, sizeof(bmp), &bmp);
_cx = bmp.bmWidth;
_cy = bmp.bmHeight;
}
PictureButton(HWND hparent, int id, HBITMAP hBmp, HBRUSH hbrush=GetSysColorBrush(COLOR_BTNFACE), bool flat=false)
: super(GetDlgItem(hparent, id)), _hIcon(0), _hBmp(hBmp), _hBrush(hbrush), _flat(flat)
{
BITMAP bmp;
GetObject(hBmp, sizeof(bmp), &bmp);
_cx = bmp.bmWidth;
_cy = bmp.bmHeight;
}
protected:
virtual void DrawItem(LPDRAWITEMSTRUCT dis);
HICON _hIcon;
HBITMAP _hBmp;
HBRUSH _hBrush;
int _cx;
int _cy;
bool _flat;
};