More border rationalisation. GetDefaultBorder is now mostly defined in base class files.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49893 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -455,6 +455,8 @@ public:
|
||||
bool IsDragging() const { return m_is_dragging; }
|
||||
|
||||
protected:
|
||||
// choose the default border for this window
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||
|
||||
void OnPaint(wxPaintEvent& evt);
|
||||
void OnEraseBackground(wxEraseEvent& evt);
|
||||
@@ -580,6 +582,8 @@ public:
|
||||
// virtual bool AcceptsFocus() const { return false; }
|
||||
|
||||
protected:
|
||||
// choose the default border for this window
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||
|
||||
// these can be overridden
|
||||
virtual void UpdateTabCtrlHeight();
|
||||
|
@@ -243,6 +243,9 @@ protected:
|
||||
SetSelection_SendEvent = 1
|
||||
};
|
||||
|
||||
// choose the default border for this window
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||
|
||||
// set the selection to the given page, sending the events (which can
|
||||
// possibly prevent the page change from taking place) if SendEvent flag is
|
||||
// included
|
||||
|
@@ -78,6 +78,9 @@ public:
|
||||
static wxSize GetDefaultSize();
|
||||
|
||||
protected:
|
||||
// choose the default border for this window
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxButtonBase)
|
||||
};
|
||||
|
||||
|
@@ -118,6 +118,9 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
// choose the default border for this window
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||
|
||||
virtual void DoSet3StateValue(wxCheckBoxState WXUNUSED(state)) { wxFAIL; }
|
||||
|
||||
virtual wxCheckBoxState DoGet3StateValue() const
|
||||
|
@@ -92,6 +92,9 @@ public:
|
||||
virtual void DoUpdateWindowUI(wxUpdateUIEvent& event);
|
||||
|
||||
protected:
|
||||
// choose the default border for this window
|
||||
virtual wxBorder GetDefaultBorder() const;
|
||||
|
||||
// creates the control (calls wxWindowBase::CreateBase inside) and adds it
|
||||
// to the list of parents children
|
||||
bool CreateControl(wxWindowBase *parent,
|
||||
|
@@ -88,6 +88,8 @@ public:
|
||||
virtual bool AcceptsFocus() const { return false; }
|
||||
|
||||
protected:
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||
|
||||
// the max position
|
||||
int m_rangeMax;
|
||||
|
||||
|
@@ -69,6 +69,8 @@ public:
|
||||
// wxWindow::Get/SetFont, wxWindow::Get/SetCursor are important !
|
||||
|
||||
protected:
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||
|
||||
// checks for validity some of the ctor/Create() function parameters
|
||||
void CheckParams(const wxString& label, const wxString& url, long style);
|
||||
|
||||
|
@@ -49,6 +49,7 @@ public:
|
||||
virtual void Command(wxCommandEvent& event);
|
||||
|
||||
protected:
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
private:
|
||||
|
@@ -37,6 +37,10 @@ public:
|
||||
long style = 0,
|
||||
const wxValidator& val = wxDefaultValidator,
|
||||
const wxString &name = wxCheckBoxNameStr );
|
||||
|
||||
protected:
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxToggleButton)
|
||||
|
||||
|
@@ -86,6 +86,9 @@ public:
|
||||
virtual bool CanApplyThemeBorder() const { return false; }
|
||||
|
||||
protected:
|
||||
// choose the default border for this window
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||
|
||||
// common part of all ctors
|
||||
void Init() { m_lastAcceptedSelection = wxID_NONE; }
|
||||
|
||||
|
@@ -61,6 +61,7 @@ public:
|
||||
virtual bool CanApplyThemeBorder() const { return false; }
|
||||
|
||||
protected:
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
// the date currently shown by the control, may be invalid
|
||||
|
@@ -116,9 +116,6 @@ protected:
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||
|
||||
|
||||
// the labels windows, if any
|
||||
wxSubwindows *m_labels;
|
||||
|
||||
|
@@ -58,7 +58,6 @@ public:
|
||||
virtual bool CanApplyThemeBorder() const { return false; }
|
||||
|
||||
protected:
|
||||
virtual wxBorder GetDefaultBorder() const;
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
// ctor/dtor helpers
|
||||
|
@@ -46,9 +46,6 @@ public:
|
||||
protected:
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
// choose the default border for this window
|
||||
virtual wxBorder GetDefaultBorder() const;
|
||||
|
||||
#ifndef __WXWINCE__
|
||||
public:
|
||||
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||
|
@@ -44,7 +44,6 @@ public:
|
||||
|
||||
protected:
|
||||
// implement/override some base class virtuals
|
||||
virtual wxBorder GetDefaultBorder() const;
|
||||
virtual void DoSetSize(int x, int y, int w, int h,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
@@ -52,8 +52,8 @@ public:
|
||||
virtual bool CanApplyThemeBorder() const { return false; }
|
||||
|
||||
protected:
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
virtual wxBorder GetDefaultBorder() const;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton)
|
||||
|
@@ -448,6 +448,10 @@ protected:
|
||||
// choose the default border for this window
|
||||
virtual wxBorder GetDefaultBorder() const;
|
||||
|
||||
// Translate wxBORDER_THEME (and other border styles if necessary to the value
|
||||
// that makes most sense for this Windows environment
|
||||
virtual wxBorder TranslateBorder(wxBorder border) const;
|
||||
|
||||
#if wxUSE_MENUS_NATIVE
|
||||
virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
|
||||
#endif // wxUSE_MENUS_NATIVE
|
||||
|
@@ -105,6 +105,9 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
// choose the default border for this window
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||
|
||||
// adjust value according to wxSL_INVERSE style
|
||||
virtual int ValueInvertOrNot(int value) const
|
||||
{
|
||||
|
@@ -45,6 +45,9 @@ public:
|
||||
virtual bool HasTransparentBackground() { return true; }
|
||||
|
||||
protected:
|
||||
// choose the default border for this window
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxStaticBitmapBase)
|
||||
|
@@ -47,6 +47,9 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
// choose the default border for this window
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxStaticBoxBase)
|
||||
};
|
||||
|
||||
|
@@ -50,6 +50,9 @@ public:
|
||||
virtual bool AcceptsFocus() const { return false; }
|
||||
|
||||
protected:
|
||||
// choose the default border for this window
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||
|
||||
// set the right size for the right dimension
|
||||
wxSize AdjustSize(const wxSize& size) const
|
||||
{
|
||||
|
@@ -72,6 +72,9 @@ public:
|
||||
|
||||
protected: // functions required for wxST_ELLIPSIZE_* support
|
||||
|
||||
// choose the default border for this window
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||
|
||||
// just calls RemoveMarkup & Ellipsize on the original label.
|
||||
virtual wxString GetEllipsizedLabelWithoutMarkup() const;
|
||||
|
||||
|
@@ -57,6 +57,8 @@ public:
|
||||
bool GetValue() const { return m_value; }
|
||||
|
||||
protected:
|
||||
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
||||
|
||||
// the current value
|
||||
bool m_value;
|
||||
|
||||
|
@@ -1244,7 +1244,8 @@ public:
|
||||
// area (normal windows can't, but e.g. menubar or statusbar can):
|
||||
virtual bool CanBeOutsideClientArea() const { return false; }
|
||||
|
||||
// returns true if the platform should explicitly apply a theme border
|
||||
// returns true if the platform should explicitly apply a theme border. Currently
|
||||
// used only by Windows
|
||||
virtual bool CanApplyThemeBorder() const { return true; }
|
||||
|
||||
protected:
|
||||
@@ -1409,7 +1410,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 wxBORDER_SUNKEN; }
|
||||
virtual wxBorder GetDefaultBorderForControl() const { return wxBORDER_THEME; }
|
||||
|
||||
// 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.
|
||||
|
@@ -158,6 +158,12 @@ wxString wxControlBase::RemoveMnemonics(const wxString& str)
|
||||
return wxStripMenuCodes(str, wxStrip_Mnemonics);
|
||||
}
|
||||
|
||||
wxBorder wxControlBase::GetDefaultBorder() const
|
||||
{
|
||||
return wxBORDER_THEME;
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStaticBitmap
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -245,7 +245,9 @@ wxSize wxControl::DoGetBestSize() const
|
||||
|
||||
wxBorder wxControl::GetDefaultBorder() const
|
||||
{
|
||||
return GetDefaultBorderForControl();
|
||||
return wxControlBase::GetDefaultBorder();
|
||||
|
||||
// return GetDefaultBorderForControl();
|
||||
}
|
||||
|
||||
// This is a helper for all wxControls made with UPDOWN native control.
|
||||
|
@@ -171,11 +171,6 @@ bool wxStaticBitmap::Create(wxWindow *parent,
|
||||
return true;
|
||||
}
|
||||
|
||||
wxBorder wxStaticBitmap::GetDefaultBorder() const
|
||||
{
|
||||
return wxBORDER_NONE;
|
||||
}
|
||||
|
||||
WXDWORD wxStaticBitmap::MSWGetStyle(long style, WXDWORD *exstyle) const
|
||||
{
|
||||
WXDWORD msStyle = wxControl::MSWGetStyle(style, exstyle);
|
||||
|
@@ -138,11 +138,6 @@ bool wxStaticBox::Create(wxWindow *parent,
|
||||
return true;
|
||||
}
|
||||
|
||||
wxBorder wxStaticBox::GetDefaultBorder() const
|
||||
{
|
||||
return wxBORDER_NONE;
|
||||
}
|
||||
|
||||
WXDWORD wxStaticBox::MSWGetStyle(long style, WXDWORD *exstyle) const
|
||||
{
|
||||
long styleWin = wxStaticBoxBase::MSWGetStyle(style, exstyle);
|
||||
|
@@ -100,11 +100,6 @@ bool wxStaticText::Create(wxWindow *parent,
|
||||
return true;
|
||||
}
|
||||
|
||||
wxBorder wxStaticText::GetDefaultBorder() const
|
||||
{
|
||||
return wxBORDER_NONE;
|
||||
}
|
||||
|
||||
WXDWORD wxStaticText::MSWGetStyle(long style, WXDWORD *exstyle) const
|
||||
{
|
||||
WXDWORD msStyle = wxControl::MSWGetStyle(style, exstyle);
|
||||
|
@@ -83,11 +83,6 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id,
|
||||
return true;
|
||||
}
|
||||
|
||||
wxBorder wxToggleButton::GetDefaultBorder() const
|
||||
{
|
||||
return wxBORDER_NONE;
|
||||
}
|
||||
|
||||
WXDWORD wxToggleButton::MSWGetStyle(long style, WXDWORD *exstyle) const
|
||||
{
|
||||
WXDWORD msStyle = wxControl::MSWGetStyle(style, exstyle);
|
||||
|
@@ -1309,9 +1309,38 @@ wxBorder wxWindowMSW::GetDefaultBorderForControl() const
|
||||
|
||||
wxBorder wxWindowMSW::GetDefaultBorder() const
|
||||
{
|
||||
return GetDefaultBorderForControl();
|
||||
// return GetDefaultBorderForControl();
|
||||
return wxWindowBase::GetDefaultBorder();
|
||||
}
|
||||
|
||||
// Translate wxBORDER_THEME (and other border styles if necessary to the value
|
||||
// that makes most sense for this Windows environment
|
||||
wxBorder wxWindowMSW::TranslateBorder(wxBorder border) const
|
||||
{
|
||||
#if defined(__POCKETPC__) || defined(__SMARTPHONE__)
|
||||
if (border == wxBORDER_THEME || border == wxBORDER_SUNKEN || border == wxBORDER_SIMPLE)
|
||||
return wxBORDER_SIMPLE;
|
||||
else
|
||||
return wxBORDER_NONE;
|
||||
#else
|
||||
#if wxUSE_UXTHEME
|
||||
if (border == wxBORDER_THEME)
|
||||
{
|
||||
if (CanApplyThemeBorder())
|
||||
{
|
||||
wxUxThemeEngine* theme = wxUxThemeEngine::GetIfActive();
|
||||
if (theme)
|
||||
return wxBORDER_THEME;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return border;
|
||||
#endif
|
||||
|
||||
return border;
|
||||
}
|
||||
|
||||
|
||||
WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const
|
||||
{
|
||||
// translate common wxWidgets styles to Windows ones
|
||||
@@ -1341,7 +1370,10 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const
|
||||
if ( flags & wxHSCROLL )
|
||||
style |= WS_HSCROLL;
|
||||
|
||||
const wxBorder border = GetBorder(flags);
|
||||
const wxBorder border = TranslateBorder(GetBorder(flags));
|
||||
|
||||
// After translation, border is now optimized for the specific version of Windows
|
||||
// and theme engine presence.
|
||||
|
||||
// WS_BORDER is only required for wxBORDER_SIMPLE
|
||||
if ( border == wxBORDER_SIMPLE )
|
||||
@@ -3260,7 +3292,8 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l
|
||||
case WM_NCCALCSIZE:
|
||||
{
|
||||
wxUxThemeEngine* theme = wxUxThemeEngine::GetIfActive();
|
||||
if (theme && GetBorder() == wxBORDER_THEME)
|
||||
const wxBorder border = TranslateBorder(GetBorder());
|
||||
if (theme && border == wxBORDER_THEME)
|
||||
{
|
||||
// first ask the widget to calculate the border size
|
||||
rc.result = MSWDefWindowProc(message, wParam, lParam);
|
||||
@@ -3300,7 +3333,8 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l
|
||||
case WM_NCPAINT:
|
||||
{
|
||||
wxUxThemeEngine* theme = wxUxThemeEngine::GetIfActive();
|
||||
if (theme && GetBorder() == wxBORDER_THEME)
|
||||
const wxBorder border = TranslateBorder(GetBorder());
|
||||
if (theme && border == wxBORDER_THEME)
|
||||
{
|
||||
// first ask the widget to paint its non-client area, such as scrollbars, etc.
|
||||
rc.result = MSWDefWindowProc(message, wParam, lParam);
|
||||
|
Reference in New Issue
Block a user