[sword-svn] r110 - trunk/src/SwordReader_GUI/SRFramework
dtrotzjr at www.crosswire.org
dtrotzjr at www.crosswire.org
Mon Mar 31 19:32:17 MST 2008
Author: dtrotzjr
Date: 2008-03-31 19:32:17 -0700 (Mon, 31 Mar 2008)
New Revision: 110
Modified:
trunk/src/SwordReader_GUI/SRFramework/SRCommandBar.cpp
trunk/src/SwordReader_GUI/SRFramework/SRCommandBar.h
trunk/src/SwordReader_GUI/SRFramework/SRFrame.cpp
trunk/src/SwordReader_GUI/SRFramework/SRWidget.cpp
trunk/src/SwordReader_GUI/SRFramework/SRWnd.cpp
trunk/src/SwordReader_GUI/SRFramework/SRWnd.h
trunk/src/SwordReader_GUI/SRFramework/WCString.h
Log:
Changes to the SRFramework stuff.
Modified: trunk/src/SwordReader_GUI/SRFramework/SRCommandBar.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRCommandBar.cpp 2008-03-31 02:40:11 UTC (rev 109)
+++ trunk/src/SwordReader_GUI/SRFramework/SRCommandBar.cpp 2008-04-01 02:32:17 UTC (rev 110)
@@ -11,19 +11,42 @@
delete m_menu;
}
-BOOL SRCommandBar::Create(SRWnd* pWndParent, DWORD dwStyle, UINT nBarID)
+BOOL SRCommandBar::Create(SRWnd* pWndParent, UINT nBarID)
{
- m_hWndCB = CommandBar_Create(SRApp::GetInstanceHandle(), pWndParent->GetWindowHandle(), nBarID);
- return m_hWndCB != NULL;
+ SHMENUBARINFO mbi;
+ ZeroMemory(&mbi, sizeof(SHMENUBARINFO));
+ if(!pWndParent)
+ return FALSE;
+
+ mbi.cbSize = sizeof(SHMENUBARINFO);
+ mbi.hwndParent = pWndParent->GetWindowHandle();
+ mbi.nToolBarId = nBarID;
+ mbi.hInstRes = SRApp::GetInstanceHandle();
+ mbi.dwFlags = SHCMBF_HMENU;
+
+ if(SHCreateMenuBar(&mbi)){
+ m_hWndCB = mbi.hwndMB;
+ return TRUE;
+ }
+
+ return FALSE;
}
+/*
BOOL SRCommandBar::InsertMenuBar(WORD wMenuID, WORD wButton)
{
return ::CommandBar_InsertMenubar(m_hWndCB, SRApp::GetInstanceHandle(),wMenuID, wButton);
}
-
+*/
INT SRCommandBar::Height()
{
RECT MenuBarRect;
GetWindowRect(m_hWndCB, &MenuBarRect);
return MenuBarRect.bottom - MenuBarRect.top;
}
+
+BOOL SRCommandBar::Show(BOOL fShow)
+{
+ if(m_hWndCB)
+ return ::CommandBar_Show(m_hWndCB, fShow);
+ return FALSE;
+}
Modified: trunk/src/SwordReader_GUI/SRFramework/SRCommandBar.h
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRCommandBar.h 2008-03-31 02:40:11 UTC (rev 109)
+++ trunk/src/SwordReader_GUI/SRFramework/SRCommandBar.h 2008-04-01 02:32:17 UTC (rev 110)
@@ -14,8 +14,9 @@
SRCommandBar(void);
virtual ~SRCommandBar(void);
INT Height();
- BOOL Create(SRWnd* pWndParent, DWORD dwStyle, UINT nBarID);
- BOOL InsertMenuBar(WORD wMenuID, WORD wButton);
+ BOOL Create(SRWnd* pWndParent, UINT nBarID);
+ //BOOL InsertMenuBar(WORD wMenuID, WORD wButton);
+ BOOL Show(BOOL fShow);
protected:
HWND m_hWndCB;
SRMenu *m_menu;
Modified: trunk/src/SwordReader_GUI/SRFramework/SRFrame.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRFrame.cpp 2008-03-31 02:40:11 UTC (rev 109)
+++ trunk/src/SwordReader_GUI/SRFramework/SRFrame.cpp 2008-04-01 02:32:17 UTC (rev 110)
@@ -3,6 +3,7 @@
using namespace SRFramework;
SRFrame::SRFrame()
+:SRWnd()
{
}
Modified: trunk/src/SwordReader_GUI/SRFramework/SRWidget.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRWidget.cpp 2008-03-31 02:40:11 UTC (rev 109)
+++ trunk/src/SwordReader_GUI/SRFramework/SRWidget.cpp 2008-04-01 02:32:17 UTC (rev 110)
@@ -1,4 +1,5 @@
#include "SRWidget.h"
+using namespace SRFramework;
SRWidget::SRWidget(void)
{
Modified: trunk/src/SwordReader_GUI/SRFramework/SRWnd.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRWnd.cpp 2008-03-31 02:40:11 UTC (rev 109)
+++ trunk/src/SwordReader_GUI/SRFramework/SRWnd.cpp 2008-04-01 02:32:17 UTC (rev 110)
@@ -3,7 +3,11 @@
SRWnd::SRWnd()
{
-
+ m_dwStyle = 0;
+ m_hInstance = 0;
+ m_hMenu = 0;
+ m_hWnd = 0;
+ m_pParentWnd = NULL;
}
SRWnd::~SRWnd(void)
@@ -18,14 +22,27 @@
HMENU hMenu,
HINSTANCE hInstance)
{
- m_rect = rect;
m_pParentWnd = pParentWnd;
- HWND parent = m_pParentWnd ? m_pParentWnd->m_hWnd : NULL;
+ HWND hParent = m_pParentWnd ? m_pParentWnd->m_hWnd : NULL;
m_hMenu = hMenu;
m_hInstance = hInstance;
+ m_rect = rect;
- m_hWnd = CreateWindow(wcsClassName.w_str(), wcsWindowName.w_str(), dwStyle,
- m_rect.left, m_rect.top, m_rect.right - m_rect.left, m_rect.bottom - m_rect.top, m_pParentWnd->m_hWnd, m_hMenu, m_hInstance, this);
+ m_hWnd = CreateWindow(wcsClassName.w_str(),
+ wcsWindowName.w_str(),
+ dwStyle,
+ m_rect.left,
+ m_rect.top,
+ m_rect.right == CW_USEDEFAULT ?
+ CW_USEDEFAULT :
+ m_rect.right - m_rect.left,
+ m_rect.right == CW_USEDEFAULT ?
+ CW_USEDEFAULT :
+ m_rect.bottom - m_rect.top,
+ hParent,
+ m_hMenu,
+ m_hInstance,
+ this);
return m_hWnd != NULL;
}
Modified: trunk/src/SwordReader_GUI/SRFramework/SRWnd.h
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRWnd.h 2008-03-31 02:40:11 UTC (rev 109)
+++ trunk/src/SwordReader_GUI/SRFramework/SRWnd.h 2008-04-01 02:32:17 UTC (rev 110)
@@ -15,7 +15,7 @@
SRWnd();
virtual ~SRWnd(void);
- virtual BOOL Register() = 0;
+
//! The actual call back function for this window.
/*! This only acts as a mediator between the callback function we really
want and the call back the Win API is expecting.
@@ -98,6 +98,8 @@
virtual LRESULT OnClose(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam) { return FALSE; }
virtual LRESULT OnQuit(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam) { return FALSE; }
protected:
+ virtual BOOL Register() = 0;
+
HWND m_hWnd;
// These typically are set by the subclass' constructor.
WCString m_wcsClassName;
Modified: trunk/src/SwordReader_GUI/SRFramework/WCString.h
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/WCString.h 2008-03-31 02:40:11 UTC (rev 109)
+++ trunk/src/SwordReader_GUI/SRFramework/WCString.h 2008-04-01 02:32:17 UTC (rev 110)
@@ -1,6 +1,6 @@
#pragma once
+#include <string>
-#include <string>
namespace SRFramework
{
class WCString
More information about the sword-cvs
mailing list