wordpad: Make toolbar more like native

Alexander Nicolaysen Sørnes alex at thehandofagony.com
Sat Feb 24 14:00:08 CST 2007


Change toolbar style, and add buttons for print, preview and find; showing a 
not implemented messagebox when pressed.

I am quite new to both C and the Windows API, so please excuse me if I did 
something wrong, and tell me how I can improve it.


Regards,

Alexander N. Sørnes
-------------- next part --------------
From a1ca80b78c5ef82d9a76c7d580462891dd4a83e0 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Alexander_Nicolaysen_S=C3=B8rnes?= <alex at thehandofagony.com>
Date: Sat, 24 Feb 2007 20:56:17 +0100
Subject: [PATCH] Make WordPad toolbar more like native

---
 programs/wordpad/resource.h |    5 +++++
 programs/wordpad/wordpad.c  |   13 ++++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/programs/wordpad/resource.h b/programs/wordpad/resource.h
index 35d475f..fc1ddf0 100644
--- a/programs/wordpad/resource.h
+++ b/programs/wordpad/resource.h
@@ -21,6 +21,11 @@
 #define ID_FILE_SAVE 1002
 #define ID_FILE_NEW 1003
 
+#define ID_PRINT 1004
+#define ID_PREVIEW 1005
+
+#define ID_FIND 1006
+
 #define ID_ALIGN_LEFT 1100
 #define ID_ALIGN_CENTER 1101
 #define ID_ALIGN_RIGHT 1102
diff --git a/programs/wordpad/wordpad.c b/programs/wordpad/wordpad.c
index 7269272..e3454ee 100644
--- a/programs/wordpad/wordpad.c
+++ b/programs/wordpad/wordpad.c
@@ -207,7 +207,7 @@ static LRESULT OnCreate( HWND hWnd, WPARAM wParam, LPARAM lParam)
     if(!SendMessage(hReBarWnd, RB_SETBARINFO, 0, (LPARAM)&rbi))
         return -1;
 
-    hToolBarWnd = CreateToolbarEx(hReBarWnd, CCS_NOPARENTALIGN|CCS_NODIVIDER|CCS_NOMOVEY|WS_VISIBLE|WS_CHILD|TBSTYLE_TOOLTIPS|TBSTYLE_FLAT,
+    hToolBarWnd = CreateToolbarEx(hReBarWnd, CCS_NOPARENTALIGN|CCS_NODIVIDER|CCS_NOMOVEY|WS_VISIBLE|WS_CHILD|TBSTYLE_TOOLTIPS|TBSTYLE_BUTTON,
       IDC_TOOLBAR,
       3, hInstance, IDB_TOOLBAR,
       NULL, 0,
@@ -220,9 +220,13 @@ static LRESULT OnCreate( HWND hWnd, WPARAM wParam, LPARAM lParam)
     AddButton(hToolBarWnd, nStdBitmaps+STD_FILEOPEN, ID_FILE_OPEN);
     AddButton(hToolBarWnd, nStdBitmaps+STD_FILESAVE, ID_FILE_SAVE);
     AddSeparator(hToolBarWnd);
+    AddButton(hToolBarWnd, nStdBitmaps+STD_PRINT, ID_PRINT);
+    AddButton(hToolBarWnd, nStdBitmaps+STD_PRINTPRE, ID_PREVIEW);
+    AddSeparator(hToolBarWnd);
+    AddButton(hToolBarWnd, nStdBitmaps+STD_FIND, ID_FIND);
+    AddSeparator(hToolBarWnd);
     AddButton(hToolBarWnd, nStdBitmaps+STD_CUT, ID_EDIT_CUT);
     AddButton(hToolBarWnd, nStdBitmaps+STD_COPY, ID_EDIT_COPY);
-    AddSeparator(hToolBarWnd);
     AddButton(hToolBarWnd, nStdBitmaps+STD_UNDO, ID_EDIT_UNDO);
     AddButton(hToolBarWnd, nStdBitmaps+STD_REDOW, ID_EDIT_REDO);
     AddSeparator(hToolBarWnd);
@@ -333,7 +337,10 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam)
 
     case ID_FILE_OPEN:
     case ID_FILE_SAVE:
-        MessageBox(hWnd, "Open/Save not implemented", "WordPad", MB_OK);
+    case ID_PRINT:
+    case ID_PREVIEW:
+    case ID_FIND:
+        MessageBox(hWnd, "Not implemented", "WordPad", MB_OK);
         break;
 
     case ID_FORMAT_BOLD:
-- 
1.4.4.4



More information about the wine-patches mailing list