]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/srchctlg.cpp
fixed wxCSConv to work again for iso-8859-1
[wxWidgets.git] / src / generic / srchctlg.cpp
index 956edb3f839c8b436b3f85fd90e89de9f1b4bd50..0db594490afa690c4ff67f7049a7f1bac7b7be95 100644 (file)
@@ -2,25 +2,12 @@
 // Name:        src/generic/srchctlg.cpp
 // Purpose:     implements wxSearchCtrl as a composite control
 // Author:      Vince Harron
-// Modified by:
 // Created:     2006-02-19
-// RCS-ID:      
+// RCS-ID:      $Id$
 // Copyright:   Vince Harron
 // License:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 
-// ============================================================================
-// declarations
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-// headers
-// ----------------------------------------------------------------------------
-
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-    #pragma implementation "srchctlg.h"
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
     #pragma hdrstop
 #endif
 
+#if wxUSE_SEARCHCTRL
+
+#include "wx/srchctrl.h"
+
 #ifndef WX_PRECOMP
     #include "wx/button.h"
     #include "wx/dcclient.h"
     #include "wx/dcmemory.h"
 #endif //WX_PRECOMP
 
-#if wxUSE_SEARCHCTRL
-
-#include "wx/srchctrl.h"
-
-#if !USE_NATIVE_SEARCH_CONTROL
+#if !wxUSE_NATIVE_SEARCH_CONTROL
 
 #include "wx/image.h"
 
-#define WXMIN(a,b) (a)<(b)?(a):(b)
-#define WXMAX(a,b) (a)>(b)?(a):(b)
+#define WXMAX(a,b) ((a)>(b)?(a):(b))
 
 // ----------------------------------------------------------------------------
 // constants
@@ -76,7 +62,7 @@ public:
                      style | wxNO_BORDER)
     {
         m_search = search;
-        
+
         // remove the default minsize, the searchctrl will have one instead
         SetSizeHints(wxDefaultCoord,wxDefaultCoord);
     }
@@ -96,7 +82,7 @@ protected:
         // copy constructor is disabled for some reason?
         //wxTextUrlEvent event(eventText);
         wxTextUrlEvent event(
-            m_search->GetId(), 
+            m_search->GetId(),
             eventText.GetMouseEvent(),
             eventText.GetURLStart(),
             eventText.GetURLEnd()
@@ -135,13 +121,13 @@ public:
 
     void SetBitmapLabel(const wxBitmap& label) { m_bmp = label; }
 
-    
+
 protected:
     wxSize DoGetBestSize() const
     {
         return wxSize(m_bmp.GetWidth(), m_bmp.GetHeight());
     }
-    
+
     void OnLeftUp(wxMouseEvent&)
     {
         wxCommandEvent event(m_eventType, m_search->GetId());
@@ -151,7 +137,7 @@ protected:
 
         m_search->SetFocus();
 
-        if ( m_eventType == wxEVT_COMMAND_SEARCHCTRL_SEARCH )
+        if ( m_eventType == wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN )
         {
             // this happens automatically, just like on Mac OS X
             m_search->PopupSearchMenu();
@@ -164,7 +150,7 @@ protected:
         dc.DrawBitmap(m_bmp, 0,0, true);
     }
 
-    
+
 private:
     wxSearchCtrl *m_search;
     wxEventType   m_eventType;
@@ -179,7 +165,7 @@ BEGIN_EVENT_TABLE(wxSearchButton, wxControl)
 END_EVENT_TABLE()
 
 BEGIN_EVENT_TABLE(wxSearchCtrl, wxSearchCtrlBase)
-    EVT_SEARCHCTRL_SEARCH(wxID_ANY, wxSearchCtrl::OnSearchButton)
+    EVT_SEARCHCTRL_SEARCH_BTN(wxID_ANY, wxSearchCtrl::OnSearchButton)
     EVT_SET_FOCUS(wxSearchCtrl::OnSetFocus)
 END_EVENT_TABLE()
 
@@ -197,7 +183,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxSearchCtrl, wxSearchCtrlBase)
 // --------
 
 wxSearchCtrl::wxSearchCtrl()
-{ 
+{
     Init();
 }
 
@@ -246,8 +232,8 @@ bool wxSearchCtrl::Create(wxWindow *parent, wxWindowID id,
 
     wxSize sizeText = m_text->GetBestSize();
 
-    m_searchButton = new wxSearchButton(this,wxEVT_COMMAND_SEARCHCTRL_SEARCH,m_searchBitmap);
-    m_cancelButton = new wxSearchButton(this,wxEVT_COMMAND_SEARCHCTRL_CANCEL,m_cancelBitmap);
+    m_searchButton = new wxSearchButton(this,wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN,m_searchBitmap);
+    m_cancelButton = new wxSearchButton(this,wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN,m_cancelBitmap);
 
     SetForegroundColour( m_text->GetForegroundColour() );
     m_searchButton->SetForegroundColour( m_text->GetForegroundColour() );
@@ -281,8 +267,8 @@ void wxSearchCtrl::SetMenu( wxMenu* menu )
         // no change
         return;
     }
+    bool hadMenu = (m_menu != NULL);
     delete m_menu;
-    bool hadMenu = (m_menu!=0);
     m_menu = menu;
 
     if ( m_menu && !hadMenu )
@@ -316,7 +302,7 @@ wxMenu* wxSearchCtrl::GetMenu()
     return m_menu;
 }
 
-void wxSearchCtrl::SetSearchButtonVisible( bool show )
+void wxSearchCtrl::ShowSearchButton( bool show )
 {
     if ( m_searchButtonVisible == show )
     {
@@ -333,13 +319,13 @@ void wxSearchCtrl::SetSearchButtonVisible( bool show )
     LayoutControls(0, 0, rect.GetWidth(), rect.GetHeight());
 }
 
-bool wxSearchCtrl::GetSearchButtonVisible() const
+bool wxSearchCtrl::IsSearchButtonVisible() const
 {
     return m_searchButtonVisible;
 }
 
 
-void wxSearchCtrl::SetCancelButtonVisible( bool show )
+void wxSearchCtrl::ShowCancelButton( bool show )
 {
     if ( m_cancelButtonVisible == show )
     {
@@ -352,7 +338,7 @@ void wxSearchCtrl::SetCancelButtonVisible( bool show )
     LayoutControls(0, 0, rect.GetWidth(), rect.GetHeight());
 }
 
-bool wxSearchCtrl::GetCancelButtonVisible() const
+bool wxSearchCtrl::IsCancelButtonVisible() const
 {
     return m_cancelButtonVisible;
 }
@@ -697,7 +683,7 @@ bool wxSearchCtrl::SetFont(const wxFont& font)
     bool result = wxSearchCtrlBase::SetFont(font);
     if ( result && m_text )
     {
-        result &= m_text->SetFont(font);
+        result = m_text->SetFont(font);
     }
     RecalcBitmaps();
     return result;
@@ -1008,9 +994,9 @@ void wxSearchCtrl::RecalcBitmaps()
 
     if ( !m_searchBitmapUser )
     {
-        if ( 
+        if (
             !m_searchBitmap.Ok() ||
-            m_searchBitmap.GetHeight() != bitmapHeight || 
+            m_searchBitmap.GetHeight() != bitmapHeight ||
             m_searchBitmap.GetWidth() != bitmapWidth
             )
         {
@@ -1025,9 +1011,9 @@ void wxSearchCtrl::RecalcBitmaps()
 
     if ( !m_searchMenuBitmapUser )
     {
-        if ( 
+        if (
             !m_searchMenuBitmap.Ok() ||
-            m_searchMenuBitmap.GetHeight() != bitmapHeight || 
+            m_searchMenuBitmap.GetHeight() != bitmapHeight ||
             m_searchMenuBitmap.GetWidth() != bitmapWidth
             )
         {
@@ -1042,9 +1028,9 @@ void wxSearchCtrl::RecalcBitmaps()
 
     if ( !m_cancelBitmapUser )
     {
-        if ( 
+        if (
             !m_cancelBitmap.Ok() ||
-            m_cancelBitmap.GetHeight() != bitmapHeight || 
+            m_cancelBitmap.GetHeight() != bitmapHeight ||
             m_cancelBitmap.GetWidth() != bitmapHeight
             )
         {
@@ -1077,6 +1063,6 @@ void wxSearchCtrl::PopupSearchMenu()
     }
 }
 
-#endif // !USE_NATIVE_SEARCH_CONTROL
+#endif // !wxUSE_NATIVE_SEARCH_CONTROL
 
 #endif // wxUSE_SEARCHCTRL