oleview: Added status bar to TypeLib Viewer [1/2]
Piotr Caban
piotr.caban at gmail.com
Fri Jun 30 11:42:14 CDT 2006
Hi,
Changelog:
- 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(-)
--
Piotr
-------------- next part --------------
diff --git a/programs/oleview/En.rc b/programs/oleview/En.rc
index 92f2fa8..8a32222 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 a9b3c49..5bd9bf5 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 ca9323b..9db6b35 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,8 +151,12 @@ 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;
}
More information about the wine-patches
mailing list