From fe3d9123c6968b452a95133c635069d6f7ae8ea5 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Tue, 6 May 2003 21:57:32 +0000 Subject: [PATCH] Revamped border handling. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20511 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/button.h | 2 +- include/wx/msw/window.h | 9 +--- src/msw/choice.cpp | 14 ------ src/msw/combobox.cpp | 14 ------ src/msw/control.cpp | 10 ++-- src/msw/gauge95.cpp | 8 +-- src/msw/glcanvas.cpp | 17 +------ src/msw/listbox.cpp | 25 ++-------- src/msw/listctrl.cpp | 12 ++--- src/msw/scrolbar.cpp | 7 ++- src/msw/slider95.cpp | 19 ++++--- src/msw/slidrmsw.cpp | 12 ++--- src/msw/spinctrl.cpp | 15 ++---- src/msw/stattext.cpp | 4 ++ src/msw/tglbtn.cpp | 9 +++- src/msw/window.cpp | 108 +++++++--------------------------------- 16 files changed, 72 insertions(+), 213 deletions(-) diff --git a/include/wx/msw/button.h b/include/wx/msw/button.h index 5710249793..5caf45782a 100644 --- a/include/wx/msw/button.h +++ b/include/wx/msw/button.h @@ -78,7 +78,7 @@ protected: // usually overridden base class virtuals virtual wxSize DoGetBestSize() const; - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const ; private: DECLARE_DYNAMIC_CLASS(wxButton) diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index 2ffaa76e92..a34ac1e2dd 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -212,13 +212,6 @@ public: wxWindow *FindItem(long id) const; wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const; - // Make a Windows extended style from the given wxWindows window style - static WXDWORD MakeExtendedStyle(long style, - bool eliminateBorders = FALSE); - - // Determine whether 3D effects are wanted - WXDWORD Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D) const; - // MSW only: TRUE if this control is part of the main control virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; }; @@ -227,7 +220,7 @@ public: // // this is the function that should be overridden in the derived classes, // but you will mostly use MSWGetCreateWindowFlags() below - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const ; // get the MSW window flags corresponding to wxWindows ones // diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index 5493aedb24..f8620938f2 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -393,25 +393,11 @@ bool wxChoice::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) } WXHBRUSH wxChoice::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor), -#if wxUSE_CTL3D - WXUINT message, - WXWPARAM wParam, - WXLPARAM lParam -#else WXUINT WXUNUSED(message), WXWPARAM WXUNUSED(wParam), WXLPARAM WXUNUSED(lParam) -#endif ) { -#if wxUSE_CTL3D - if ( m_useCtl3D ) - { - HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam); - return (WXHBRUSH) hbrush; - } -#endif // wxUSE_CTL3D - HDC hdc = (HDC)pDC; if (GetParent()->GetTransparentBackground()) SetBkMode(hdc, TRANSPARENT); diff --git a/src/msw/combobox.cpp b/src/msw/combobox.cpp index a2a49d7f78..5082a9b728 100644 --- a/src/msw/combobox.cpp +++ b/src/msw/combobox.cpp @@ -156,25 +156,11 @@ LRESULT APIENTRY _EXPORT wxComboEditWndProc(HWND hWnd, } WXHBRUSH wxComboBox::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor), -#if wxUSE_CTL3D - WXUINT message, - WXWPARAM wParam, - WXLPARAM lParam -#else WXUINT WXUNUSED(message), WXWPARAM WXUNUSED(wParam), WXLPARAM WXUNUSED(lParam) -#endif ) { -#if wxUSE_CTL3D - if ( m_useCtl3D ) - { - HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam); - return (WXHBRUSH) hbrush; - } -#endif // wxUSE_CTL3D - HDC hdc = (HDC)pDC; if (GetParent()->GetTransparentBackground()) SetBkMode(hdc, TRANSPARENT); diff --git a/src/msw/control.cpp b/src/msw/control.cpp index 4eb36ecd3a..e05ee6476d 100644 --- a/src/msw/control.cpp +++ b/src/msw/control.cpp @@ -93,16 +93,12 @@ bool wxControl::MSWCreateControl(const wxChar *classname, const wxString& label, WXDWORD exstyle) { - // want3D tells us whether or not the style specified a 3D border. - // If so, under WIN16 we can use Ctl3D to give it an appropriate style. - // Sometimes want3D is used to indicate that the non-extended style should have - // WS_BORDER. - bool want3D = TRUE; - // if no extended style given, determine it ourselves if ( exstyle == (WXDWORD)-1 ) { - exstyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D); +// exstyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D); + exstyle = 0; + (void) MSWGetStyle(GetWindowStyle(), & exstyle) ; } // all controls should have this style diff --git a/src/msw/gauge95.cpp b/src/msw/gauge95.cpp index 2d93312fc6..0a13eb3e4b 100644 --- a/src/msw/gauge95.cpp +++ b/src/msw/gauge95.cpp @@ -101,11 +101,13 @@ bool wxGauge95::Create(wxWindow *parent, wxWindowID id, int width = size.x; int height = size.y; - long msFlags = WS_CHILD | WS_VISIBLE /* | WS_CLIPSIBLINGS */; + WXDWORD exStyle = 0; + long msFlags = MSWGetStyle(style, & exStyle) ; +/* if ( m_windowStyle & wxCLIP_SIBLINGS ) msFlags |= WS_CLIPSIBLINGS; - +*/ if (m_windowStyle & wxGA_VERTICAL) msFlags |= PBS_VERTICAL; @@ -114,7 +116,7 @@ bool wxGauge95::Create(wxWindow *parent, wxWindowID id, msFlags |= PBS_SMOOTH; HWND wx_button = - CreateWindowEx(MakeExtendedStyle(m_windowStyle), PROGRESS_CLASS, NULL, msFlags, + CreateWindowEx(exStyle, PROGRESS_CLASS, NULL, msFlags, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId, wxGetInstance(), NULL); diff --git a/src/msw/glcanvas.cpp b/src/msw/glcanvas.cpp index 44ac48b0b9..2772f79ba4 100644 --- a/src/msw/glcanvas.cpp +++ b/src/msw/glcanvas.cpp @@ -293,10 +293,6 @@ bool wxGLCanvas::Create(wxWindow *parent, parent->AddChild(this); DWORD msflags = 0; - if ( style & wxBORDER ) - msflags |= WS_BORDER; - if ( style & wxTHICK_FRAME ) - msflags |= WS_THICKFRAME; /* A general rule with OpenGL and Win32 is that any window that will have a @@ -305,18 +301,9 @@ bool wxGLCanvas::Create(wxWindow *parent, books that contain the wgl function descriptions. */ + WXDWORD exStyle = 0; msflags |= WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN; - - bool want3D; - WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D); - - // Even with extended styles, need to combine with WS_BORDER - // for them to look right. - if ( want3D || (m_windowStyle & wxSIMPLE_BORDER) || (m_windowStyle & wxRAISED_BORDER ) || - (m_windowStyle & wxSUNKEN_BORDER) || (m_windowStyle & wxDOUBLE_BORDER)) - { - msflags |= WS_BORDER; - } + msflags |= MSWGetStyle(style, & exStyle) ; return MSWCreate(wxGLCanvasClassName, NULL, pos, size, msflags, exStyle); } diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp index ea6f4cf692..655dea6722 100644 --- a/src/msw/listbox.cpp +++ b/src/msw/listbox.cpp @@ -123,8 +123,8 @@ bool wxListBox::Create(wxWindow *parent, int height = size.y; m_windowStyle = style; - DWORD wstyle = WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | - LBS_NOTIFY | LBS_HASSTRINGS /* | WS_CLIPSIBLINGS */; + DWORD wstyle = WS_VISIBLE | WS_CHILD | WS_VSCROLL | WS_TABSTOP | + LBS_NOTIFY | LBS_HASSTRINGS ; wxASSERT_MSG( !(style & wxLB_MULTIPLE) || !(style & wxLB_EXTENDED), _T("only one of listbox selection modes can be specified") ); @@ -158,32 +158,17 @@ bool wxListBox::Create(wxWindow *parent, // doesn't work properly wstyle |= LBS_NOINTEGRALHEIGHT; - bool want3D; - WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D); - - // Even with extended styles, need to combine with WS_BORDER for them to - // look right. - if ( want3D || wxStyleHasBorder(m_windowStyle) ) - { - wstyle |= WS_BORDER; - } + WXDWORD exStyle = 0; + (void) MSWGetStyle(style, & exStyle) ; m_hWnd = (WXHWND)::CreateWindowEx(exStyle, wxT("LISTBOX"), NULL, - wstyle | WS_CHILD, + wstyle , 0, 0, 0, 0, (HWND)parent->GetHWND(), (HMENU)m_windowId, wxGetInstance(), NULL); wxCHECK_MSG( m_hWnd, FALSE, wxT("Failed to create listbox") ); -#if wxUSE_CTL3D - if (want3D) - { - Ctl3dSubclassCtl(GetHwnd()); - m_useCtl3D = TRUE; - } -#endif - // Subclass again to catch messages SubclassWin(m_hWnd); diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 64e1e60785..c369f92b0f 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -291,8 +291,11 @@ bool wxListCtrl::Create(wxWindow *parent, if ( m_windowStyle & wxCLIP_SIBLINGS ) wstyle |= WS_CLIPSIBLINGS; +/* if ( wxStyleHasBorder(m_windowStyle) ) wstyle |= WS_BORDER; +*/ + m_baseStyle = wstyle; if ( !DoCreateControl(x, y, width, height) ) @@ -308,13 +311,8 @@ bool wxListCtrl::DoCreateControl(int x, int y, int w, int h) { DWORD wstyle = m_baseStyle; - bool want3D; - WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D); - - // Even with extended styles, need to combine with WS_BORDER - // for them to look right. - if ( want3D ) - wstyle |= WS_BORDER; + WXDWORD exStyle = 0; + (void) MSWGetStyle(GetWindowStyle(), & exStyle) ; long oldStyle = 0; // Dummy wstyle |= ConvertToMSWStyle(oldStyle, m_windowStyle); diff --git a/src/msw/scrolbar.cpp b/src/msw/scrolbar.cpp index cd25307611..63cc9f5d40 100644 --- a/src/msw/scrolbar.cpp +++ b/src/msw/scrolbar.cpp @@ -82,15 +82,18 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id, height = 14; } - DWORD wstyle = WS_VISIBLE | WS_CHILD; + WXDWORD exStyle = 0; + WXDWORD wstyle = MSWGetStyle(style, & exStyle) ; +/* if ( m_windowStyle & wxCLIP_SIBLINGS ) wstyle |= WS_CLIPSIBLINGS; +*/ // Now create scrollbar DWORD _direction = (style & wxHORIZONTAL) ? SBS_HORZ: SBS_VERT; - HWND scroll_bar = CreateWindowEx(MakeExtendedStyle(style), wxT("SCROLLBAR"), wxT("scrollbar"), + HWND scroll_bar = CreateWindowEx(exStyle, wxT("SCROLLBAR"), wxT("scrollbar"), _direction | wstyle, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId, wxGetInstance(), NULL); diff --git a/src/msw/slider95.cpp b/src/msw/slider95.cpp index d818a6b3a2..ba25fe1687 100644 --- a/src/msw/slider95.cpp +++ b/src/msw/slider95.cpp @@ -59,6 +59,9 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { + if ( (style & wxBORDER_MASK) == wxBORDER_DEFAULT ) + style |= wxBORDER_NONE; + SetName(name); #if wxUSE_VALIDATORS SetValidator(validator); @@ -90,15 +93,12 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id, long msStyle = 0; long wstyle = 0; - if ( m_windowStyle & wxCLIP_SIBLINGS ) - msStyle |= WS_CLIPSIBLINGS; - if ( m_windowStyle & wxSL_LABELS ) { - msStyle |= WS_CHILD | WS_VISIBLE | WS_BORDER | SS_CENTER; + msStyle |= SS_CENTER; - bool want3D; - WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ; + WXDWORD exStyle = 0; + msStyle |= MSWGetStyle(GetWindowStyle(), & exStyle) ; m_staticValue = (WXHWND) CreateWindowEx ( @@ -123,10 +123,9 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id, ); } - msStyle = 0; + WXDWORD exStyle = 0; - if ( m_windowStyle & wxCLIP_SIBLINGS ) - msStyle |= WS_CLIPSIBLINGS; + msStyle = MSWGetStyle(GetWindowStyle(), & exStyle) ; if (m_windowStyle & wxSL_VERTICAL) msStyle = TBS_VERT | WS_CHILD | WS_VISIBLE | WS_TABSTOP ; @@ -154,7 +153,7 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id, HWND scroll_bar = CreateWindowEx ( - MakeExtendedStyle(m_windowStyle), TRACKBAR_CLASS, wxT(""), + exStyle, TRACKBAR_CLASS, wxT(""), msStyle, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId, wxGetInstance(), NULL diff --git a/src/msw/slidrmsw.cpp b/src/msw/slidrmsw.cpp index 79bfa0f06f..0aad8787d2 100644 --- a/src/msw/slidrmsw.cpp +++ b/src/msw/slidrmsw.cpp @@ -78,13 +78,11 @@ bool wxSliderMSW::Create(wxWindow *parent, wxWindowID id, // non-Win95 implementation - long msStyle = WS_CHILD | WS_VISIBLE | WS_BORDER | SS_CENTER; + long msStyle = SS_CENTER; - if ( m_windowStyle & wxCLIP_SIBLINGS ) - msStyle |= WS_CLIPSIBLINGS; - - bool want3D; - WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ; + // WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ; + WXDWORD exStyle = 0; + msStyle |= MSWGetStyle(GetWindowStyle(), & exStyle) ; m_staticValue = (WXHWND) CreateWindowEx(exStyle, wxT("STATIC"), NULL, msStyle, @@ -108,7 +106,7 @@ bool wxSliderMSW::Create(wxWindow *parent, wxWindowID id, else msStyle = SBS_HORZ | WS_CHILD | WS_VISIBLE | WS_TABSTOP ; - HWND scroll_bar = CreateWindowEx(MakeExtendedStyle(m_windowStyle), wxT("SCROLLBAR"), wxT(""), + HWND scroll_bar = CreateWindowEx(exStyle, wxT("SCROLLBAR"), wxT(""), msStyle, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId, wxGetInstance(), NULL); diff --git a/src/msw/spinctrl.cpp b/src/msw/spinctrl.cpp index 672b161c2b..2f3bdc7b11 100644 --- a/src/msw/spinctrl.cpp +++ b/src/msw/spinctrl.cpp @@ -238,6 +238,9 @@ bool wxSpinCtrl::Create(wxWindow *parent, SetWindowStyle(style); + WXDWORD exStyle = 0; + WXDWORD msStyle = MSWGetStyle(GetWindowStyle(), & exStyle) ; + // calculate the sizes: the size given is the toal size for both controls // and we need to fit them both in the given width (height is the same) wxSize sizeText(size), sizeBtn(size); @@ -265,18 +268,6 @@ bool wxSpinCtrl::Create(wxWindow *parent, // create the text window - bool want3D; - WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D); - int msStyle = WS_CHILD; - - // Even with extended styles, need to combine with WS_BORDER for them to - // look right. - if ( want3D || wxStyleHasBorder(style) ) - msStyle |= WS_BORDER; - - if ( style & wxCLIP_SIBLINGS ) - msStyle |= WS_CLIPSIBLINGS; - m_hwndBuddy = (WXHWND)::CreateWindowEx ( exStyle, // sunken border diff --git a/src/msw/stattext.cpp b/src/msw/stattext.cpp index 0da7ce60b3..5248292eea 100644 --- a/src/msw/stattext.cpp +++ b/src/msw/stattext.cpp @@ -42,6 +42,10 @@ bool wxStaticText::Create(wxWindow *parent, long style, const wxString& name) { + // By default, a static text should have no border. + if ((style & wxBORDER_MASK) == wxBORDER_DEFAULT) + style |= wxBORDER_NONE; + if ( !CreateControl(parent, id, pos, size, style, wxDefaultValidator, name) ) return FALSE; diff --git a/src/msw/tglbtn.cpp b/src/msw/tglbtn.cpp index 58889e0fb9..d98f6bced5 100644 --- a/src/msw/tglbtn.cpp +++ b/src/msw/tglbtn.cpp @@ -85,10 +85,15 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id, #define BS_PUSHLIKE 0x00001000L #endif - long msStyle = BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP | WS_CHILD | WS_VISIBLE; + WXDWORD exStyle = 0; + long msStyle = MSWGetStyle(style, & exStyle) ; + + msStyle |= BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP ; +/* if ( m_windowStyle & wxCLIP_SIBLINGS ) msStyle |= WS_CLIPSIBLINGS; +*/ #ifdef __WIN32__ if(m_windowStyle & wxBU_LEFT) @@ -101,7 +106,7 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id, msStyle |= BS_BOTTOM; #endif - m_hWnd = (WXHWND)CreateWindowEx(MakeExtendedStyle(m_windowStyle), + m_hWnd = (WXHWND)CreateWindowEx(exStyle, wxT("BUTTON"), label, msStyle, 0, 0, 0, 0, (HWND)parent->GetHWND(), diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 7f48e64a46..a3e8a83329 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -1165,9 +1165,22 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const style |= WS_CLIPSIBLINGS; wxBorder border = (wxBorder)(flags & wxBORDER_MASK); - if ( border != wxBORDER_NONE && border != wxBORDER_DEFAULT ) + + // Check if we want to automatically give it a sunken style. + // Note than because 'sunken' actually maps to WS_EX_CLIENTEDGE, which + // is a more neutral term, we don't necessarily get a sunken effect in + // Windows XP. Instead we get the appropriate style for the theme. + + if (border == wxBORDER_DEFAULT && wxTheApp->GetAuto3D() && GetParent() && + ((GetParent()->GetWindowStyleFlag() & wxUSER_COLOURS) != wxUSER_COLOURS)) + { + border = (wxBorder)((flags & wxBORDER_MASK) | wxBORDER_SUNKEN); + } + + // Only give it WS_BORDER for wxBORDER_SIMPLE + if (border & wxBORDER_SIMPLE) style |= WS_BORDER; - + // now deal with ext style if the caller wants it if ( exstyle ) { @@ -1176,7 +1189,7 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const if ( flags & wxTRANSPARENT_WINDOW ) *exstyle |= WS_EX_TRANSPARENT; - switch ( flags & wxBORDER_MASK ) + switch ( border ) { default: wxFAIL_MSG( _T("unknown border style") ); @@ -1197,6 +1210,7 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const case wxBORDER_SUNKEN: *exstyle |= WS_EX_CLIENTEDGE; + style &= ~WS_BORDER; break; case wxBORDER_DOUBLE: @@ -1218,94 +1232,6 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const return style; } -// Make a Windows extended style from the given wxWindows window style -WXDWORD wxWindowMSW::MakeExtendedStyle(long style, bool eliminateBorders) -{ - WXDWORD exStyle = 0; - if ( style & wxTRANSPARENT_WINDOW ) - exStyle |= WS_EX_TRANSPARENT; - - if ( !eliminateBorders ) - { - if ( style & wxSUNKEN_BORDER ) - exStyle |= WS_EX_CLIENTEDGE; - if ( style & wxDOUBLE_BORDER ) - exStyle |= WS_EX_DLGMODALFRAME; -#if defined(__WIN95__) - if ( style & wxRAISED_BORDER ) - // It seems that WS_EX_WINDOWEDGE doesn't work, but WS_EX_DLGMODALFRAME does - exStyle |= WS_EX_DLGMODALFRAME; /* WS_EX_WINDOWEDGE */; - if ( style & wxSTATIC_BORDER ) - exStyle |= WS_EX_STATICEDGE; -#endif - } - - return exStyle; -} - -// Determines whether native 3D effects or CTL3D should be used, -// applying a default border style if required, and returning an extended -// style to pass to CreateWindowEx. -WXDWORD wxWindowMSW::Determine3DEffects(WXDWORD defaultBorderStyle, - bool *want3D) const -{ - // If matches certain criteria, then assume no 3D effects - // unless specifically requested (dealt with in MakeExtendedStyle) - if ( !GetParent() -#if wxUSE_CONTROLS - || !IsKindOf(CLASSINFO(wxControl)) -#endif // wxUSE_CONTROLS - || (m_windowStyle & wxNO_BORDER) ) - { - *want3D = FALSE; - return MakeExtendedStyle(m_windowStyle); - } - - // Determine whether we should be using 3D effects or not. - bool nativeBorder = FALSE; // by default, we don't want a Win95 effect - - // 1) App can specify global 3D effects - *want3D = wxTheApp->GetAuto3D(); - - // 2) If the parent is being drawn with user colours, or simple border specified, - // switch effects off. TODO: replace wxUSER_COLOURS with wxNO_3D - if ( GetParent() && (GetParent()->GetWindowStyleFlag() & wxUSER_COLOURS) || (m_windowStyle & wxSIMPLE_BORDER) ) - *want3D = FALSE; - - // 3) Control can override this global setting by defining - // a border style, e.g. wxSUNKEN_BORDER - if ( m_windowStyle & wxSUNKEN_BORDER ) - *want3D = TRUE; - - // 4) If it's a special border, CTL3D can't cope so we want a native border - if ( (m_windowStyle & wxDOUBLE_BORDER) || (m_windowStyle & wxRAISED_BORDER) || - (m_windowStyle & wxSTATIC_BORDER) ) - { - *want3D = TRUE; - nativeBorder = TRUE; - } - - // 5) If this isn't a Win95 app, and we are using CTL3D, remove border - // effects from extended style -#if wxUSE_CTL3D - if ( *want3D ) - nativeBorder = FALSE; -#endif - - DWORD exStyle = MakeExtendedStyle(m_windowStyle, !nativeBorder); - - // If we want 3D, but haven't specified a border here, - // apply the default border style specified. - // TODO what about non-Win95 WIN32? Does it have borders? -#if defined(__WIN95__) && !wxUSE_CTL3D - if ( defaultBorderStyle && (*want3D) && ! ((m_windowStyle & wxDOUBLE_BORDER) || (m_windowStyle & wxRAISED_BORDER ) || - (m_windowStyle & wxSTATIC_BORDER) || (m_windowStyle & wxSIMPLE_BORDER) )) - exStyle |= defaultBorderStyle; // WS_EX_CLIENTEDGE; -#endif - - return exStyle; -} - #if WXWIN_COMPATIBILITY // If nothing defined for this, try the parent. // E.g. we may be a button loaded from a resource, with no callback function -- 2.47.2