Revamped border handling.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20511 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
957f03699b
commit
fe3d9123c6
@ -78,7 +78,7 @@ protected:
|
|||||||
|
|
||||||
// usually overridden base class virtuals
|
// usually overridden base class virtuals
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
|
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxButton)
|
DECLARE_DYNAMIC_CLASS(wxButton)
|
||||||
|
@ -212,13 +212,6 @@ public:
|
|||||||
wxWindow *FindItem(long id) const;
|
wxWindow *FindItem(long id) const;
|
||||||
wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) 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
|
// MSW only: TRUE if this control is part of the main control
|
||||||
virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; };
|
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,
|
// this is the function that should be overridden in the derived classes,
|
||||||
// but you will mostly use MSWGetCreateWindowFlags() below
|
// 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
|
// get the MSW window flags corresponding to wxWindows ones
|
||||||
//
|
//
|
||||||
|
@ -393,25 +393,11 @@ bool wxChoice::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
|
|||||||
}
|
}
|
||||||
|
|
||||||
WXHBRUSH wxChoice::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor),
|
WXHBRUSH wxChoice::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor),
|
||||||
#if wxUSE_CTL3D
|
|
||||||
WXUINT message,
|
|
||||||
WXWPARAM wParam,
|
|
||||||
WXLPARAM lParam
|
|
||||||
#else
|
|
||||||
WXUINT WXUNUSED(message),
|
WXUINT WXUNUSED(message),
|
||||||
WXWPARAM WXUNUSED(wParam),
|
WXWPARAM WXUNUSED(wParam),
|
||||||
WXLPARAM WXUNUSED(lParam)
|
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;
|
HDC hdc = (HDC)pDC;
|
||||||
if (GetParent()->GetTransparentBackground())
|
if (GetParent()->GetTransparentBackground())
|
||||||
SetBkMode(hdc, TRANSPARENT);
|
SetBkMode(hdc, TRANSPARENT);
|
||||||
|
@ -156,25 +156,11 @@ LRESULT APIENTRY _EXPORT wxComboEditWndProc(HWND hWnd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
WXHBRUSH wxComboBox::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor),
|
WXHBRUSH wxComboBox::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor),
|
||||||
#if wxUSE_CTL3D
|
|
||||||
WXUINT message,
|
|
||||||
WXWPARAM wParam,
|
|
||||||
WXLPARAM lParam
|
|
||||||
#else
|
|
||||||
WXUINT WXUNUSED(message),
|
WXUINT WXUNUSED(message),
|
||||||
WXWPARAM WXUNUSED(wParam),
|
WXWPARAM WXUNUSED(wParam),
|
||||||
WXLPARAM WXUNUSED(lParam)
|
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;
|
HDC hdc = (HDC)pDC;
|
||||||
if (GetParent()->GetTransparentBackground())
|
if (GetParent()->GetTransparentBackground())
|
||||||
SetBkMode(hdc, TRANSPARENT);
|
SetBkMode(hdc, TRANSPARENT);
|
||||||
|
@ -93,16 +93,12 @@ bool wxControl::MSWCreateControl(const wxChar *classname,
|
|||||||
const wxString& label,
|
const wxString& label,
|
||||||
WXDWORD exstyle)
|
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 no extended style given, determine it ourselves
|
||||||
if ( exstyle == (WXDWORD)-1 )
|
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
|
// all controls should have this style
|
||||||
|
@ -101,11 +101,13 @@ bool wxGauge95::Create(wxWindow *parent, wxWindowID id,
|
|||||||
int width = size.x;
|
int width = size.x;
|
||||||
int height = size.y;
|
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 )
|
if ( m_windowStyle & wxCLIP_SIBLINGS )
|
||||||
msFlags |= WS_CLIPSIBLINGS;
|
msFlags |= WS_CLIPSIBLINGS;
|
||||||
|
*/
|
||||||
|
|
||||||
if (m_windowStyle & wxGA_VERTICAL)
|
if (m_windowStyle & wxGA_VERTICAL)
|
||||||
msFlags |= PBS_VERTICAL;
|
msFlags |= PBS_VERTICAL;
|
||||||
@ -114,7 +116,7 @@ bool wxGauge95::Create(wxWindow *parent, wxWindowID id,
|
|||||||
msFlags |= PBS_SMOOTH;
|
msFlags |= PBS_SMOOTH;
|
||||||
|
|
||||||
HWND wx_button =
|
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,
|
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
|
||||||
wxGetInstance(), NULL);
|
wxGetInstance(), NULL);
|
||||||
|
|
||||||
|
@ -293,10 +293,6 @@ bool wxGLCanvas::Create(wxWindow *parent,
|
|||||||
parent->AddChild(this);
|
parent->AddChild(this);
|
||||||
|
|
||||||
DWORD msflags = 0;
|
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
|
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.
|
books that contain the wgl function descriptions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
WXDWORD exStyle = 0;
|
||||||
msflags |= WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
|
msflags |= WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
|
||||||
|
msflags |= MSWGetStyle(style, & exStyle) ;
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
return MSWCreate(wxGLCanvasClassName, NULL, pos, size, msflags, exStyle);
|
return MSWCreate(wxGLCanvasClassName, NULL, pos, size, msflags, exStyle);
|
||||||
}
|
}
|
||||||
|
@ -123,8 +123,8 @@ bool wxListBox::Create(wxWindow *parent,
|
|||||||
int height = size.y;
|
int height = size.y;
|
||||||
m_windowStyle = style;
|
m_windowStyle = style;
|
||||||
|
|
||||||
DWORD wstyle = WS_VISIBLE | WS_VSCROLL | WS_TABSTOP |
|
DWORD wstyle = WS_VISIBLE | WS_CHILD | WS_VSCROLL | WS_TABSTOP |
|
||||||
LBS_NOTIFY | LBS_HASSTRINGS /* | WS_CLIPSIBLINGS */;
|
LBS_NOTIFY | LBS_HASSTRINGS ;
|
||||||
|
|
||||||
wxASSERT_MSG( !(style & wxLB_MULTIPLE) || !(style & wxLB_EXTENDED),
|
wxASSERT_MSG( !(style & wxLB_MULTIPLE) || !(style & wxLB_EXTENDED),
|
||||||
_T("only one of listbox selection modes can be specified") );
|
_T("only one of listbox selection modes can be specified") );
|
||||||
@ -158,32 +158,17 @@ bool wxListBox::Create(wxWindow *parent,
|
|||||||
// doesn't work properly
|
// doesn't work properly
|
||||||
wstyle |= LBS_NOINTEGRALHEIGHT;
|
wstyle |= LBS_NOINTEGRALHEIGHT;
|
||||||
|
|
||||||
bool want3D;
|
WXDWORD exStyle = 0;
|
||||||
WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D);
|
(void) MSWGetStyle(style, & exStyle) ;
|
||||||
|
|
||||||
// Even with extended styles, need to combine with WS_BORDER for them to
|
|
||||||
// look right.
|
|
||||||
if ( want3D || wxStyleHasBorder(m_windowStyle) )
|
|
||||||
{
|
|
||||||
wstyle |= WS_BORDER;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_hWnd = (WXHWND)::CreateWindowEx(exStyle, wxT("LISTBOX"), NULL,
|
m_hWnd = (WXHWND)::CreateWindowEx(exStyle, wxT("LISTBOX"), NULL,
|
||||||
wstyle | WS_CHILD,
|
wstyle ,
|
||||||
0, 0, 0, 0,
|
0, 0, 0, 0,
|
||||||
(HWND)parent->GetHWND(), (HMENU)m_windowId,
|
(HWND)parent->GetHWND(), (HMENU)m_windowId,
|
||||||
wxGetInstance(), NULL);
|
wxGetInstance(), NULL);
|
||||||
|
|
||||||
wxCHECK_MSG( m_hWnd, FALSE, wxT("Failed to create listbox") );
|
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
|
// Subclass again to catch messages
|
||||||
SubclassWin(m_hWnd);
|
SubclassWin(m_hWnd);
|
||||||
|
|
||||||
|
@ -291,8 +291,11 @@ bool wxListCtrl::Create(wxWindow *parent,
|
|||||||
if ( m_windowStyle & wxCLIP_SIBLINGS )
|
if ( m_windowStyle & wxCLIP_SIBLINGS )
|
||||||
wstyle |= WS_CLIPSIBLINGS;
|
wstyle |= WS_CLIPSIBLINGS;
|
||||||
|
|
||||||
|
/*
|
||||||
if ( wxStyleHasBorder(m_windowStyle) )
|
if ( wxStyleHasBorder(m_windowStyle) )
|
||||||
wstyle |= WS_BORDER;
|
wstyle |= WS_BORDER;
|
||||||
|
*/
|
||||||
|
|
||||||
m_baseStyle = wstyle;
|
m_baseStyle = wstyle;
|
||||||
|
|
||||||
if ( !DoCreateControl(x, y, width, height) )
|
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;
|
DWORD wstyle = m_baseStyle;
|
||||||
|
|
||||||
bool want3D;
|
WXDWORD exStyle = 0;
|
||||||
WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D);
|
(void) MSWGetStyle(GetWindowStyle(), & exStyle) ;
|
||||||
|
|
||||||
// Even with extended styles, need to combine with WS_BORDER
|
|
||||||
// for them to look right.
|
|
||||||
if ( want3D )
|
|
||||||
wstyle |= WS_BORDER;
|
|
||||||
|
|
||||||
long oldStyle = 0; // Dummy
|
long oldStyle = 0; // Dummy
|
||||||
wstyle |= ConvertToMSWStyle(oldStyle, m_windowStyle);
|
wstyle |= ConvertToMSWStyle(oldStyle, m_windowStyle);
|
||||||
|
@ -82,15 +82,18 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
|
|||||||
height = 14;
|
height = 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD wstyle = WS_VISIBLE | WS_CHILD;
|
WXDWORD exStyle = 0;
|
||||||
|
WXDWORD wstyle = MSWGetStyle(style, & exStyle) ;
|
||||||
|
|
||||||
|
/*
|
||||||
if ( m_windowStyle & wxCLIP_SIBLINGS )
|
if ( m_windowStyle & wxCLIP_SIBLINGS )
|
||||||
wstyle |= WS_CLIPSIBLINGS;
|
wstyle |= WS_CLIPSIBLINGS;
|
||||||
|
*/
|
||||||
|
|
||||||
// Now create scrollbar
|
// Now create scrollbar
|
||||||
DWORD _direction = (style & wxHORIZONTAL) ?
|
DWORD _direction = (style & wxHORIZONTAL) ?
|
||||||
SBS_HORZ: SBS_VERT;
|
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,
|
_direction | wstyle,
|
||||||
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
|
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
|
||||||
wxGetInstance(), NULL);
|
wxGetInstance(), NULL);
|
||||||
|
@ -59,6 +59,9 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id,
|
|||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
|
if ( (style & wxBORDER_MASK) == wxBORDER_DEFAULT )
|
||||||
|
style |= wxBORDER_NONE;
|
||||||
|
|
||||||
SetName(name);
|
SetName(name);
|
||||||
#if wxUSE_VALIDATORS
|
#if wxUSE_VALIDATORS
|
||||||
SetValidator(validator);
|
SetValidator(validator);
|
||||||
@ -90,15 +93,12 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id,
|
|||||||
long msStyle = 0;
|
long msStyle = 0;
|
||||||
long wstyle = 0;
|
long wstyle = 0;
|
||||||
|
|
||||||
if ( m_windowStyle & wxCLIP_SIBLINGS )
|
|
||||||
msStyle |= WS_CLIPSIBLINGS;
|
|
||||||
|
|
||||||
if ( m_windowStyle & wxSL_LABELS )
|
if ( m_windowStyle & wxSL_LABELS )
|
||||||
{
|
{
|
||||||
msStyle |= WS_CHILD | WS_VISIBLE | WS_BORDER | SS_CENTER;
|
msStyle |= SS_CENTER;
|
||||||
|
|
||||||
bool want3D;
|
WXDWORD exStyle = 0;
|
||||||
WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ;
|
msStyle |= MSWGetStyle(GetWindowStyle(), & exStyle) ;
|
||||||
|
|
||||||
m_staticValue = (WXHWND) CreateWindowEx
|
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 = MSWGetStyle(GetWindowStyle(), & exStyle) ;
|
||||||
msStyle |= WS_CLIPSIBLINGS;
|
|
||||||
|
|
||||||
if (m_windowStyle & wxSL_VERTICAL)
|
if (m_windowStyle & wxSL_VERTICAL)
|
||||||
msStyle = TBS_VERT | WS_CHILD | WS_VISIBLE | WS_TABSTOP ;
|
msStyle = TBS_VERT | WS_CHILD | WS_VISIBLE | WS_TABSTOP ;
|
||||||
@ -154,7 +153,7 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
HWND scroll_bar = CreateWindowEx
|
HWND scroll_bar = CreateWindowEx
|
||||||
(
|
(
|
||||||
MakeExtendedStyle(m_windowStyle), TRACKBAR_CLASS, wxT(""),
|
exStyle, TRACKBAR_CLASS, wxT(""),
|
||||||
msStyle,
|
msStyle,
|
||||||
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
|
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
|
||||||
wxGetInstance(), NULL
|
wxGetInstance(), NULL
|
||||||
|
@ -78,13 +78,11 @@ bool wxSliderMSW::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
// non-Win95 implementation
|
// non-Win95 implementation
|
||||||
|
|
||||||
long msStyle = WS_CHILD | WS_VISIBLE | WS_BORDER | SS_CENTER;
|
long msStyle = SS_CENTER;
|
||||||
|
|
||||||
if ( m_windowStyle & wxCLIP_SIBLINGS )
|
// WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ;
|
||||||
msStyle |= WS_CLIPSIBLINGS;
|
WXDWORD exStyle = 0;
|
||||||
|
msStyle |= MSWGetStyle(GetWindowStyle(), & exStyle) ;
|
||||||
bool want3D;
|
|
||||||
WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ;
|
|
||||||
|
|
||||||
m_staticValue = (WXHWND) CreateWindowEx(exStyle, wxT("STATIC"), NULL,
|
m_staticValue = (WXHWND) CreateWindowEx(exStyle, wxT("STATIC"), NULL,
|
||||||
msStyle,
|
msStyle,
|
||||||
@ -108,7 +106,7 @@ bool wxSliderMSW::Create(wxWindow *parent, wxWindowID id,
|
|||||||
else
|
else
|
||||||
msStyle = SBS_HORZ | WS_CHILD | WS_VISIBLE | WS_TABSTOP ;
|
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,
|
msStyle,
|
||||||
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
|
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
|
||||||
wxGetInstance(), NULL);
|
wxGetInstance(), NULL);
|
||||||
|
@ -238,6 +238,9 @@ bool wxSpinCtrl::Create(wxWindow *parent,
|
|||||||
|
|
||||||
SetWindowStyle(style);
|
SetWindowStyle(style);
|
||||||
|
|
||||||
|
WXDWORD exStyle = 0;
|
||||||
|
WXDWORD msStyle = MSWGetStyle(GetWindowStyle(), & exStyle) ;
|
||||||
|
|
||||||
// calculate the sizes: the size given is the toal size for both controls
|
// 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)
|
// and we need to fit them both in the given width (height is the same)
|
||||||
wxSize sizeText(size), sizeBtn(size);
|
wxSize sizeText(size), sizeBtn(size);
|
||||||
@ -265,18 +268,6 @@ bool wxSpinCtrl::Create(wxWindow *parent,
|
|||||||
|
|
||||||
// create the text window
|
// 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
|
m_hwndBuddy = (WXHWND)::CreateWindowEx
|
||||||
(
|
(
|
||||||
exStyle, // sunken border
|
exStyle, // sunken border
|
||||||
|
@ -42,6 +42,10 @@ bool wxStaticText::Create(wxWindow *parent,
|
|||||||
long style,
|
long style,
|
||||||
const wxString& name)
|
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) )
|
if ( !CreateControl(parent, id, pos, size, style, wxDefaultValidator, name) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -85,10 +85,15 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id,
|
|||||||
#define BS_PUSHLIKE 0x00001000L
|
#define BS_PUSHLIKE 0x00001000L
|
||||||
#endif
|
#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 )
|
if ( m_windowStyle & wxCLIP_SIBLINGS )
|
||||||
msStyle |= WS_CLIPSIBLINGS;
|
msStyle |= WS_CLIPSIBLINGS;
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
if(m_windowStyle & wxBU_LEFT)
|
if(m_windowStyle & wxBU_LEFT)
|
||||||
@ -101,7 +106,7 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id,
|
|||||||
msStyle |= BS_BOTTOM;
|
msStyle |= BS_BOTTOM;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_hWnd = (WXHWND)CreateWindowEx(MakeExtendedStyle(m_windowStyle),
|
m_hWnd = (WXHWND)CreateWindowEx(exStyle,
|
||||||
wxT("BUTTON"), label,
|
wxT("BUTTON"), label,
|
||||||
msStyle, 0, 0, 0, 0,
|
msStyle, 0, 0, 0, 0,
|
||||||
(HWND)parent->GetHWND(),
|
(HWND)parent->GetHWND(),
|
||||||
|
@ -1165,9 +1165,22 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const
|
|||||||
style |= WS_CLIPSIBLINGS;
|
style |= WS_CLIPSIBLINGS;
|
||||||
|
|
||||||
wxBorder border = (wxBorder)(flags & wxBORDER_MASK);
|
wxBorder border = (wxBorder)(flags & wxBORDER_MASK);
|
||||||
if ( border != wxBORDER_NONE && border != wxBORDER_DEFAULT )
|
|
||||||
style |= WS_BORDER;
|
// 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
|
// now deal with ext style if the caller wants it
|
||||||
if ( exstyle )
|
if ( exstyle )
|
||||||
{
|
{
|
||||||
@ -1176,7 +1189,7 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const
|
|||||||
if ( flags & wxTRANSPARENT_WINDOW )
|
if ( flags & wxTRANSPARENT_WINDOW )
|
||||||
*exstyle |= WS_EX_TRANSPARENT;
|
*exstyle |= WS_EX_TRANSPARENT;
|
||||||
|
|
||||||
switch ( flags & wxBORDER_MASK )
|
switch ( border )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
wxFAIL_MSG( _T("unknown border style") );
|
wxFAIL_MSG( _T("unknown border style") );
|
||||||
@ -1197,6 +1210,7 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const
|
|||||||
|
|
||||||
case wxBORDER_SUNKEN:
|
case wxBORDER_SUNKEN:
|
||||||
*exstyle |= WS_EX_CLIENTEDGE;
|
*exstyle |= WS_EX_CLIENTEDGE;
|
||||||
|
style &= ~WS_BORDER;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxBORDER_DOUBLE:
|
case wxBORDER_DOUBLE:
|
||||||
@ -1218,94 +1232,6 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const
|
|||||||
return style;
|
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 WXWIN_COMPATIBILITY
|
||||||
// If nothing defined for this, try the parent.
|
// If nothing defined for this, try the parent.
|
||||||
// E.g. we may be a button loaded from a resource, with no callback function
|
// E.g. we may be a button loaded from a resource, with no callback function
|
||||||
|
Loading…
Reference in New Issue
Block a user