From: Vincent Povirk Subject: [2/6] explorer: Add non-functional start button. Message-Id: Date: Tue, 10 Dec 2013 15:07:23 -0600 From 47d3d2cd64b8bfd153e898cea66765d2a56d5708 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Thu, 5 Dec 2013 16:29:31 -0600 Subject: [PATCH 2/6] explorer: Add non-functional start button. --- programs/explorer/explorer.rc | 1 + programs/explorer/resource.h | 1 + programs/explorer/systray.c | 25 ++++++++++++++++++++++++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/programs/explorer/explorer.rc b/programs/explorer/explorer.rc index ae9f44a..86ec4e3 100644 --- a/programs/explorer/explorer.rc +++ b/programs/explorer/explorer.rc @@ -29,6 +29,7 @@ STRINGTABLE { IDS_EXPLORER_TITLE "Wine Explorer" IDS_PATHBOX_LABEL "Location:" + IDS_START_LABEL "Start" } #define WINE_FILEDESCRIPTION_STR "Wine Explorer" diff --git a/programs/explorer/resource.h b/programs/explorer/resource.h index dc0e8d1..a7f3f3a 100644 --- a/programs/explorer/resource.h +++ b/programs/explorer/resource.h @@ -23,5 +23,6 @@ #define IDS_EXPLORER_TITLE 1 #define IDS_PATHBOX_LABEL 2 +#define IDS_START_LABEL 3 #endif diff --git a/programs/explorer/systray.c b/programs/explorer/systray.c index 3159e3e..96fc61d 100644 --- a/programs/explorer/systray.c +++ b/programs/explorer/systray.c @@ -30,6 +30,7 @@ #include #include "explorer_private.h" +#include "resource.h" WINE_DEFAULT_DEBUG_CHANNEL(systray); @@ -91,6 +92,8 @@ static int icon_cx, icon_cy, tray_width; static struct icon *balloon_icon; static HWND balloon_window; +static HWND start_button; + #define MIN_DISPLAYED 8 #define ICON_BORDER 2 @@ -135,7 +138,7 @@ static void init_common_controls(void) INITCOMMONCONTROLSEX init_tooltip; init_tooltip.dwSize = sizeof(INITCOMMONCONTROLSEX); - init_tooltip.dwICC = ICC_TAB_CLASSES; + init_tooltip.dwICC = ICC_TAB_CLASSES|ICC_STANDARD_CLASSES; InitCommonControlsEx(&init_tooltip); initialized = TRUE; @@ -624,11 +627,24 @@ static LRESULT WINAPI tray_wndproc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM l return 0; } +static void get_system_text_size( const WCHAR *text, SIZE *size ) +{ + /* FIXME: Implement BCM_GETIDEALSIZE and use that instead. */ + HDC hdc = CreateCompatibleDC(0); + + GetTextExtentPointW(hdc, text, lstrlenW(text), size); + + DeleteDC(hdc); +} + /* this function creates the listener window */ void initialize_systray( HMODULE graphics_driver, BOOL using_root ) { WNDCLASSEXW class; static const WCHAR classname[] = {'S','h','e','l','l','_','T','r','a','y','W','n','d',0}; + static const WCHAR button_class[] = {'B','u','t','t','o','n',0}; + WCHAR start_label[50]; + SIZE start_text_size; wine_notify_icon = (void *)GetProcAddress( graphics_driver, "wine_notify_icon" ); @@ -663,6 +679,13 @@ void initialize_systray( HMODULE graphics_driver, BOOL using_root ) return; } + LoadStringW( NULL, IDS_START_LABEL, start_label, sizeof(start_label)/sizeof(WCHAR) ); + + get_system_text_size( start_label, &start_text_size ); + + start_button = CreateWindowW( button_class, start_label, WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, + 0, 0, start_text_size.cx + 8, icon_cy, tray_window, 0, 0, 0 ); + if (hide_systray) do_hide_systray(); ShowWindow( tray_window, SW_SHOWNA ); -- 1.8.1.2