]> git.saurik.com Git - wxWidgets.git/commitdiff
wxBORDER_THEME now means 'use an appropriate themed border' on all plaforms
authorJulian Smart <julian@anthemion.co.uk>
Tue, 18 Sep 2007 10:48:05 +0000 (10:48 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Tue, 18 Sep 2007 10:48:05 +0000 (10:48 +0000)
as opposed to wxBORDER_NONE which may or may not show a border, depending on control.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48761 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/window.tex
docs/latex/wx/wxmsw.tex
include/wx/defs.h
include/wx/window.h
src/common/wincmn.cpp
src/gtk/window.cpp
src/msw/window.cpp

index 1ce3f15b5f9dfb081a2e6559f342b3f4f3ed1a1b..81cc3b622bfeb6ffc957d67929b507c92ee920e0 100644 (file)
@@ -52,15 +52,16 @@ window class or on all platforms.
 
 \twocolwidtha{5cm}%
 \begin{twocollist}\itemsep=0pt
+\twocolitem{\windowstyle{wxBORDER\_DEFAULT}}{The window class will decide the kind of border to show, if any.}
 \twocolitem{\windowstyle{wxBORDER\_SIMPLE}}{Displays a thin border around the window. wxSIMPLE\_BORDER is the old name
 for this style. }
-\twocolitem{\windowstyle{wxBORDER\_DOUBLE}}{Displays a double border. wxDOUBLE\_BORDER is the old name for this style. Windows and Mac only.}
 \twocolitem{\windowstyle{wxBORDER\_SUNKEN}}{Displays a sunken border. wxSUNKEN\_BORDER is the old name for this style.}
 \twocolitem{\windowstyle{wxBORDER\_RAISED}}{Displays a raised border. wxRAISED\_BORDER is the old name for this style. }
 \twocolitem{\windowstyle{wxBORDER\_STATIC}}{Displays a border suitable for a static control.  wxSTATIC\_BORDER is the old name for this style. Windows only. }
-\twocolitem{\windowstyle{wxBORDER\_THEME}}{Displays a themed border where possible. Currently this has an effect on Windows XP and above only.
-For more information on themed borders, please see \helpref{Themed borders on Windows}{wxmswthemedborders}.}
+\twocolitem{\windowstyle{wxBORDER\_THEME}}{Displays a native border suitable for a control, on the current platform. On Windows XP or Vista, this will be a themed border; on most other platforms
+a sunken border will be used. For more information for themed borders on Windows, please see \helpref{Themed borders on Windows}{wxmswthemedborders}.}
 \twocolitem{\windowstyle{wxBORDER\_NONE}}{Displays no border, overriding the default border style for the window. wxNO\_BORDER is the old name for this style.}
+\twocolitem{\windowstyle{wxBORDER\_DOUBLE}}{This style is obsolete and should not be used.}
 \twocolitem{\windowstyle{wxTRANSPARENT\_WINDOW}}{The window is transparent, that is, it will not receive paint
 events. Windows only.}
 \twocolitem{\windowstyle{wxTAB\_TRAVERSAL}}{Use this to enable tab traversal for non-dialog windows.}
index 40dda722df9ead58d8a5a35d3f26bbe5f2006bd5..7ed271eb6f148328ed8db836b94d0d1ef28fe8d6 100644 (file)
@@ -35,16 +35,10 @@ If you don't specify a border style for a wxTextCtrl in rich edit mode, wxWidget
 the control themed borders automatically, where previously they would take the Windows 95-style
 sunken border. Other native controls such as wxTextCtrl in non-rich edit mode, and wxComboBox,
 already paint themed borders where appropriate. To use themed borders on other windows, such
-as wxPanel, pass the wxBORDER\_THEME style, or pass no border style.
+as wxPanel, pass the wxBORDER\_THEME style, or (apart from wxPanel) pass no border style.
 
-Note that in wxWidgets 2.9 and above, wxBORDER\_THEME is defined to be 0 and it is not necessary
-to pass the border style explicitly: wxWidgets will deduce the correct border style itself if there
-is none supplied. Because of the requirements of binary compatibility, this automatic border
-capability could not be put into wxWidgets 2.8 except for built-in, native controls. So in 2.8, the border
-must be specified for custom controls and windows.
-
-Since specifying wxBORDER\_THEME is defined as 0 and is the equivalent of abstaining on the
-border style decision, on non-Windows platforms a suitable border style will be chosen.
+In general, specifying wxBORDER\_THEME will cause a border of some kind to be used, chosen by the platform
+and control class. To leave the border decision entirely to wxWidgets, pass wxBORDER\_DEFAULT.
 This is not to be confused with specifying wxBORDER\_NONE, which says that there should
 definitely be {\it no} border.
 
@@ -53,6 +47,8 @@ definitely be {\it no} border.
 The way that wxMSW decides whether to apply a themed border is as follows.
 The theming code calls wxWindow::GetBorder() to obtain a border. If no border style has been
 passed to the window constructor, GetBorder() calls GetDefaultBorder() for this window.
+If wxBORDER\_THEME was passed to the window constructor, GetBorder() calls GetDefaultBorderForControl().
+
 The implementation of wxWindow::GetDefaultBorder() on wxMSW calls wxWindow::CanApplyThemeBorder()
 which is a virtual function that tells wxWidgets whether a control can have a theme
 applied explicitly (some native controls already paint a theme in which case we should not
index 8311be30bcf08bf0bdc9ba1f46035b6c15b68a46..63fb8e9331198eabba6fa995db2a8e25b43d9fe1 100644 (file)
@@ -1407,7 +1407,7 @@ enum wxBorder
     wxBORDER_RAISED = 0x04000000,
     wxBORDER_SUNKEN = 0x08000000,
     wxBORDER_DOUBLE = 0x10000000, /* deprecated */
-    wxBORDER_THEME  = wxBORDER_DEFAULT,
+    wxBORDER_THEME  = wxBORDER_DOUBLE,
 
     /*  a mask to extract border style from the combination of flags */
     wxBORDER_MASK   = 0x1f200000
@@ -2542,9 +2542,9 @@ typedef void*       WXDisplay;
  * since they are unlikely to be needed in a public header.
  */
 #if defined(__LP64__) && __LP64__
-       typedef double CGFloat;
+    typedef double CGFloat;
 #else
-       typedef float CGFloat;
+    typedef float CGFloat;
 #endif
 
 #if (defined(__LP64__) && __LP64__) || (defined(NS_BUILD_32_LIKE_64) && NS_BUILD_32_LIKE_64)
index 53aad4df97f478fdbced90454f74aae6ade14331..717aabd93e54c580d05d987264b02e4599c4f59f 100644 (file)
@@ -1387,7 +1387,7 @@ protected:
     // this allows you to implement standard control borders without
     // repeating the code in different classes that are not derived from
     // wxControl
-    virtual wxBorder GetDefaultBorderForControl() const { return wxWindowBase::GetDefaultBorder(); }
+    virtual wxBorder GetDefaultBorderForControl() const { return wxBORDER_SUNKEN; }
 
     // Get the default size for the new window if no explicit size given. TLWs
     // have their own default size so this is just for non top-level windows.
index a48533d9689d1448a0e2811879f689ea18e4902a..307f2c1c640200262486557dbbb17fec493e2ea5 100644 (file)
@@ -2415,6 +2415,10 @@ wxBorder wxWindowBase::GetBorder(long flags) const
     {
         border = GetDefaultBorder();
     }
+    else if ( border == wxBORDER_THEME )
+    {
+        border = GetDefaultBorderForControl();
+    }
 
     return border;
 }
index d8ae28d5418abd7dbe94e07924b29c34dce3133c..fb3d2024fdacab81f7a43424a3b4fdd5fce0e758 100644 (file)
@@ -1563,7 +1563,7 @@ gtk_window_button_press_callback( GtkWidget *widget,
     if ( ret )
         return TRUE;
 
-    if ((event_type == wxEVT_LEFT_DOWN) && !win->IsOfStandardClass() && 
+    if ((event_type == wxEVT_LEFT_DOWN) && !win->IsOfStandardClass() &&
         (g_focusWindow != win) /* && win->IsFocusable() */)
     {
         win->SetFocus();
@@ -1858,9 +1858,9 @@ gtk_window_focus_out_callback( GtkWidget *widget,
         // Disable default focus handling for custom windows
         // since the default GTK+ handler issues a repaint
         if ( has_wxwindow )
-       {
+    {
             return TRUE;
-       }
+    }
     }
 
     // continue with normal processing
@@ -2098,7 +2098,7 @@ void gtk_window_size_callback( GtkWidget *WXUNUSED(widget),
 }
 
 //-----------------------------------------------------------------------------
-// "grab_broken" 
+// "grab_broken"
 //-----------------------------------------------------------------------------
 
 #ifdef __WXGTK210__
@@ -4317,8 +4317,11 @@ void wxWindowGTK::GtkScrolledWindowSetBorder(GtkWidget* w, int wxstyle)
             gtkstyle = GTK_SHADOW_OUT;
         else if (wxstyle & wxBORDER_SUNKEN)
             gtkstyle = GTK_SHADOW_IN;
+#if 0
+        // Now obsolete
         else if (wxstyle & wxBORDER_DOUBLE)
             gtkstyle = GTK_SHADOW_ETCHED_IN;
+#endif
         else //default
             gtkstyle = GTK_SHADOW_IN;
 
index 850a15f17dda0f69688625234f5eaf22d3f57b6b..cc05d86fca5285af355cd3b2753a6bf998791e4f 100644 (file)
@@ -1359,11 +1359,14 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const
 
         switch ( border )
         {
-            case wxBORDER_DEFAULT: // also wxBORDER_THEME
-                break;
+            default:
+            case wxBORDER_DEFAULT:
+                wxFAIL_MSG( _T("unknown border style") );
+                // fall through
 
             case wxBORDER_NONE:
             case wxBORDER_SIMPLE:
+            case wxBORDER_THEME:
                 break;
 
             case wxBORDER_STATIC:
@@ -1379,13 +1382,9 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const
                 style &= ~WS_BORDER;
                 break;
 
-            default:
-                wxFAIL_MSG( _T("unknown border style") );
-                break;
-
-            case wxBORDER_DOUBLE:
-                *exstyle |= WS_EX_DLGMODALFRAME;
-                break;
+//            case wxBORDER_DOUBLE:
+//                *exstyle |= WS_EX_DLGMODALFRAME;
+//                break;
         }
 
         // wxUniv doesn't use Windows dialog navigation functions at all