[sword-svn] r181 - in trunk/src/SwordReader_GUI: . SRFramework

dtrotzjr at www.crosswire.org dtrotzjr at www.crosswire.org
Sun Sep 21 18:57:21 MST 2008


Author: dtrotzjr
Date: 2008-09-21 18:57:20 -0700 (Sun, 21 Sep 2008)
New Revision: 181

Added:
   trunk/src/SwordReader_GUI/SRFramework/SRRadioButton.cpp
   trunk/src/SwordReader_GUI/SRFramework/SRRadioButton.h
Modified:
   trunk/src/SwordReader_GUI/SRFind.cpp
   trunk/src/SwordReader_GUI/SRFind.h
   trunk/src/SwordReader_GUI/SwordReader_GUI.vcproj
Log:
AddAdding SRRadioButton class. Not done yet

Modified: trunk/src/SwordReader_GUI/SRFind.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRFind.cpp	2008-09-21 23:35:14 UTC (rev 180)
+++ trunk/src/SwordReader_GUI/SRFind.cpp	2008-09-22 01:57:20 UTC (rev 181)
@@ -18,11 +18,11 @@
 SRFind::SRFind()
 :m_pEdtQuery(NULL)
 ,m_pButtonSearch(NULL)
-,m_hRadRangeBible(NULL)
-,m_hRadRangeTestament(NULL)
-,m_hRadRangeBook(NULL)
-,m_hRadMethodMultiword(NULL)
-,m_hRadMethodExactphrase(NULL)
+,m_pRadRangeBible(NULL)
+,m_pRadRangeTestament(NULL)
+,m_pRadRangeBook(NULL)
+,m_pRadMethodMultiword(NULL)
+,m_pRadMethodExactphrase(NULL)
 ,m_pListBoxResults(NULL)
 ,m_pProgressBar(NULL)
 ,m_pButtonGoTo(NULL)
@@ -74,9 +74,9 @@
         Search();
         break;
     case IDC_RAD_BIBLE:
-        ::SendMessage(m_hRadRangeBible,BM_SETCHECK,BST_CHECKED,0);
-        ::SendMessage(m_hRadRangeTestament,BM_SETCHECK,BST_UNCHECKED,0);
-        ::SendMessage(m_hRadRangeBook,BM_SETCHECK,BST_UNCHECKED,0);
+        m_pRadRangeBible->Check();
+        m_pRadRangeTestament->Uncheck();
+        m_pRadRangeBook->Uncheck();
         m_wRangeMode = SR_FIND_RANGE_BIBLE;
         break;
     case IDC_RAD_TESTAMENT:

Modified: trunk/src/SwordReader_GUI/SRFind.h
===================================================================
--- trunk/src/SwordReader_GUI/SRFind.h	2008-09-21 23:35:14 UTC (rev 180)
+++ trunk/src/SwordReader_GUI/SRFind.h	2008-09-22 01:57:20 UTC (rev 181)
@@ -61,16 +61,16 @@
     VOID SetContext(VerseKey verse, const SWModule *pModule);
 private:
     static BOOL s_fRegistered;
-    SREdit      *m_pEdtQuery;
-    SRListBox   *m_pListBoxResults;
-    SRButton    *m_pButtonSearch;
-    SRButton    *m_pButtonGoTo;
-    SRProgress  *m_pProgressBar;
-    HWND m_hRadRangeBible;
-    HWND m_hRadRangeTestament;
-    HWND m_hRadRangeBook;
-    HWND m_hRadMethodMultiword;
-    HWND m_hRadMethodExactphrase;
+    SREdit          *m_pEdtQuery;
+    SRListBox       *m_pListBoxResults;
+    SRButton        *m_pButtonSearch;
+    SRButton        *m_pButtonGoTo;
+    SRProgress      *m_pProgressBar;
+    SRRadioButton   *m_pRadRangeBible;
+    SRRadioButton   *m_pRadRangeTestament;
+    SRRadioButton   *m_pRadRangeBook;
+    SRRadioButton   *m_pRadMethodMultiword;
+    SRRadioButton   *m_pRadMethodExactphrase;
     SRTextView *m_textPreview;
     WORD m_wRangeMode;
     WORD m_wMethodMode;

Added: trunk/src/SwordReader_GUI/SRFramework/SRRadioButton.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRRadioButton.cpp	                        (rev 0)
+++ trunk/src/SwordReader_GUI/SRFramework/SRRadioButton.cpp	2008-09-22 01:57:20 UTC (rev 181)
@@ -0,0 +1,54 @@
+#include "SRRadioButton.h"
+#include "SRApp.h"
+#include <commctrl.h>
+
+using namespace SRFramework;
+
+
+SRRadioButton::SRRadioButton(void)
+{
+    INITCOMMONCONTROLSEX InitCtrlEx;
+
+	InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
+	InitCtrlEx.dwICC  = ICC_TAB_CLASSES;
+	InitCommonControlsEx(&InitCtrlEx);
+
+    m_hInstance = SRFramework::SRApp::GetInstanceHandle();
+    m_wcsClassName = "button";
+    m_wcsWindowName = "";
+}
+
+SRRadioButton::~SRRadioButton(void)
+{
+
+}
+
+BOOL SRRadioButton::Create(SRWnd *pParentWnd, RECT bounds, INT nChildID, DWORD dwStyle)
+{
+    if(!Register())
+        return FALSE;
+    if(!SRWnd::Create(m_wcsClassName,m_wcsWindowName, dwStyle, bounds, pParentWnd, (HMENU)nChildID, m_hInstance))
+        return FALSE;
+    
+    return TRUE;
+}
+
+WCString SRRadioButton::GetText()
+{
+    TCHAR *strQuery = NULL;
+    INT nQueryLen = ::SendMessage(m_hWnd, WM_GETTEXTLENGTH, NULL, NULL) + 1;
+    strQuery = new TCHAR[nQueryLen];
+    ::SendMessage(m_hWnd,WM_GETTEXT,(WPARAM)nQueryLen,(LPARAM)strQuery);
+    strQuery[nQueryLen - 1] = 0; // in case the buffer was exceeded
+    return strQuery;
+}
+
+VOID SRRadioButton::Check()
+{
+    ::SendMessage(m_hWnd,BM_SETCHECK,BST_CHECKED,0);
+}
+
+VOID SRRadioButton::Uncheck()
+{
+    ::SendMessage(m_hWnd,BM_SETCHECK,BST_UNCHECKED,0);
+}

Added: trunk/src/SwordReader_GUI/SRFramework/SRRadioButton.h
===================================================================
--- trunk/src/SwordReader_GUI/SRFramework/SRRadioButton.h	                        (rev 0)
+++ trunk/src/SwordReader_GUI/SRFramework/SRRadioButton.h	2008-09-22 01:57:20 UTC (rev 181)
@@ -0,0 +1,21 @@
+#pragma once
+#include "SRWnd.h"
+#include <commctrl.h>
+
+namespace SRFramework{
+
+    class SRRadioButton : public SRFramework::SRWnd
+    {
+    public:
+        SRRadioButton(VOID);
+        virtual ~SRRadioButton(VOID);
+        BOOL Create(SRWnd *pParentWnd, RECT bounds, INT nChildID = NULL, DWORD dwStyle = WS_CHILD | BS_RADIOBUTTON);
+        // Does not need to be registered the call to InitCommonControlsEx 
+        // does that for us. 
+        BOOL Register() { return TRUE; } 
+        WCString GetText();
+        VOID Check();
+        VOID Uncheck();
+    };
+
+}
\ No newline at end of file

Modified: trunk/src/SwordReader_GUI/SwordReader_GUI.vcproj
===================================================================
--- trunk/src/SwordReader_GUI/SwordReader_GUI.vcproj	2008-09-21 23:35:14 UTC (rev 180)
+++ trunk/src/SwordReader_GUI/SwordReader_GUI.vcproj	2008-09-22 01:57:20 UTC (rev 181)
@@ -937,6 +937,10 @@
 					>
 				</File>
 				<File
+					RelativePath=".\SRFramework\SRRadioButton.cpp"
+					>
+				</File>
+				<File
 					RelativePath=".\SRFramework\SRTabCtrl.cpp"
 					>
 				</File>
@@ -1038,6 +1042,10 @@
 					>
 				</File>
 				<File
+					RelativePath=".\SRFramework\SRRadioButton.h"
+					>
+				</File>
+				<File
 					RelativePath=".\SRFramework\SRTabCtrl.h"
 					>
 				</File>




More information about the sword-cvs mailing list