display icons of size 24x24 per default in the start menu root
Modified: trunk/reactos/subsys/system/explorer/explorer.cpp
Modified: trunk/reactos/subsys/system/explorer/explorer_intres.rc
Modified: trunk/reactos/subsys/system/explorer/globals.h
Modified: trunk/reactos/subsys/system/explorer/resource.h
Modified: trunk/reactos/subsys/system/explorer/shell/entries.cpp
Modified: trunk/reactos/subsys/system/explorer/shell/entries.h
Modified: trunk/reactos/subsys/system/explorer/taskbar/desktopbar.cpp
Modified: trunk/reactos/subsys/system/explorer/taskbar/startmenu.cpp
Modified: trunk/reactos/subsys/system/explorer/taskbar/startmenu.h
Modified: trunk/reactos/subsys/system/explorer/utility/window.h
_____
Modified: trunk/reactos/subsys/system/explorer/explorer.cpp
--- trunk/reactos/subsys/system/explorer/explorer.cpp 2006-01-16
22:07:38 UTC (rev 20923)
+++ trunk/reactos/subsys/system/explorer/explorer.cpp 2006-01-16
23:00:38 UTC (rev 20924)
@@ -253,6 +253,13 @@
{
}
+Icon::Icon(ICON_ID id, UINT nid, int icon_size)
+ : _id(id),
+ _itype(IT_STATIC),
+ _hicon(ResIconEx(nid, icon_size, icon_size))
+{
+}
+
Icon::Icon(ICON_TYPE itype, int id, HICON hIcon)
: _id((ICON_ID)id),
_itype(itype),
@@ -322,10 +329,10 @@
return ret;
}
-HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd, HDC
hdc_wnd/*, bool large_icons*/)
+HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd, HDC
hdc_wnd/*, int icon_size*/)
{
- int cx = GetSystemMetrics(SM_CXSMICON); //ICON_SIZE_X;
- int cy = GetSystemMetrics(SM_CYSMICON); //ICON_SIZE_Y;
+ int cx = ICON_SIZE_SMALL;
+ int cy = ICON_SIZE_SMALL;
HBITMAP hbmp = CreateCompatibleBitmap(hdc_wnd, cx, cy);
MemCanvas canvas;
@@ -373,33 +380,35 @@
void IconCache::init()
{
+ int icon_size = STARTMENUROOT_ICON_SIZE;
+
_icons[ICID_NONE] = Icon(IT_STATIC, ICID_NONE,
(HICON)0);
_icons[ICID_FOLDER] = Icon(ICID_FOLDER,
IDI_FOLDER);
//_icons[ICID_DOCUMENT] = Icon(ICID_DOCUMENT, IDI_DOCUMENT);
_icons[ICID_EXPLORER] = Icon(ICID_EXPLORER, IDI_EXPLORER);
- _icons[ICID_APP] = Icon(ICID_APP,
IDI_APPICON);
+// _icons[ICID_APP] = Icon(ICID_APP,
IDI_APPICON);
- _icons[ICID_CONFIG] = Icon(ICID_CONFIG,
IDI_CONFIG);
- _icons[ICID_DOCUMENTS] = Icon(ICID_DOCUMENTS, IDI_DOCUMENTS);
- _icons[ICID_FAVORITES] = Icon(ICID_FAVORITES, IDI_FAVORITES);
- _icons[ICID_INFO] = Icon(ICID_INFO,
IDI_INFO);
- _icons[ICID_APPS] = Icon(ICID_APPS,
IDI_APPS);
- _icons[ICID_SEARCH] = Icon(ICID_SEARCH,
IDI_SEARCH);
- _icons[ICID_ACTION] = Icon(ICID_ACTION,
IDI_ACTION);
- _icons[ICID_SEARCH_DOC] = Icon(ICID_SEARCH_DOC, IDI_SEARCH_DOC);
- _icons[ICID_PRINTER] = Icon(ICID_PRINTER, IDI_PRINTER);
- _icons[ICID_NETWORK] = Icon(ICID_NETWORK, IDI_NETWORK);
- _icons[ICID_COMPUTER] = Icon(ICID_COMPUTER, IDI_COMPUTER);
- _icons[ICID_LOGOFF] = Icon(ICID_LOGOFF,
IDI_LOGOFF);
- _icons[ICID_SHUTDOWN] = Icon(ICID_SHUTDOWN, IDI_SHUTDOWN);
- _icons[ICID_BOOKMARK] = Icon(ICID_BOOKMARK, IDI_DOT_TRANS);
- _icons[ICID_MINIMIZE] = Icon(ICID_MINIMIZE, IDI_MINIMIZE);
- _icons[ICID_CONTROLPAN] = Icon(ICID_CONTROLPAN,
IDI_CONTROLPAN);
- _icons[ICID_DESKSETTING] = Icon(ICID_DESKSETTING,
IDI_DESKSETTING);
- _icons[ICID_NETCONNS] = Icon(ICID_NETCONNS,
IDI_NETCONNS);
- _icons[ICID_ADMINISTRATION] = Icon(ICID_ADMINISTRATION,
IDI_ADMINISTRATION);
- _icons[ICID_RECENT] = Icon(ICID_RECENT, IDI_RECENT);
+ _icons[ICID_CONFIG] = Icon(ICID_CONFIG,
IDI_CONFIG, icon_size);
+ _icons[ICID_DOCUMENTS] = Icon(ICID_DOCUMENTS, IDI_DOCUMENTS,
icon_size);
+ _icons[ICID_FAVORITES] = Icon(ICID_FAVORITES, IDI_FAVORITES,
icon_size);
+ _icons[ICID_INFO] = Icon(ICID_INFO,
IDI_INFO, icon_size);
+ _icons[ICID_APPS] = Icon(ICID_APPS,
IDI_APPS, icon_size);
+ _icons[ICID_SEARCH] = Icon(ICID_SEARCH, IDI_SEARCH,
icon_size);
+ _icons[ICID_ACTION] = Icon(ICID_ACTION, IDI_ACTION,
icon_size);
+ _icons[ICID_SEARCH_DOC] = Icon(ICID_SEARCH_DOC, IDI_SEARCH_DOC,
icon_size);
+ _icons[ICID_PRINTER] = Icon(ICID_PRINTER, IDI_PRINTER,
icon_size);
+ _icons[ICID_NETWORK] = Icon(ICID_NETWORK, IDI_NETWORK,
icon_size);
+ _icons[ICID_COMPUTER] = Icon(ICID_COMPUTER, IDI_COMPUTER,
icon_size);
+ _icons[ICID_LOGOFF] = Icon(ICID_LOGOFF, IDI_LOGOFF,
icon_size);
+ _icons[ICID_SHUTDOWN] = Icon(ICID_SHUTDOWN, IDI_SHUTDOWN,
icon_size);
+ _icons[ICID_BOOKMARK] = Icon(ICID_BOOKMARK, IDI_DOT_TRANS,
icon_size);
+ _icons[ICID_MINIMIZE] = Icon(ICID_MINIMIZE, IDI_MINIMIZE,
icon_size);
+ _icons[ICID_CONTROLPAN] = Icon(ICID_CONTROLPAN, IDI_CONTROLPAN,
icon_size);
+ _icons[ICID_DESKSETTING]=
Icon(ICID_DESKSETTING,IDI_DESKSETTING,icon_size);
+ _icons[ICID_NETCONNS] = Icon(ICID_NETCONNS, IDI_NETCONNS,
icon_size);
+ _icons[ICID_ADMIN] = Icon(ICID_ADMIN,
IDI_ADMIN, icon_size);
+ _icons[ICID_RECENT] = Icon(ICID_RECENT, IDI_RECENT,
icon_size);
}
@@ -437,10 +446,10 @@
if (flags & ICF_OPEN)
shgfi_flags |= SHGFI_OPENICON;
- if ((flags&(ICF_LARGE|ICF_OVERLAYS|ICF_HICON)) &&
!(flags&ICF_SYSCACHE)) {
+ if ((flags&(ICF_LARGE|ICF_MIDDLE|ICF_OVERLAYS|ICF_HICON)) &&
!(flags&ICF_SYSCACHE)) {
shgfi_flags |= SHGFI_ICON;
- if (!(flags & ICF_LARGE))
+ if (!(flags & (ICF_LARGE|ICF_MIDDLE)))
shgfi_flags |= SHGFI_SMALLICON;
if (flags & ICF_OVERLAYS)
@@ -510,11 +519,11 @@
HICON hIconLarge = 0;
HICON hIcon;
- bool large_icons = flags & ICF_LARGE;
- HRESULT hr = pExtract->Extract(path, icon_idx, &hIconLarge,
&hIcon, MAKELONG(GetSystemMetrics(SM_CXICON), ICON_SIZE_X));
+ int icon_size = ICON_SIZE_FROM_ICF(flags);
+ HRESULT hr = pExtract->Extract(path, icon_idx, &hIconLarge,
&hIcon, MAKELONG(GetSystemMetrics(SM_CXICON), icon_size));
if (hr == NOERROR) { //@@ oder SUCCEEDED(hr) ?
- if (large_icons) { //@@ OK?
+ if (icon_size > ICON_SIZE_SMALL) { //@@ OK?
if (hIcon)
DestroyIcon(hIcon);
_____
Modified: trunk/reactos/subsys/system/explorer/explorer_intres.rc
--- trunk/reactos/subsys/system/explorer/explorer_intres.rc
2006-01-16 22:07:38 UTC (rev 20923)
+++ trunk/reactos/subsys/system/explorer/explorer_intres.rc
2006-01-16 23:00:38 UTC (rev 20924)
@@ -169,7 +169,7 @@
IDI_CONTROLPAN ICON DISCARDABLE "res/control-panel.ico"
IDI_DESKSETTING ICON DISCARDABLE
"res/desktop-settings.ico"
IDI_NETCONNS ICON DISCARDABLE "res/network-conns.ico"
-IDI_ADMINISTRATION ICON DISCARDABLE
"res/administration.ico"
+IDI_ADMIN ICON DISCARDABLE
"res/administration.ico"
IDI_RECENT ICON DISCARDABLE
"res/recent-documents.ico"
#endif // Neutral resources
////////////////////////////////////////////////////////////////////////
/////
_____
Modified: trunk/reactos/subsys/system/explorer/globals.h
--- trunk/reactos/subsys/system/explorer/globals.h 2006-01-16
22:07:38 UTC (rev 20923)
+++ trunk/reactos/subsys/system/explorer/globals.h 2006-01-16
23:00:38 UTC (rev 20924)
@@ -86,7 +86,7 @@
ICID_CONTROLPAN,
ICID_DESKSETTING,
ICID_NETCONNS,
- ICID_ADMINISTRATION,
+ ICID_ADMIN,
ICID_RECENT,
ICID_DYNAMIC
@@ -95,6 +95,7 @@
struct Icon {
Icon();
Icon(ICON_ID id, UINT nid);
+ Icon(ICON_ID id, UINT nid, int icon_size);
Icon(ICON_TYPE itype, int id, HICON hIcon);
Icon(ICON_TYPE itype, int id, int sys_idx);
@@ -157,12 +158,18 @@
};
-#define ICON_SIZE_X GetSystemMetrics(large_icons?
SM_CXICON: SM_CXSMICON)
-#define ICON_SIZE_Y GetSystemMetrics(large_icons?
SM_CYICON: SM_CYSMICON)
+#define ICON_SIZE_SMALL 16 //
GetSystemMetrics(SM_CXSMICON)
+#define ICON_SIZE_MIDDLE 24 // special size for start menu
root icons
+#define ICON_SIZE_LARGE 32 //
GetSystemMetrics(SM_CXICON)
+#define STARTMENUROOT_ICON_SIZE ICON_SIZE_MIDDLE
// ICON_SIZE_LARGE
+#define ICON_SIZE_FROM_ICF(flags) (flags&ICF_LARGE?
ICON_SIZE_LARGE: flags&ICF_MIDDLE? ICON_SIZE_MIDDLE: ICON_SIZE_SMALL)
+#define ICF_FROM_ICON_SIZE(size) (size>=ICON_SIZE_LARGE?
ICF_LARGE: size>=ICON_SIZE_MIDDLE? ICF_MIDDLE: ICF_NORMAL)
+
+
/// create a bitmap from an icon
-extern HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH
hbrush_bkgnd, HDC hdc_wnd/*, bool large_icons*/);
+extern HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH
hbrush_bkgnd, HDC hdc_wnd/*, int icon_size*/);
/// add icon with alpha channel to imagelist using the specified
background color
extern int ImageList_AddAlphaIcon(HIMAGELIST himl, HICON hIcon, HBRUSH
hbrush_bkgnd, HDC hdc_wnd);
_____
Modified: trunk/reactos/subsys/system/explorer/resource.h
--- trunk/reactos/subsys/system/explorer/resource.h 2006-01-16
22:07:38 UTC (rev 20923)
+++ trunk/reactos/subsys/system/explorer/resource.h 2006-01-16
23:00:38 UTC (rev 20924)
@@ -121,7 +121,7 @@
#define IDI_CONTROLPAN 173
#define IDI_DESKSETTING 174
#define IDI_NETCONNS 175
-#define IDI_ADMINISTRATION 176
+#define IDI_ADMIN 176
#define IDI_RECENT 178
#define ID_VIEW_NAME 401
#define ID_VIEW_ALL_ATTRIBUTES 402
_____
Modified: trunk/reactos/subsys/system/explorer/shell/entries.cpp
--- trunk/reactos/subsys/system/explorer/shell/entries.cpp
2006-01-16 22:07:38 UTC (rev 20923)
+++ trunk/reactos/subsys/system/explorer/shell/entries.cpp
2006-01-16 23:00:38 UTC (rev 20924)
@@ -361,9 +361,9 @@
ICON_ID icon_id = ICID_NONE;
- // not for ET_SHELL to display the correct desktop icon
- if (_etype!=ET_SHELL && get_path(path, COUNTOF(path)))
- icon_id = g_Globals._icon_cache.extract(path, flags);
+ if (_etype!=ET_SHELL && get_path(path, COUNTOF(path))) // not
for ET_SHELL to display the correct desktop icon
+ if (!(flags & ICF_MIDDLE)) // not for ICF_MIDDLE to
extract 24x24 icons because SHGetFileInfo() doesn't support this icon
size
+ icon_id = g_Globals._icon_cache.extract(path,
flags);
if (icon_id == ICID_NONE) {
if (!(flags & ICF_OVERLAYS)) {
@@ -418,7 +418,7 @@
int shgfi_flags = SHGFI_PIDL;
- if (!(flags & ICF_LARGE))
+ if (!(flags & (ICF_LARGE|ICF_MIDDLE)))
shgfi_flags |= SHGFI_SMALLICON;
if (flags & ICF_OPEN)
_____
Modified: trunk/reactos/subsys/system/explorer/shell/entries.h
--- trunk/reactos/subsys/system/explorer/shell/entries.h
2006-01-16 22:07:38 UTC (rev 20923)
+++ trunk/reactos/subsys/system/explorer/shell/entries.h
2006-01-16 23:00:38 UTC (rev 20924)
@@ -65,11 +65,12 @@
enum ICONCACHE_FLAGS {
ICF_NORMAL = 0,
- ICF_LARGE = 1,
- ICF_OPEN = 2,
- ICF_OVERLAYS = 4,
- ICF_HICON = 8,
- ICF_SYSCACHE = 16
+ ICF_MIDDLE = 1,
+ ICF_LARGE = 2,
+ ICF_OPEN = 4,
+ ICF_OVERLAYS = 8,
+ ICF_HICON = 16,
+ ICF_SYSCACHE = 32
};
#ifndef SHGFI_ADDOVERLAYS // missing in MinGW (as of 28.12.2005)
_____
Modified: trunk/reactos/subsys/system/explorer/taskbar/desktopbar.cpp
--- trunk/reactos/subsys/system/explorer/taskbar/desktopbar.cpp
2006-01-16 22:07:38 UTC (rev 20923)
+++ trunk/reactos/subsys/system/explorer/taskbar/desktopbar.cpp
2006-01-16 23:00:38 UTC (rev 20924)
@@ -161,7 +161,7 @@
RegisterHotkeys();
// prepare Startmenu, but hide it for now
- _startMenuRoot = GET_WINDOW(StartMenuRoot,
StartMenuRoot::Create(_hwnd, true)); //@@ _large_icons
+ _startMenuRoot = GET_WINDOW(StartMenuRoot,
StartMenuRoot::Create(_hwnd, STARTMENUROOT_ICON_SIZE));
return 0;
}
_____
Modified: trunk/reactos/subsys/system/explorer/taskbar/startmenu.cpp
--- trunk/reactos/subsys/system/explorer/taskbar/startmenu.cpp
2006-01-16 22:07:38 UTC (rev 20923)
+++ trunk/reactos/subsys/system/explorer/taskbar/startmenu.cpp
2006-01-16 23:00:38 UTC (rev 20924)
@@ -46,9 +46,9 @@
#define SHELLPATH_NET_CONNECTIONS
TEXT("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2
DD-08002B30309D}\\::{7007ACC7-3202-11D1-AAD2-00805FC1270E}")
-StartMenu::StartMenu(HWND hwnd, bool large_icons)
+StartMenu::StartMenu(HWND hwnd, int icon_size)
: super(hwnd),
- _large_icons(large_icons)
+ _icon_size(icon_size)
{
_next_id = IDC_FIRST_MENU;
_submenu_id = 0;
@@ -70,10 +70,10 @@
#endif
}
-StartMenu::StartMenu(HWND hwnd, const StartMenuCreateInfo& create_info,
bool large_icons)
+StartMenu::StartMenu(HWND hwnd, const StartMenuCreateInfo& create_info,
int icon_size)
: super(hwnd),
_create_info(create_info),
- _large_icons(large_icons)
+ _icon_size(icon_size)
{
for(StartMenuFolders::const_iterator
it=create_info._folders.begin(); it!=create_info._folders.end(); ++it)
if (*it)
@@ -133,11 +133,11 @@
top_height = 0;
}
- bool large_icons = false;
- RECT rect = {x, y-STARTMENU_LINE_HEIGHT-top_height,
x+STARTMENU_WIDTH_MIN, y};
+ int icon_size = ICON_SIZE_SMALL;
+ RECT rect = {x, y-STARTMENU_LINE_HEIGHT(icon_size)-top_height,
x+STARTMENU_WIDTH_MIN, y};
#ifndef _LIGHT_STARTMENU
- rect.top += STARTMENU_LINE_HEIGHT;
+ rect.top += STARTMENU_LINE_HEIGHT(icon_size);
#endif
AdjustWindowRectEx(&rect, style, FALSE, ex_style);
@@ -391,7 +391,7 @@
if (_arrow_btns) {
RECT rect_up, rect_down;
- GetArrowButtonRects(&rect_up,
&rect_down, _large_icons);
+ GetArrowButtonRects(&rect_up,
&rect_down, _icon_size);
SCROLL_MODE scroll_mode = SCROLL_NOT;
@@ -515,8 +515,8 @@
int StartMenu::ButtonHitTest(POINT pt)
{
ClientRect clnt(_hwnd);
- const bool large_icons = _large_icons;
- RECT rect = {_border_left, _border_top, clnt.right,
STARTMENU_LINE_HEIGHT};
+ const int icon_size = _icon_size;
+ RECT rect = {_border_left, _border_top, clnt.right,
STARTMENU_LINE_HEIGHT(icon_size)};
if (pt.x<rect.left || pt.x>rect.right)
return 0;
@@ -527,7 +527,7 @@
if (rect.top > pt.y)
break;
- rect.bottom = rect.top + (info._id==-1?
STARTMENU_SEP_HEIGHT: STARTMENU_LINE_HEIGHT);
+ rect.bottom = rect.top + (info._id==-1?
STARTMENU_SEP_HEIGHT(icon_size): STARTMENU_LINE_HEIGHT(icon_size));
if (rect.bottom > _bottom_max)
break;
@@ -547,13 +547,13 @@
return;
ClientRect clnt(_hwnd);
- const bool large_icons = _large_icons;
- RECT rect = {_border_left, _border_top, clnt.right,
STARTMENU_LINE_HEIGHT};
+ const int icon_size = _icon_size;
+ RECT rect = {_border_left, _border_top, clnt.right,
STARTMENU_LINE_HEIGHT(icon_size)};
for(SMBtnVector::const_iterator it=_buttons.begin()+_scroll_pos;
it!=_buttons.end(); ++it) {
const SMBtnInfo& info = *it;
- rect.bottom = rect.top + (info._id==-1?
STARTMENU_SEP_HEIGHT: STARTMENU_LINE_HEIGHT);
+ rect.bottom = rect.top + (info._id==-1?
STARTMENU_SEP_HEIGHT(icon_size): STARTMENU_LINE_HEIGHT(icon_size));
if (info._id == _selected_id) {
InvalidateRect(_hwnd, &rect, TRUE);
@@ -773,13 +773,13 @@
{
#ifdef _LIGHT_STARTMENU
ClientRect clnt(_hwnd);
- const bool large_icons = _large_icons;
- RECT rect = {_border_left, _border_top, clnt.right,
STARTMENU_LINE_HEIGHT};
+ const int icon_size = _icon_size;
+ RECT rect = {_border_left, _border_top, clnt.right,
STARTMENU_LINE_HEIGHT(icon_size)};
for(SMBtnVector::const_iterator it=_buttons.begin()+_scroll_pos;
it!=_buttons.end(); ++it) {
const SMBtnInfo& info = *it;
- rect.bottom = rect.top + (info._id==-1?
STARTMENU_SEP_HEIGHT: STARTMENU_LINE_HEIGHT);
+ rect.bottom = rect.top + (info._id==-1?
STARTMENU_SEP_HEIGHT(icon_size): STARTMENU_LINE_HEIGHT(icon_size));
if (info._id == id) {
*prect = rect;
@@ -823,10 +823,10 @@
}
-void StartMenu::DrawArrows(HDC hdc, bool large_icons)
+void StartMenu::DrawArrows(HDC hdc, int icon_size)
{
- int cx = large_icons? 16: 8;
- int cy = large_icons? 8: 4;
+ int cx = icon_size / 2;
+ int cy = icon_size / 4;
ResIconEx arrowUpIcon(IDI_ARROW_UP, cx, cy);
ResIconEx arrowDownIcon(IDI_ARROW_DOWN, cx, cy);
@@ -837,10 +837,10 @@
DrawIconEx(hdc, clnt.right/2-cx/2, clnt.bottom-cy-1,
arrowDownIcon, cx, cy, 0, 0, DI_NORMAL);
}
-void StartMenu::GetArrowButtonRects(LPRECT prect_up, LPRECT prect_down,
bool large_icons)
+void StartMenu::GetArrowButtonRects(LPRECT prect_up, LPRECT prect_down,
int icon_size)
{
- int cx = large_icons? 16: 8;
- int cy = large_icons? 8: 4;
+ int cx = icon_size / 2;
+ int cy = icon_size / 4;
GetClientRect(_hwnd, prect_up);
*prect_down = *prect_up;
@@ -865,11 +865,11 @@
#ifdef _LIGHT_STARTMENU
if (_arrow_btns)
- DrawArrows(canvas, _large_icons);
+ DrawArrows(canvas, _icon_size);
ClientRect clnt(_hwnd);
- const bool large_icons = _large_icons;
- RECT rect = {_border_left, _border_top, clnt.right,
STARTMENU_LINE_HEIGHT};
+ const int icon_size = _icon_size;
+ RECT rect = {_border_left, _border_top, clnt.right,
STARTMENU_LINE_HEIGHT(icon_size)};
int sep_width = rect.right-rect.left - 4;
@@ -883,24 +883,24 @@
break;
if (btn._id == -1) { // a separator?
- rect.bottom = rect.top + STARTMENU_SEP_HEIGHT;
+ rect.bottom = rect.top +
STARTMENU_SEP_HEIGHT(icon_size);
if (rect.bottom > _bottom_max)
break;
BrushSelection brush_sel(canvas,
GetSysColorBrush(COLOR_BTNSHADOW));
- PatBlt(canvas, rect.left+2,
rect.top+STARTMENU_SEP_HEIGHT/2-1, sep_width, 1, PATCOPY);
+ PatBlt(canvas, rect.left+2,
rect.top+STARTMENU_SEP_HEIGHT(icon_size)/2-1, sep_width, 1, PATCOPY);
SelectBrush(canvas,
GetSysColorBrush(COLOR_BTNHIGHLIGHT));
- PatBlt(canvas, rect.left+2,
rect.top+STARTMENU_SEP_HEIGHT/2, sep_width, 1, PATCOPY);
+ PatBlt(canvas, rect.left+2,
rect.top+STARTMENU_SEP_HEIGHT(icon_size)/2, sep_width, 1, PATCOPY);
} else {
- rect.bottom = rect.top + STARTMENU_LINE_HEIGHT;
+ rect.bottom = rect.top +
STARTMENU_LINE_HEIGHT(icon_size);
if (rect.bottom > _bottom_max)
break;
if (rect.top >= canvas.rcPaint.top)
- DrawStartMenuButton(canvas, rect,
btn._title, btn, btn._id==_selected_id, false, _large_icons);
+ DrawStartMenuButton(canvas, rect,
btn._title, btn, btn._id==_selected_id, false, _icon_size);
}
rect.top = rect.bottom;
@@ -930,7 +930,7 @@
Entry* entry = *it;
if (entry->_icon_id == ICID_UNKNOWN)
- entry->_icon_id =
entry->safe_extract_icon(_large_icons? ICF_LARGE: ICF_NORMAL);
+ entry->_icon_id =
entry->safe_extract_icon(ICF_FROM_ICON_SIZE(_icon_size));
if (entry->_icon_id > ICID_NONE) {
btn._icon_id = (ICON_ID)/*@@*/
entry->_icon_id;
@@ -943,7 +943,7 @@
break;
WindowCanvas canvas(_hwnd);
- DrawStartMenuButton(canvas,
rect, NULL, btn, btn._id==_selected_id, false, _large_icons);
+ DrawStartMenuButton(canvas,
rect, NULL, btn, btn._id==_selected_id, false, _icon_size);
//InvalidateRect(_hwnd, &rect,
FALSE);
//UpdateWindow(_hwnd);
@@ -966,7 +966,7 @@
for(StartMenuShellDirs::iterator it=_dirs.begin();
it!=_dirs.end(); ++it) {
ShellDirectory& dir = it->_dir;
- icons_extracted += dir.extract_icons();
+ icons_extracted += dir.extract_icons(icon_size);
}
if (icons_extracted) {
@@ -1132,19 +1132,19 @@
ClientRect clnt(_hwnd);
// increase window height to make room for the new button
- rect.top -= STARTMENU_LINE_HEIGHT;
+ rect.top -= STARTMENU_LINE_HEIGHT(icon_size);
// move down if we are too high now
if (rect.top < 0) {
- rect.top += STARTMENU_LINE_HEIGHT;
- rect.bottom += STARTMENU_LINE_HEIGHT;
+ rect.top += STARTMENU_LINE_HEIGHT(icon_size);
+ rect.bottom += STARTMENU_LINE_HEIGHT(icon_size);
}
WindowCanvas canvas(_hwnd);
FontSelection font(canvas, GetStockFont(DEFAULT_GUI_FONT));
// widen window, if it is too small
- int text_width = GetStartMenuBtnTextWidth(canvas, title, _hwnd)
+ ICON_SIZE_X + 10/*placeholder*/ + 16/*arrow*/;
+ int text_width = GetStartMenuBtnTextWidth(canvas, title, _hwnd)
+ icon_size + 10/*placeholder*/ + 16/*arrow*/;
int cx = clnt.right - _border_left;
if (text_width > cx)
@@ -1166,12 +1166,12 @@
ClientRect clnt(_hwnd);
// increase window height to make room for the new separator
- rect.top -= STARTMENU_SEP_HEIGHT;
+ rect.top -= STARTMENU_SEP_HEIGHT(icon_size);
// move down if we are too high now
if (rect.top < 0) {
- rect.top += STARTMENU_LINE_HEIGHT;
- rect.bottom += STARTMENU_LINE_HEIGHT;
+ rect.top += STARTMENU_LINE_HEIGHT(icon_size);
+ rect.bottom += STARTMENU_LINE_HEIGHT(icon_size);
}
MoveWindow(_hwnd, rect.left, rect.top, rect.right-rect.left,
rect.bottom-rect.top, TRUE);
@@ -1262,8 +1262,8 @@
ClientToScreen(_hwnd, &rect);
x = rect.right; // Submenus should overlap their parent
a bit.
- const bool large_icons = _large_icons;
- y = rect.top+STARTMENU_LINE_HEIGHT +_border_top/*own
border*/ -STARTMENU_TOP_BTN_SPACE/*border of new submenu*/;
+ const int icon_size = _icon_size;
+ y = rect.top+STARTMENU_LINE_HEIGHT(icon_size)
+_border_top/*own border*/ -STARTMENU_TOP_BTN_SPACE/*border of new
submenu*/;
} else {
WindowRect pos(_hwnd);
@@ -1364,10 +1364,10 @@
}
#ifdef _LIGHT_STARTMENU
-void DrawStartMenuButton(HDC hdc, const RECT& rect, LPCTSTR title,
const SMBtnInfo& btn, bool has_focus, bool pushed, bool large_icons)
+void DrawStartMenuButton(HDC hdc, const RECT& rect, LPCTSTR title,
const SMBtnInfo& btn, bool has_focus, bool pushed, int icon_size)
#else
void DrawStartMenuButton(HDC hdc, const RECT& rect, LPCTSTR title,
HICON hIcon,
- bool
hasSubmenu, bool enabled, bool has_focus, bool pushed, bool
large_icons);
+ bool
hasSubmenu, bool enabled, bool has_focus, bool pushed, int icon_size);
#endif
{
UINT style = DFCS_BUTTONPUSH;
@@ -1375,8 +1375,8 @@
if (!btn._enabled)
style |= DFCS_INACTIVE;
- POINT iconPos = {rect.left+2,
(rect.top+rect.bottom-ICON_SIZE_Y)/2};
- RECT textRect = {rect.left+ICON_SIZE_X+4, rect.top+2,
rect.right-4, rect.bottom-4};
+ POINT iconPos = {rect.left+2,
(rect.top+rect.bottom-icon_size)/2};
+ RECT textRect = {rect.left+icon_size+4, rect.top+2,
rect.right-4, rect.bottom-4};
if (pushed) {
style |= DFCS_PUSHED;
@@ -1400,16 +1400,16 @@
FillRect(hdc, &rect, bk_brush);
if (btn._icon_id > ICID_NONE)
- g_Globals._icon_cache.get_icon(btn._icon_id).draw(hdc,
iconPos.x, iconPos.y, ICON_SIZE_X, ICON_SIZE_Y, bk_color, bk_brush/*,
large_icons*/);
+ g_Globals._icon_cache.get_icon(btn._icon_id).draw(hdc,
iconPos.x, iconPos.y, icon_size, icon_size, bk_color, bk_brush/*,
icon_size*/);
// draw submenu arrow at the right
if (btn._hasSubmenu) {
- ResIconEx arrowIcon(IDI_ARROW, ICON_SIZE_X,
ICON_SIZE_Y);
- ResIconEx selArrowIcon(IDI_ARROW_SELECTED, ICON_SIZE_X,
ICON_SIZE_Y);
+ ResIconEx arrowIcon(IDI_ARROW, icon_size, icon_size);
+ ResIconEx selArrowIcon(IDI_ARROW_SELECTED, icon_size,
icon_size);
- DrawIconEx(hdc, rect.right-ICON_SIZE_X, iconPos.y,
+ DrawIconEx(hdc, rect.right-icon_size, iconPos.y,
has_focus? selArrowIcon:
arrowIcon,
- ICON_SIZE_X, ICON_SIZE_Y, 0,
bk_brush, DI_NORMAL);
+ icon_size, icon_size, 0,
bk_brush, DI_NORMAL);
}
if (title) {
@@ -1434,7 +1434,7 @@
WindowCanvas canvas(_hwnd);
FontSelection font(canvas, GetStockFont(DEFAULT_GUI_FONT));
- const bool large_icons = _large_icons;
+ const int icon_size = _icon_size;
int max_width = STARTMENU_WIDTH_MIN;
int height = 0;
@@ -1446,13 +1446,13 @@
max_width = w;
if (it->_id == -1)
- height += STARTMENU_SEP_HEIGHT;
+ height += STARTMENU_SEP_HEIGHT(icon_size);
else
- height += STARTMENU_LINE_HEIGHT;
+ height += STARTMENU_LINE_HEIGHT(icon_size);
}
// calculate new window size
- int text_width = max_width + ICON_SIZE_X + 10/*placeholder*/ +
16/*arrow*/;
+ int text_width = max_width + icon_size + 10/*placeholder*/ +
16/*arrow*/;
RECT rt_hgt = {rect.left, rect.bottom-_border_top-height,
rect.left+_border_left+text_width, rect.bottom};
AdjustWindowRectEx(&rt_hgt, GetWindowStyle(_hwnd), FALSE,
GetWindowExStyle(_hwnd));
@@ -1475,8 +1475,8 @@
if (rect.bottom > cyscreen) {
_arrow_btns = true;
- _invisible_lines =
(rect.bottom-cyscreen+(STARTMENU_LINE_HEIGHT-1))/STARTMENU_LINE_HEIGHT +
1;
- rect.bottom -= _invisible_lines * STARTMENU_LINE_HEIGHT;
+ _invisible_lines =
(rect.bottom-cyscreen+(STARTMENU_LINE_HEIGHT(icon_size)-1))/STARTMENU_SE
P_HEIGHT(icon_size) + 1;
+ rect.bottom -= _invisible_lines *
STARTMENU_LINE_HEIGHT(icon_size);
bottom_max = rect.bottom;
@@ -1541,8 +1541,8 @@
#endif
-StartMenuRoot::StartMenuRoot(HWND hwnd)
- : super(hwnd, false) ///@todo big icons in start menu root
+StartMenuRoot::StartMenuRoot(HWND hwnd, const StartMenuRootCreateInfo&
info)
+ : super(hwnd, info._icon_size)
{
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of
29.10.2003)
if (!g_Globals._SHRestricted ||
!SHRestricted(REST_NOCOMMONGROUPS))
@@ -1579,29 +1579,33 @@
}
-static void CalculateStartPos(HWND hwndOwner, RECT& rect, bool
large_icons)
+static void CalculateStartPos(HWND hwndOwner, RECT& rect, int
icon_size)
{
WindowRect pos(hwndOwner);
rect.left = pos.left;
- rect.top = pos.top-STARTMENU_LINE_HEIGHT-4;
+ rect.top = pos.top-STARTMENU_LINE_HEIGHT(icon_size)-4;
rect.right = pos.left+STARTMENU_WIDTH_MIN;
rect.bottom = pos.top;
#ifndef _LIGHT_STARTMENU
- rect.top += STARTMENU_LINE_HEIGHT;
+ rect.top += STARTMENU_LINE_HEIGHT(icon_size);
#endif
AdjustWindowRectEx(&rect,
WS_POPUP|WS_THICKFRAME|WS_CLIPCHILDREN|WS_VISIBLE, FALSE, 0);
}
-HWND StartMenuRoot::Create(HWND hwndOwner, bool large_icons)
+HWND StartMenuRoot::Create(HWND hwndOwner, int icon_size)
{
RECT rect;
- CalculateStartPos(hwndOwner, rect, large_icons);
+ CalculateStartPos(hwndOwner, rect, icon_size);
- return Window::Create(WINDOW_CREATOR(StartMenuRoot), 0,
GetWndClasss(), TITLE_STARTMENU,
+ StartMenuRootCreateInfo create_info;
+
+ create_info._icon_size = icon_size;
+
+ return
Window::Create(WINDOW_CREATOR_INFO(StartMenuRoot,StartMenuRootCreateInfo
), &create_info, 0, GetWndClasss(), TITLE_STARTMENU,
WS_POPUP|WS_THICKFRAME|WS_CLIPCHILDREN,
rect.left,
rect.top, rect.right-rect.left, rect.bottom-rect.top, hwndOwner);
}
@@ -1620,7 +1624,7 @@
// recalculate start menu root position
RECT rect;
- CalculateStartPos(GetParent(hwnd), rect, _large_icons);
+ CalculateStartPos(GetParent(hwnd), rect, _icon_size);
SetWindowPos(hwnd, 0, rect.left, rect.top, rect.right-rect.left,
rect.bottom-rect.top, 0);
@@ -2150,7 +2154,7 @@
//TODO AddButton(ResString(IDS_PRINTERS),
ICID_PRINTER, true, IDC_PRINTERS_MENU);
AddButton(ResString(IDS_CONNECTIONS), ICID_NETCONNS,
false, IDC_CONNECTIONS);
#endif
- AddButton(ResString(IDS_ADMIN),
ICID_ADMINISTRATION, true, IDC_ADMIN);
+ AddButton(ResString(IDS_ADMIN),
ICID_ADMIN, true, IDC_ADMIN);
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of
29.10.2003)
if (!g_Globals._SHRestricted ||
!SHRestricted(REST_NOCONTROLPANEL))
_____
Modified: trunk/reactos/subsys/system/explorer/taskbar/startmenu.h
--- trunk/reactos/subsys/system/explorer/taskbar/startmenu.h
2006-01-16 22:07:38 UTC (rev 20923)
+++ trunk/reactos/subsys/system/explorer/taskbar/startmenu.h
2006-01-16 23:00:38 UTC (rev 20924)
@@ -30,10 +30,10 @@
#define TITLE_STARTMENU TEXT("Start Menu")
-#define STARTMENU_WIDTH_MIN 120
-#define STARTMENU_LINE_HEIGHT (ICON_SIZE_X+4)
-#define STARTMENU_SEP_HEIGHT (STARTMENU_LINE_HEIGHT/2)
-#define STARTMENU_TOP_BTN_SPACE 8
+#define STARTMENU_WIDTH_MIN
120
+#define STARTMENU_LINE_HEIGHT(icon_size) (icon_size+4)
+#define STARTMENU_SEP_HEIGHT(icon_size)
(STARTMENU_LINE_HEIGHT(icon_size)/2)
+#define STARTMENU_TOP_BTN_SPACE 8
// private message constants
@@ -110,7 +110,7 @@
{
StartMenuCtrl(HWND parent, int x, int y, int w, LPCTSTR title,
UINT id, HICON hIcon=0, bool
hasSubmenu=false, DWORD style=WS_VISIBLE|WS_CHILD|BS_OWNERDRAW, DWORD
exStyle=0)
- : Button(parent, title, x, y, w, STARTMENU_LINE_HEIGHT,
id, style, exStyle)
+ : Button(parent, title, x, y, w,
STARTMENU_LINE_HEIGHT(icon_size), id, style, exStyle)
{
*new StartMenuButton(_hwnd, hIcon, hasSubmenu);
@@ -123,7 +123,7 @@
struct StartMenuSeparator : public Static
{
StartMenuSeparator(HWND parent, int x, int y, int w, DWORD
style=WS_VISIBLE|WS_CHILD|WS_DISABLED|SS_ETCHEDHORZ, DWORD exStyle=0)
- : Static(parent, NULL, x, y+STARTMENU_SEP_HEIGHT/2-1, w,
2, -1, style, exStyle)
+ : Static(parent, NULL, x,
y+STARTMENU_SEP_HEIGHT(icon_size)/2-1, w, 2, -1, style, exStyle)
{
}
};
@@ -182,12 +182,12 @@
typedef vector<SMBtnInfo> SMBtnVector;
-extern void DrawStartMenuButton(HDC hdc, const RECT& rect, LPCTSTR
title, const SMBtnInfo& btn, bool has_focus, bool pushed, bool
large_icons);
+extern void DrawStartMenuButton(HDC hdc, const RECT& rect, LPCTSTR
title, const SMBtnInfo& btn, bool has_focus, bool pushed, int
icon_size);
#else
extern void DrawStartMenuButton(HDC hdc, const RECT& rect, LPCTSTR
title, HICON hIcon,
- bool
hasSubmenu, bool enabled, bool has_focus, bool pushed, bool
large_icons);
+ bool
hasSubmenu, bool enabled, bool has_focus, bool pushed, int icon_size);
#endif
@@ -209,8 +209,8 @@
typedef ExtContextMenuHandlerT<OwnerDrawParent<DialogWindow> >
super;
#endif
- StartMenu(HWND hwnd, bool large_icons=false);
- StartMenu(HWND hwnd, const StartMenuCreateInfo& create_info,
bool large_icons=false);
+ StartMenu(HWND hwnd, int icon_size=ICON_SIZE_SMALL);
+ StartMenu(HWND hwnd, const StartMenuCreateInfo& create_info, int
icon_size=ICON_SIZE_SMALL);
~StartMenu();
static HWND Create(int x, int y, const StartMenuFolders&, HWND
hwndParent, LPCTSTR title,
@@ -248,7 +248,7 @@
StartMenuCreateInfo _create_info; // copy of the original
create info
- bool _large_icons;
+ int _icon_size;
#ifdef _LIGHT_STARTMENU
SMBtnVector _buttons;
@@ -296,9 +296,9 @@
void DrawFloatingButton(HDC hdc);
void GetFloatingButtonRect(LPRECT prect);
- void GetArrowButtonRects(LPRECT prect_up, LPRECT prect_down,
bool large_icons);
+ void GetArrowButtonRects(LPRECT prect_up, LPRECT prect_down,
int icon_size);
- void DrawArrows(HDC hdc, bool large_icons);
+ void DrawArrows(HDC hdc, int icon_size);
void Paint(PaintCanvas& canvas);
void UpdateIcons(/*int idx*/);
@@ -333,13 +333,13 @@
{
typedef StartMenu super;
- StartMenuHandler(HWND hwnd, bool large_icons=false)
- : super(hwnd, large_icons)
+ StartMenuHandler(HWND hwnd, int icon_size=ICON_SIZE_SMALL)
+ : super(hwnd, icon_size)
{
}
- StartMenuHandler(HWND hwnd, const StartMenuCreateInfo&
create_info, bool large_icons=false)
- : super(hwnd, create_info, large_icons)
+ StartMenuHandler(HWND hwnd, const StartMenuCreateInfo&
create_info, int icon_size=ICON_SIZE_SMALL)
+ : super(hwnd, create_info, icon_size)
{
}
@@ -353,14 +353,20 @@
};
+struct StartMenuRootCreateInfo
+{
+ int _icon_size;
+};
+
+
/// Startmenu root window
struct StartMenuRoot : public StartMenuHandler
{
typedef StartMenuHandler super;
- StartMenuRoot(HWND hwnd);
+ StartMenuRoot(HWND hwnd, const StartMenuRootCreateInfo& info);
- static HWND Create(HWND hwndDesktopBar, bool large_icons);
+ static HWND Create(HWND hwndDesktopBar, int icon_size);
void TrackStartmenu();
protected:
_____
Modified: trunk/reactos/subsys/system/explorer/utility/window.h
--- trunk/reactos/subsys/system/explorer/utility/window.h
2006-01-16 22:07:38 UTC (rev 20923)
+++ trunk/reactos/subsys/system/explorer/utility/window.h
2006-01-16 23:00:38 UTC (rev 20924)
@@ -66,8 +66,8 @@
typedef Window* (*CREATORFUNC)(HWND);
typedef Window* (*CREATORFUNC_INFO)(HWND, const void*);
- static HWND Create(CREATORFUNC creator, DWORD dwExStyle,
- LPCTSTR lpClassName, LPCTSTR
lpWindowName,
+ static HWND Create(CREATORFUNC creator,
+ DWORD dwExStyle, LPCTSTR lpClassName,
LPCTSTR lpWindowName,
DWORD dwStyle, int x, int y, int w, int
h,
HWND hwndParent=0, HMENU hMenu=0/*,
LPVOID lpParam=0*/);