]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/wincmn.cpp
Compilation fixes for wxUSE_STL == 1.
[wxWidgets.git] / src / common / wincmn.cpp
index 7d18937df353e0401f7c2bf55cbfeb9ef3abaa42..e6dd55946e65ed236165c7534a38d8d97ec555ff 100644 (file)
@@ -5,7 +5,7 @@
 // Modified by:
 // Created:     13/07/98
 // RCS-ID:      $Id$
 // Modified by:
 // Created:     13/07/98
 // RCS-ID:      $Id$
-// Copyright:   (c) wxWindows team
+// Copyright:   (c) wxWidgets team
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
@@ -215,7 +215,7 @@ bool wxWindowBase::CreateBase(wxWindowBase *parent,
 
     // ids are limited to 16 bits under MSW so if you care about portability,
     // it's not a good idea to use ids out of this range (and negative ids are
 
     // ids are limited to 16 bits under MSW so if you care about portability,
     // it's not a good idea to use ids out of this range (and negative ids are
-    // reserved for wxWindows own usage)
+    // reserved for wxWidgets own usage)
     wxASSERT_MSG( id == wxID_ANY || (id >= 0 && id < 32767),
                   _T("invalid id value") );
 
     wxASSERT_MSG( id == wxID_ANY || (id >= 0 && id < 32767),
                   _T("invalid id value") );
 
@@ -620,7 +620,7 @@ wxSize wxWindowBase::DoGetBestSize() const
     }
 }
 
     }
 }
 
-void wxWindowBase::SetBestSize(const wxSize& size)
+void wxWindowBase::SetBestFittingSize(const wxSize& size)
 {
     // If the given size is incomplete then merge with the best size.
     wxSize sizeBest;
 {
     // If the given size is incomplete then merge with the best size.
     wxSize sizeBest;
@@ -974,7 +974,7 @@ wxColour wxWindowBase::GetBackgroundColour() const
 
         // we must return some valid colour to avoid redoing this every time
         // and also to avoid surprizing the applications written for older
 
         // we must return some valid colour to avoid redoing this every time
         // and also to avoid surprizing the applications written for older
-        // wxWindows versions where GetBackgroundColour() always returned
+        // wxWidgets versions where GetBackgroundColour() always returned
         // something -- so give them something even if it doesn't make sense
         // for this window (e.g. it has a themed background)
         if ( !colBg.Ok() )
         // something -- so give them something even if it doesn't make sense
         // for this window (e.g. it has a themed background)
         if ( !colBg.Ok() )
@@ -1007,25 +1007,23 @@ wxColour wxWindowBase::GetForegroundColour() const
 
 bool wxWindowBase::SetBackgroundColour( const wxColour &colour )
 {
 
 bool wxWindowBase::SetBackgroundColour( const wxColour &colour )
 {
-    if ( !colour.Ok() || (colour == m_backgroundColour) )
+    if ( colour == m_backgroundColour ) 
         return false;
 
         return false;
 
+    m_hasBgCol = colour.Ok();
     m_backgroundColour = colour;
     m_backgroundColour = colour;
-
-    m_hasBgCol = true;
-
+    SetThemeEnabled( !m_hasBgCol && !m_foregroundColour.Ok() );
     return true;
 }
 
 bool wxWindowBase::SetForegroundColour( const wxColour &colour )
 {
     return true;
 }
 
 bool wxWindowBase::SetForegroundColour( const wxColour &colour )
 {
-    if ( !colour.Ok() || (colour == m_foregroundColour) )
+    if (colour == m_foregroundColour )
         return false;
 
         return false;
 
+    m_hasFgCol = colour.Ok();
     m_foregroundColour = colour;
     m_foregroundColour = colour;
-
-    m_hasFgCol = true;
-
+    SetThemeEnabled( !m_hasFgCol && !m_backgroundColour.Ok() );
     return true;
 }
 
     return true;
 }
 
@@ -1064,9 +1062,6 @@ wxFont& wxWindowBase::DoGetFont() const
 
 bool wxWindowBase::SetFont(const wxFont& font)
 {
 
 bool wxWindowBase::SetFont(const wxFont& font)
 {
-    if ( !font.Ok() )
-        return false;
-
     if ( font == m_font )
     {
         // no change
     if ( font == m_font )
     {
         // no change
@@ -1074,8 +1069,7 @@ bool wxWindowBase::SetFont(const wxFont& font)
     }
 
     m_font = font;
     }
 
     m_font = font;
-
-    m_hasFont = true;
+    m_hasFont = font.Ok();
 
     return true;
 }
 
     return true;
 }
@@ -2167,7 +2161,7 @@ void wxWindowBase::OnMiddleClick( wxMouseEvent& event )
 
         wxMessageBox(wxString::Format(
                                       _T(
 
         wxMessageBox(wxString::Format(
                                       _T(
-                                        "       wxWindows Library (%s port)\nVersion %u.%u.%u%s, compiled at %s %s\n   Copyright (c) 1995-2002 wxWindows team"
+                                        "       wxWidgets Library (%s port)\nVersion %u.%u.%u%s, compiled at %s %s\n   Copyright (c) 1995-2002 wxWidgets team"
                                         ),
                                       port.c_str(),
                                       wxMAJOR_VERSION,
                                         ),
                                       port.c_str(),
                                       wxMAJOR_VERSION,
@@ -2181,7 +2175,7 @@ void wxWindowBase::OnMiddleClick( wxMouseEvent& event )
                                       __TDATE__,
                                       __TTIME__
                                      ),
                                       __TDATE__,
                                       __TTIME__
                                      ),
-                     _T("wxWindows information"),
+                     _T("wxWidgets information"),
                      wxICON_INFORMATION | wxOK,
                      (wxWindow *)this);
     }
                      wxICON_INFORMATION | wxOK,
                      (wxWindow *)this);
     }
@@ -2400,6 +2394,23 @@ bool wxWindowBase::TryParent(wxEvent& event)
     return wxEvtHandler::TryParent(event);
 }
 
     return wxEvtHandler::TryParent(event);
 }
 
+// ----------------------------------------------------------------------------
+// navigation
+// ----------------------------------------------------------------------------
+
+// Navigates in the specified direction.
+bool wxWindowBase::Navigate(int flags)
+{
+    wxNavigationKeyEvent eventNav;
+    eventNav.SetFlags(flags);
+    eventNav.SetEventObject(this);
+    if ( GetParent()->GetEventHandler()->ProcessEvent(eventNav) )
+    {
+        return true;
+    }
+    return false;
+}
+
 // ----------------------------------------------------------------------------
 // global functions
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // global functions
 // ----------------------------------------------------------------------------
@@ -2562,17 +2573,19 @@ wxAccStatus wxWindowAccessible::GetName(int childId, wxString* name)
 
     wxString title;
 
 
     wxString title;
 
-    // If a child, leave wxWindows to call the function on the actual
+    // If a child, leave wxWidgets to call the function on the actual
     // child object.
     if (childId > 0)
         return wxACC_NOT_IMPLEMENTED;
 
     // This will eventually be replaced by specialised
     // child object.
     if (childId > 0)
         return wxACC_NOT_IMPLEMENTED;
 
     // This will eventually be replaced by specialised
-    // accessible classes, one for each kind of wxWindows
+    // accessible classes, one for each kind of wxWidgets
     // control or window.
     // control or window.
+#if wxUSE_BUTTON
     if (GetWindow()->IsKindOf(CLASSINFO(wxButton)))
         title = ((wxButton*) GetWindow())->GetLabel();
     else
     if (GetWindow()->IsKindOf(CLASSINFO(wxButton)))
         title = ((wxButton*) GetWindow())->GetLabel();
     else
+#endif
         title = GetWindow()->GetName();
 
     if (!title.IsEmpty())
         title = GetWindow()->GetName();
 
     if (!title.IsEmpty())
@@ -2723,7 +2736,7 @@ wxAccStatus wxWindowAccessible::GetRole(int childId, wxAccRole* role)
     if (!GetWindow())
         return wxACC_FAIL;
 
     if (!GetWindow())
         return wxACC_FAIL;
 
-    // If a child, leave wxWindows to call the function on the actual
+    // If a child, leave wxWidgets to call the function on the actual
     // child object.
     if (childId > 0)
         return wxACC_NOT_IMPLEMENTED;
     // child object.
     if (childId > 0)
         return wxACC_NOT_IMPLEMENTED;
@@ -2755,7 +2768,7 @@ wxAccStatus wxWindowAccessible::GetState(int childId, long* state)
     if (!GetWindow())
         return wxACC_FAIL;
 
     if (!GetWindow())
         return wxACC_FAIL;
 
-    // If a child, leave wxWindows to call the function on the actual
+    // If a child, leave wxWidgets to call the function on the actual
     // child object.
     if (childId > 0)
         return wxACC_NOT_IMPLEMENTED;
     // child object.
     if (childId > 0)
         return wxACC_NOT_IMPLEMENTED;