Module: wine Branch: refs/heads/master Commit: 49c779f06f0d3c7f058bcc8a0405e4557ef3034f URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=49c779f06f0d3c7f058bcc8a...
Author: Piotr Caban piotr.caban@gmail.com Date: Fri Jun 30 18:42:14 2006 +0200
oleview: Added status bar to TypeLib Viewer.
---
programs/oleview/En.rc | 4 ++++ programs/oleview/main.h | 1 + programs/oleview/typelib.c | 42 +++++++++++++++++++++++++++++++++++++++--- 3 files changed, 44 insertions(+), 3 deletions(-)
diff --git a/programs/oleview/En.rc b/programs/oleview/En.rc index 3f981d5..da6edb6 100644 --- a/programs/oleview/En.rc +++ b/programs/oleview/En.rc @@ -117,6 +117,10 @@ STRINGTABLE IDM_REFRESH, "Refresh all lists" IDM_ABOUT, "Display program information, version number and copyright"
+ IDM_SAVEAS, "Save as an .IDL or .H file" + IDM_CLOSE, "Close window" + IDM_GROUP, "Group typeinfos by kind" + IDS_TREE_OC, "ObjectClasses" IDS_TREE_GBCC, "Grouped by Component Category" IDS_TREE_O1O, "OLE 1.0 Objects" diff --git a/programs/oleview/main.h b/programs/oleview/main.h index fd76b20..ad200fb 100644 --- a/programs/oleview/main.h +++ b/programs/oleview/main.h @@ -107,6 +107,7 @@ typedef struct HWND hPaneWnd; HWND hTree; HWND hEdit; + HWND hStatusBar; }TYPELIB;
extern GLOBALS globals; diff --git a/programs/oleview/typelib.c b/programs/oleview/typelib.c index 08b47ad..8d5442a 100644 --- a/programs/oleview/typelib.c +++ b/programs/oleview/typelib.c @@ -62,6 +62,31 @@ void PopulateTree(void) ITypeLib_Release(pTypeLib); }
+void TypeLibResizeChild(void) +{ + RECT client, stat; + + MoveWindow(typelib.hStatusBar, 0, 0, 0, 0, TRUE); + + if(IsWindowVisible(typelib.hStatusBar)) + GetClientRect(typelib.hStatusBar, &stat); + else stat.bottom = 0; + + GetClientRect(globals.hTypeLibWnd, &client); + MoveWindow(typelib.hPaneWnd, 0, 0, + client.right, client.bottom-stat.bottom, TRUE); +} + +void UpdateTypeLibStatusBar(int itemID) +{ + WCHAR info[MAX_LOAD_STRING]; + + if(!LoadString(globals.hMainInst, itemID, info, sizeof(WCHAR[MAX_LOAD_STRING]))) + LoadString(globals.hMainInst, IDS_READY, info, sizeof(WCHAR[MAX_LOAD_STRING])); + + SendMessage(typelib.hStatusBar, SB_SETTEXT, 0, (LPARAM)info); +} + LRESULT CALLBACK TypeLibProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) @@ -81,11 +106,18 @@ LRESULT CALLBACK TypeLibProc(HWND hWnd, SetRight(typelib.hPaneWnd, typelib.hEdit);
PopulateTree(); + SetFocus(typelib.hTree); break; } + case WM_MENUSELECT: + UpdateTypeLibStatusBar(LOWORD(wParam)); + break; + case WM_SETFOCUS: + SetFocus(typelib.hTree); + break; case WM_SIZE: - MoveWindow(typelib.hPaneWnd, 0, 0, - LOWORD(lParam), HIWORD(lParam), TRUE); + if(wParam == SIZE_MINIMIZED) break; + TypeLibResizeChild(); break; case WM_DESTROY: break; @@ -119,7 +151,11 @@ BOOL CreateTypeLibWindow(HINSTANCE hInst globals.hTypeLibWnd = CreateWindow(wszTypeLib, wszTitle, WS_OVERLAPPEDWINDOW|WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 800, 600, NULL, NULL, hInst, NULL); - if(!globals.hTypeLibWnd) return FALSE; + + typelib.hStatusBar = CreateStatusWindow(WS_VISIBLE|WS_CHILD, + (LPWSTR)wszTitle, globals.hTypeLibWnd, 0); + + TypeLibResizeChild(); return TRUE; }