// General item class
class WXDLLEXPORT wxControl : public wxControlBase
{
- DECLARE_ABSTRACT_CLASS(wxControl)
-
public:
wxControl();
wxControl(wxWindow *parent, wxWindowID id,
#endif // WXWIN_COMPATIBILITY
protected:
- // for controls like radiobuttons which are really composite this array
- // holds the ids (not HWNDs!) of the sub controls
- wxArrayLong m_subControls;
+ // choose the default border for this window
+ virtual wxBorder GetDefaultBorder() const;
virtual wxSize DoGetBestSize() const;
// default style for the control include WS_TABSTOP if it AcceptsFocus()
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
+ // for controls like radiobuttons which are really composite this array
+ // holds the ids (not HWNDs!) of the sub controls
+ wxArrayLong m_subControls;
+
private:
+ DECLARE_ABSTRACT_CLASS(wxControl)
DECLARE_EVENT_TABLE()
};
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
protected:
+ virtual wxBorder GetDefaultBorder() const;
virtual wxSize DoGetBestSize() const;
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
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;
// if no extended style given, determine it ourselves
if ( exstyle == (WXDWORD)-1 )
{
-// exstyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D);
exstyle = 0;
- (void) MSWGetStyle(GetWindowStyle(), & exstyle) ;
+ (void) MSWGetStyle(GetWindowStyle(), &exstyle);
}
// all controls should have this style
return TRUE;
}
+wxBorder wxControl::GetDefaultBorder() const
+{
+ // we want to automatically give controls a sunken style (confusingly,
+ // it may not really mean sunken at all as we map it to WS_EX_CLIENTEDGE
+ // which is not sunken at all under Windows XP -- rather, just the default)
+ return wxBORDER_SUNKEN;
+}
+
wxSize wxControl::DoGetBestSize() const
{
return wxSize(DEFAULT_ITEM_WIDTH, DEFAULT_ITEM_HEIGHT);
long style,
const wxString& name)
{
- // default border for this control is none
- if ( (style & wxBORDER_MASK) == wxBORDER_DEFAULT )
- {
- style |= wxBORDER_NONE;
- }
-
if ( !CreateControl(parent, id, pos, size, style, wxDefaultValidator, name) )
return FALSE;
return TRUE;
}
+wxBorder wxStaticBitmap::GetDefaultBorder() const
+{
+ return wxBORDER_NONE;
+}
+
WXDWORD wxStaticBitmap::MSWGetStyle(long style, WXDWORD *exstyle) const
{
WXDWORD msStyle = wxControl::MSWGetStyle(style, exstyle);
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;
return TRUE;
}
+wxBorder wxStaticText::GetDefaultBorder() const
+{
+ return wxBORDER_NONE;
+}
+
WXDWORD wxStaticText::MSWGetStyle(long style, WXDWORD *exstyle) const
{
WXDWORD msStyle = wxControl::MSWGetStyle(style, exstyle);
WXDWORD wxTextCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const
{
- // default border for the text controls is the sunken one
- if ( (style & wxBORDER_MASK) == wxBORDER_DEFAULT )
- {
- style |= wxBORDER_SUNKEN;
- }
-
long msStyle = wxControl::MSWGetStyle(style, exstyle);
// styles which we alaways add by default
void wxTextCtrl::SetWindowStyleFlag(long style)
{
- if ( (style & wxBORDER_MASK) == wxBORDER_DEFAULT )
- style |= wxBORDER_SUNKEN;
-
#if wxUSE_RICHEDIT
// we have to deal with some styles separately because they can't be
// changed by simply calling SetWindowLong(GWL_STYLE) but can be changed
if ( flags & wxHSCROLL )
style |= WS_HSCROLL;
- wxBorder border = (wxBorder)(flags & wxBORDER_MASK);
+ const wxBorder border = GetBorder(flags);
- // 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 &&
- IsKindOf(CLASSINFO(wxControl)) &&
- 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)
+ // WS_BORDER is only required for wxBORDER_SIMPLE
+ if ( border == wxBORDER_SIMPLE )
style |= WS_BORDER;
// now deal with ext style if the caller wants it
switch ( border )
{
default:
+ case wxBORDER_DEFAULT:
wxFAIL_MSG( _T("unknown border style") );
// fall through
case wxBORDER_NONE:
case wxBORDER_SIMPLE:
- case wxBORDER_DEFAULT:
break;
case wxBORDER_STATIC: