mirror of
https://github.com/reactos/reactos.git
synced 2024-07-06 20:55:16 +00:00
Added logo in start menu.
svn path=/trunk/; revision=5826
This commit is contained in:
parent
eed9914cd8
commit
becf23850d
|
@ -44,7 +44,7 @@ static BOOL (WINAPI*SetShellWindowEx)(HWND, HWND);
|
|||
|
||||
BOOL IsAnyDesktopRunning()
|
||||
{
|
||||
HINSTANCE shell32 = GetModuleHandle(TEXT("user32"));
|
||||
HINSTANCE shell32 = GetModuleHandle(_T("user32"));
|
||||
|
||||
SetShellWindow = (BOOL(WINAPI*)(HWND)) GetProcAddress(shell32, "SetShellWindow");
|
||||
SetShellWindowEx = (BOOL(WINAPI*)(HWND,HWND)) GetProcAddress(shell32, "SetShellWindowEx");
|
||||
|
@ -55,13 +55,6 @@ BOOL IsAnyDesktopRunning()
|
|||
|
||||
static void draw_desktop_background(HWND hwnd, HDC hdc)
|
||||
{
|
||||
// We'd want to draw the desktop wallpaper here. Need to
|
||||
// maintain a copy of the wallpaper in an off-screen DC and then
|
||||
// bitblt (or stretchblt?) it to the screen appropriately. For
|
||||
// now, though, we'll just draw some text.
|
||||
|
||||
static const TCHAR BkgndText[] = TEXT("ReactOS 0.1.2 Desktop Example\nby Silver Blade, Martin Fuchs");
|
||||
|
||||
ClientRect rect(hwnd);
|
||||
|
||||
PaintDesktop(hdc);
|
||||
|
@ -70,14 +63,14 @@ static void draw_desktop_background(HWND hwnd, HDC hdc)
|
|||
FillRect(hdc, &rect, bkgndBrush);
|
||||
DeleteBrush(bkgndBrush);
|
||||
*/
|
||||
// This next part could be improved by working out how much
|
||||
// space the text actually needs...
|
||||
|
||||
rect.left = rect.right - 280;
|
||||
rect.top = rect.bottom - 56 - DESKTOPBARBAR_HEIGHT;
|
||||
rect.right = rect.left + 250;
|
||||
rect.bottom = rect.top + 40;
|
||||
|
||||
static const LPCTSTR BkgndText = _T("ReactOS 0.1.2 Explorer\nby Martin Fuchs");
|
||||
|
||||
BkMode bkMode(hdc, TRANSPARENT);
|
||||
|
||||
TextColor textColor(hdc, RGB(128,128,192));
|
||||
|
@ -94,7 +87,7 @@ LRESULT BackgroundWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
|||
{
|
||||
switch(nmsg) {
|
||||
case WM_ERASEBKGND:
|
||||
draw_desktop_background(_hwnd, (HDC)wparam);
|
||||
PaintDesktop((HDC)wparam);
|
||||
return TRUE;
|
||||
|
||||
case WM_MBUTTONDBLCLK:
|
||||
|
@ -218,10 +211,9 @@ LRESULT DesktopWindow::Init(LPCREATESTRUCT pcs)
|
|||
LRESULT DesktopWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
switch(nmsg) {
|
||||
case WM_PAINT: {
|
||||
PaintCanvas canvas(_hwnd);
|
||||
draw_desktop_background(_hwnd, canvas);
|
||||
break;}
|
||||
case WM_PAINT:
|
||||
draw_desktop_background(_hwnd, PaintCanvas(_hwnd));
|
||||
break;
|
||||
|
||||
case WM_LBUTTONDBLCLK:
|
||||
case WM_RBUTTONDBLCLK:
|
||||
|
|
|
@ -74,6 +74,12 @@ SmallIcon::SmallIcon(UINT nid)
|
|||
}
|
||||
|
||||
|
||||
ResBitmap::ResBitmap(UINT nid)
|
||||
{
|
||||
_hBmp = LoadBitmap(g_Globals._hInstance, MAKEINTRESOURCE(nid));
|
||||
}
|
||||
|
||||
|
||||
void explorer_show_frame(HWND hwndDesktop, int cmdshow)
|
||||
{
|
||||
if (g_Globals._hMainWnd)
|
||||
|
|
|
@ -346,6 +346,10 @@ SOURCE=.\res\logoff.ico
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\res\logov.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\res\reactos.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#define IDS_ADMIN 15
|
||||
#define IDS_NETWORK 16
|
||||
#define IDS_CONNECTIONS 17
|
||||
#define IDS_DRIVES 18
|
||||
#define IDS_DRIVES 18
|
||||
#define IDI_REACTOS 100
|
||||
#define IDI_EXPLORER 101
|
||||
#define IDI_STARTMENU 102
|
||||
|
@ -37,6 +37,7 @@
|
|||
#define IDI_FOLDERARROW 125
|
||||
#define IDI_ARROW 125
|
||||
#define IDI_ARROW_SELECTED 126
|
||||
#define IDB_LOGOV 129
|
||||
#define ID_VIEW_NAME 401
|
||||
#define ID_VIEW_ALL_ATTRIBUTES 402
|
||||
#define ID_VIEW_SELECTED_ATTRIBUTES 403
|
||||
|
@ -68,7 +69,7 @@
|
|||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 129
|
||||
#define _APS_NEXT_RESOURCE_VALUE 130
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
|
|
|
@ -30,6 +30,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
|||
IDB_IMAGES BITMAP DISCARDABLE "res/images.bmp"
|
||||
IDB_TOOLBAR BITMAP DISCARDABLE "res/toolbar.bmp"
|
||||
IDB_DRIVEBAR BITMAP DISCARDABLE "res/drivebar.bmp"
|
||||
IDB_LOGOV BITMAP DISCARDABLE "res/logov.bmp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
|
|
@ -63,3 +63,14 @@ struct SmallIcon
|
|||
protected:
|
||||
HICON _hIcon;
|
||||
};
|
||||
|
||||
struct ResBitmap
|
||||
{
|
||||
ResBitmap(UINT nid);
|
||||
~ResBitmap() {DeleteObject(_hBmp);}
|
||||
|
||||
operator HBITMAP() const {return _hBmp;}
|
||||
|
||||
protected:
|
||||
HBITMAP _hBmp;
|
||||
};
|
||||
|
|
BIN
reactos/subsys/system/explorer/res/logov.bmp
Normal file
BIN
reactos/subsys/system/explorer/res/logov.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
|
@ -324,7 +324,6 @@ void Pane::draw_item(LPDRAWITEMSTRUCT dis, Entry* entry, int calcWidthCol)
|
|||
int visible_cols = _visible_cols;
|
||||
COLORREF bkcolor, textcolor;
|
||||
RECT focusRect = dis->rcItem;
|
||||
HBRUSH hbrush;
|
||||
enum IMAGE img;
|
||||
int img_pos, cx;
|
||||
int col = 0;
|
||||
|
@ -459,7 +458,7 @@ void Pane::draw_item(LPDRAWITEMSTRUCT dis, Entry* entry, int calcWidthCol)
|
|||
bkcolor = RGB(255,255,255);
|
||||
}
|
||||
|
||||
hbrush = CreateSolidBrush(bkcolor);
|
||||
HBRUSH hbrush = CreateSolidBrush(bkcolor);
|
||||
FillRect(dis->hDC, &focusRect, hbrush);
|
||||
DeleteObject(hbrush);
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ StartMenu::StartMenu(HWND hwnd)
|
|||
{
|
||||
_next_id = IDC_FIRST_MENU;
|
||||
_submenu_id = 0;
|
||||
_border_left = 0;
|
||||
}
|
||||
|
||||
StartMenu::StartMenu(HWND hwnd, const StartMenuFolders& info)
|
||||
|
@ -57,6 +58,7 @@ StartMenu::StartMenu(HWND hwnd, const StartMenuFolders& info)
|
|||
|
||||
_next_id = IDC_FIRST_MENU;
|
||||
_submenu_id = 0;
|
||||
_border_left = 0;
|
||||
}
|
||||
|
||||
StartMenu::~StartMenu()
|
||||
|
@ -153,7 +155,7 @@ LRESULT StartMenu::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
|||
{
|
||||
switch(nmsg) {
|
||||
case WM_SIZE:
|
||||
ResizeButtons(LOWORD(lparam));
|
||||
ResizeButtons(LOWORD(lparam)-_border_left);
|
||||
break;
|
||||
|
||||
case WM_NCHITTEST: {
|
||||
|
@ -306,15 +308,17 @@ void StartMenu::AddButton(LPCTSTR title, HICON hIcon, bool hasSubmenu, UINT id,
|
|||
}
|
||||
|
||||
// widen window, if it is too small
|
||||
int width = StartMenuButton::GetTextWidth(title,_hwnd) + 16/*icon*/ + 10/*placeholder*/ + 16/*arrow*/;
|
||||
int text_width = StartMenuButton::GetTextWidth(title,_hwnd) + 16/*icon*/ + 10/*placeholder*/ + 16/*arrow*/;
|
||||
|
||||
ClientRect clnt(_hwnd);
|
||||
if (width > clnt.right)
|
||||
rect.right += width-clnt.right;
|
||||
int cx = clnt.right - _border_left;
|
||||
if (text_width > cx)
|
||||
rect.right += text_width-cx;
|
||||
|
||||
MoveWindow(_hwnd, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, TRUE);
|
||||
|
||||
StartMenuCtrl(_hwnd, rect.bottom-rect.top-STARTMENU_LINE_HEIGHT-6, title, id, hIcon, hasSubmenu, style);
|
||||
StartMenuCtrl(_hwnd, _border_left, rect.bottom-rect.top-STARTMENU_LINE_HEIGHT-6, rect.right-rect.left-_border_left,
|
||||
title, id, hIcon, hasSubmenu, style);
|
||||
}
|
||||
|
||||
void StartMenu::AddSeparator()
|
||||
|
@ -330,7 +334,7 @@ void StartMenu::AddSeparator()
|
|||
|
||||
MoveWindow(_hwnd, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, TRUE);
|
||||
|
||||
StartMenuSeparator(_hwnd, rect.bottom-rect.top-STARTMENU_SEP_HEIGHT-6);
|
||||
StartMenuSeparator(_hwnd, _border_left, rect.bottom-rect.top-STARTMENU_SEP_HEIGHT-6, rect.right-rect.left-_border_left);
|
||||
}
|
||||
|
||||
|
||||
|
@ -538,6 +542,14 @@ StartMenuRoot::StartMenuRoot(HWND hwnd)
|
|||
// insert directory "<user name>\Start Menu"
|
||||
ShellDirectory usr_startmenu(Desktop(), SpecialFolderPath(CSIDL_STARTMENU, _hwnd), _hwnd);
|
||||
_dirs.push_back(StartMenuDirectory(usr_startmenu, false)); // don't add subfolders
|
||||
|
||||
// read size of logo bitmap
|
||||
BITMAP bmp_hdr;
|
||||
GetObject(ResBitmap(IDB_LOGOV), sizeof(BITMAP), &bmp_hdr);
|
||||
_logo_size.cx = bmp_hdr.bmWidth;
|
||||
_logo_size.cy = bmp_hdr.bmHeight;
|
||||
|
||||
_border_left = _logo_size.cx;
|
||||
}
|
||||
|
||||
|
||||
|
@ -583,6 +595,35 @@ LRESULT StartMenuRoot::Init(LPCREATESTRUCT pcs)
|
|||
}
|
||||
|
||||
|
||||
LRESULT StartMenuRoot::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
switch(nmsg) {
|
||||
case WM_PAINT: {
|
||||
PaintCanvas canvas(_hwnd);
|
||||
MemCanvas mem_dc;
|
||||
ResBitmap bmp(IDB_LOGOV);
|
||||
BitmapSelection sel(mem_dc, bmp);
|
||||
|
||||
ClientRect clnt(_hwnd);
|
||||
int h = min(_logo_size.cy, clnt.bottom);
|
||||
|
||||
RECT rect = {0, 0, _logo_size.cx-1, clnt.bottom-h};
|
||||
HBRUSH hbr = CreateSolidBrush(RGB(166,202,240)); // same color as the background color in the logo bitmap
|
||||
FillRect(canvas, &rect, hbr);
|
||||
PatBlt(canvas, _logo_size.cx-1, 0, 1, clnt.bottom-h, WHITENESS);
|
||||
DeleteObject(hbr);
|
||||
|
||||
BitBlt(canvas, 0, clnt.bottom-h, _logo_size.cx, h, mem_dc, 0, 0, SRCCOPY);
|
||||
break;}
|
||||
|
||||
default:
|
||||
return super::WndProc(nmsg, wparam, lparam);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int StartMenuRoot::Command(int id, int code)
|
||||
{
|
||||
switch(id) {
|
||||
|
|
|
@ -95,9 +95,9 @@ protected:
|
|||
*/
|
||||
struct StartMenuCtrl : public Button
|
||||
{
|
||||
StartMenuCtrl(HWND parent, int y, LPCTSTR title,
|
||||
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, 0, y, ClientRect(parent).right, STARTMENU_LINE_HEIGHT, id, style, exStyle)
|
||||
: Button(parent, title, x, y, w, STARTMENU_LINE_HEIGHT, id, style, exStyle)
|
||||
{
|
||||
*new StartMenuButton(_hwnd, hIcon, hasSubmenu);
|
||||
|
||||
|
@ -108,8 +108,8 @@ struct StartMenuCtrl : public Button
|
|||
|
||||
struct StartMenuSeparator : public Static
|
||||
{
|
||||
StartMenuSeparator(HWND parent, int y, DWORD style=WS_VISIBLE|WS_CHILD|WS_DISABLED|SS_ETCHEDHORZ, DWORD exStyle=0)
|
||||
: Static(parent, NULL, 0, y+STARTMENU_SEP_HEIGHT/2-1, ClientRect(parent).right, 2, -1, style, exStyle)
|
||||
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)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
@ -153,6 +153,8 @@ protected:
|
|||
UINT _submenu_id;
|
||||
WindowHandle _submenu;
|
||||
|
||||
int _border_left; // left border in pixels
|
||||
|
||||
// member functions
|
||||
void ResizeButtons(int cx);
|
||||
|
||||
|
@ -200,9 +202,12 @@ struct StartMenuRoot : public StartMenu
|
|||
|
||||
protected:
|
||||
LRESULT Init(LPCREATESTRUCT pcs);
|
||||
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
|
||||
int Command(int id, int code);
|
||||
|
||||
void ShowLaunchDialog(HWND hwndDesktopBar);
|
||||
|
||||
SIZE _logo_size;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -246,16 +246,13 @@ HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd)
|
|||
{
|
||||
HBITMAP hbmp = CreateCompatibleBitmap(hdc_wnd, 16, 16);
|
||||
|
||||
HDC hdc = CreateCompatibleDC(0);
|
||||
HBITMAP hbmp_org = SelectBitmap(hdc, hbmp);
|
||||
MemCanvas canvas;
|
||||
BitmapSelection sel(canvas, hbmp);
|
||||
|
||||
RECT rect = {0, 0, 16, 16};
|
||||
FillRect(hdc, &rect, hbrush_bkgnd);
|
||||
FillRect(canvas, &rect, hbrush_bkgnd);
|
||||
|
||||
DrawIconEx(hdc, 0, 0, hIcon, 16, 16, 0, hbrush_bkgnd, DI_NORMAL);
|
||||
|
||||
SelectBitmap(hdc, hbmp_org);
|
||||
DeleteDC(hdc);
|
||||
DrawIconEx(canvas, 0, 0, hIcon, 16, 16, 0, hbrush_bkgnd, DI_NORMAL);
|
||||
|
||||
return hbmp;
|
||||
}
|
||||
|
|
|
@ -322,6 +322,18 @@ protected:
|
|||
HFONT _old_hFont;
|
||||
};
|
||||
|
||||
struct BitmapSelection
|
||||
{
|
||||
BitmapSelection(HDC hdc, HBITMAP hBmp)
|
||||
: _hdc(hdc), _old_hBmp(SelectBitmap(hdc, hBmp)) {}
|
||||
|
||||
~BitmapSelection() {SelectBitmap(_hdc, _old_hBmp);}
|
||||
|
||||
protected:
|
||||
HDC _hdc;
|
||||
HBITMAP _old_hBmp;
|
||||
};
|
||||
|
||||
|
||||
struct String
|
||||
#ifdef UNICODE
|
||||
|
|
Loading…
Reference in a new issue