Added wxBORDER_THEME, wxWindow::GetDefaultBorderForControl(), wxWindow::CanApplyThemeBorder().
wxTextCtrl and wxSearchCtrl now get the correct border on wxMSW, and the wxRichTextCtrl sample also now demonstrates correct borders. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47927 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -233,6 +233,9 @@ public:
|
|||||||
// we don't want focus for ourselves
|
// we don't want focus for ourselves
|
||||||
virtual bool AcceptsFocus() const { return false; }
|
virtual bool AcceptsFocus() const { return false; }
|
||||||
|
|
||||||
|
// returns true if the platform should explicitly apply a theme border
|
||||||
|
virtual bool CanApplyThemeBorder() const { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// flags for DoSetSelection()
|
// flags for DoSetSelection()
|
||||||
enum
|
enum
|
||||||
|
@@ -1406,7 +1406,8 @@ enum wxBorder
|
|||||||
wxBORDER_SIMPLE = 0x02000000,
|
wxBORDER_SIMPLE = 0x02000000,
|
||||||
wxBORDER_RAISED = 0x04000000,
|
wxBORDER_RAISED = 0x04000000,
|
||||||
wxBORDER_SUNKEN = 0x08000000,
|
wxBORDER_SUNKEN = 0x08000000,
|
||||||
wxBORDER_DOUBLE = 0x10000000,
|
wxBORDER_DOUBLE = 0x10000000, /* deprecated */
|
||||||
|
wxBORDER_THEME = 0x10000000,
|
||||||
|
|
||||||
/* a mask to extract border style from the combination of flags */
|
/* a mask to extract border style from the combination of flags */
|
||||||
wxBORDER_MASK = 0x1f200000
|
wxBORDER_MASK = 0x1f200000
|
||||||
|
@@ -58,6 +58,9 @@ public:
|
|||||||
virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
|
virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
|
||||||
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
|
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
|
||||||
|
|
||||||
|
// returns true if the platform should explicitly apply a theme border
|
||||||
|
virtual bool CanApplyThemeBorder() const { return false; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void MakeOwnerDrawn();
|
void MakeOwnerDrawn();
|
||||||
|
|
||||||
|
@@ -47,6 +47,9 @@ public:
|
|||||||
virtual bool SetForegroundColour(const wxColour& colour);
|
virtual bool SetForegroundColour(const wxColour& colour);
|
||||||
virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
|
virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
|
||||||
|
|
||||||
|
// returns true if the platform should explicitly apply a theme border
|
||||||
|
virtual bool CanApplyThemeBorder() const { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
|
@@ -85,6 +85,9 @@ public:
|
|||||||
virtual bool MSWShouldPreProcessMessage(WXMSG *pMsg);
|
virtual bool MSWShouldPreProcessMessage(WXMSG *pMsg);
|
||||||
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
|
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
|
||||||
|
|
||||||
|
// returns true if the platform should explicitly apply a theme border
|
||||||
|
virtual bool CanApplyThemeBorder() const { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init() { m_lastAcceptedSelection = wxID_NONE; }
|
void Init() { m_lastAcceptedSelection = wxID_NONE; }
|
||||||
|
@@ -57,6 +57,9 @@ public:
|
|||||||
|
|
||||||
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
|
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
|
||||||
|
|
||||||
|
// returns true if the platform should explicitly apply a theme border
|
||||||
|
virtual bool CanApplyThemeBorder() const { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
|
@@ -58,6 +58,9 @@ public:
|
|||||||
|
|
||||||
WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
|
WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
|
||||||
|
|
||||||
|
// returns true if the platform should explicitly apply a theme border
|
||||||
|
virtual bool CanApplyThemeBorder() const { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
|
@@ -133,6 +133,9 @@ public:
|
|||||||
return GetCompositeControlsDefaultAttributes(variant);
|
return GetCompositeControlsDefaultAttributes(variant);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// returns true if the platform should explicitly apply a theme border
|
||||||
|
virtual bool CanApplyThemeBorder() const { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DoSetSelection(int n, bool select);
|
virtual void DoSetSelection(int n, bool select);
|
||||||
|
|
||||||
|
@@ -115,6 +115,9 @@ public:
|
|||||||
// it to behave normally
|
// it to behave normally
|
||||||
virtual bool AcceptsFocus() const { return wxControl::AcceptsFocus(); }
|
virtual bool AcceptsFocus() const { return wxControl::AcceptsFocus(); }
|
||||||
|
|
||||||
|
// returns true if the platform should explicitly apply a theme border
|
||||||
|
virtual bool CanApplyThemeBorder() const { return false; }
|
||||||
|
|
||||||
void SetLabelFont(const wxFont& WXUNUSED(font)) {}
|
void SetLabelFont(const wxFont& WXUNUSED(font)) {}
|
||||||
void SetButtonFont(const wxFont& font) { SetFont(font); }
|
void SetButtonFont(const wxFont& font) { SetFont(font); }
|
||||||
|
|
||||||
|
@@ -58,6 +58,9 @@ public:
|
|||||||
|
|
||||||
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
|
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
|
||||||
|
|
||||||
|
// returns true if the platform should explicitly apply a theme border
|
||||||
|
virtual bool CanApplyThemeBorder() const { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
|
@@ -83,6 +83,8 @@ public:
|
|||||||
// we should let background show through the slider (and its labels)
|
// we should let background show through the slider (and its labels)
|
||||||
virtual bool HasTransparentBackground() { return true; }
|
virtual bool HasTransparentBackground() { return true; }
|
||||||
|
|
||||||
|
// returns true if the platform should explicitly apply a theme border
|
||||||
|
virtual bool CanApplyThemeBorder() const { return false; }
|
||||||
|
|
||||||
void Command(wxCommandEvent& event);
|
void Command(wxCommandEvent& event);
|
||||||
virtual bool MSWOnScroll(int orientation, WXWORD wParam,
|
virtual bool MSWOnScroll(int orientation, WXWORD wParam,
|
||||||
|
@@ -57,6 +57,9 @@ public:
|
|||||||
// a wxSpinButton can't do anything useful with focus, only wxSpinCtrl can
|
// a wxSpinButton can't do anything useful with focus, only wxSpinCtrl can
|
||||||
virtual bool AcceptsFocus() const { return false; }
|
virtual bool AcceptsFocus() const { return false; }
|
||||||
|
|
||||||
|
// returns true if the platform should explicitly apply a theme border
|
||||||
|
virtual bool CanApplyThemeBorder() const { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
|
@@ -54,6 +54,9 @@ public:
|
|||||||
|
|
||||||
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
|
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
|
||||||
|
|
||||||
|
// returns true if the platform should explicitly apply a theme border
|
||||||
|
virtual bool CanApplyThemeBorder() const { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxBorder GetDefaultBorder() const;
|
virtual wxBorder GetDefaultBorder() const;
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
@@ -40,6 +40,9 @@ public:
|
|||||||
|
|
||||||
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
|
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
|
||||||
|
|
||||||
|
// returns true if the platform should explicitly apply a theme border
|
||||||
|
virtual bool CanApplyThemeBorder() const { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
|
@@ -170,6 +170,9 @@ public:
|
|||||||
|
|
||||||
virtual bool AcceptsFocus() const;
|
virtual bool AcceptsFocus() const;
|
||||||
|
|
||||||
|
// returns true if the platform should explicitly apply a theme border
|
||||||
|
virtual bool CanApplyThemeBorder() const;
|
||||||
|
|
||||||
// callbacks
|
// callbacks
|
||||||
void OnDropFiles(wxDropFilesEvent& event);
|
void OnDropFiles(wxDropFilesEvent& event);
|
||||||
void OnChar(wxKeyEvent& event); // Process 'enter' if required
|
void OnChar(wxKeyEvent& event); // Process 'enter' if required
|
||||||
|
@@ -48,6 +48,9 @@ public:
|
|||||||
virtual void Command(wxCommandEvent& event);
|
virtual void Command(wxCommandEvent& event);
|
||||||
virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
|
virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
|
||||||
|
|
||||||
|
// returns true if the platform should explicitly apply a theme border
|
||||||
|
virtual bool CanApplyThemeBorder() const { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
virtual wxBorder GetDefaultBorder() const;
|
virtual wxBorder GetDefaultBorder() const;
|
||||||
|
@@ -107,6 +107,9 @@ public:
|
|||||||
// window proc for the frames
|
// window proc for the frames
|
||||||
WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||||
|
|
||||||
|
// returns true if the platform should explicitly apply a theme border
|
||||||
|
virtual bool CanApplyThemeBorder() const { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
|
@@ -210,6 +210,9 @@ public:
|
|||||||
void SetState(const wxTreeItemId& node, int state);
|
void SetState(const wxTreeItemId& node, int state);
|
||||||
int GetState(const wxTreeItemId& node);
|
int GetState(const wxTreeItemId& node);
|
||||||
|
|
||||||
|
// returns true if the platform should explicitly apply a theme border
|
||||||
|
virtual bool CanApplyThemeBorder() const { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// SetImageList helper
|
// SetImageList helper
|
||||||
void SetAnyImageList(wxImageList *imageList, int which);
|
void SetAnyImageList(wxImageList *imageList, int which);
|
||||||
|
@@ -433,6 +433,11 @@ public:
|
|||||||
// check if a native double-buffering applies for this window
|
// check if a native double-buffering applies for this window
|
||||||
virtual bool IsDoubleBuffered() const;
|
virtual bool IsDoubleBuffered() const;
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
// synthesize a wxEVT_LEAVE_WINDOW event and set m_mouseInWindow to false
|
// synthesize a wxEVT_LEAVE_WINDOW event and set m_mouseInWindow to false
|
||||||
void GenerateMouseLeave();
|
void GenerateMouseLeave();
|
||||||
|
|
||||||
|
@@ -580,12 +580,7 @@ public:
|
|||||||
m_value = -1;
|
m_value = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool Create( wxWindow* parent )
|
virtual bool Create( wxWindow* parent );
|
||||||
{
|
|
||||||
return wxRichTextStyleListBox::Create(parent, wxID_ANY,
|
|
||||||
wxPoint(0,0), wxDefaultSize,
|
|
||||||
wxSIMPLE_BORDER);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual wxWindow *GetControl() { return this; }
|
virtual wxWindow *GetControl() { return this; }
|
||||||
|
|
||||||
|
@@ -201,6 +201,8 @@ public:
|
|||||||
static wxVisualAttributes
|
static wxVisualAttributes
|
||||||
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
||||||
|
|
||||||
|
virtual wxBorder GetDefaultBorder() const { return GetDefaultBorderForControl(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// the derived class must implement this function to actually draw the item
|
// the derived class must implement this function to actually draw the item
|
||||||
// with the given index on the provided DC
|
// with the given index on the provided DC
|
||||||
|
@@ -1221,6 +1221,9 @@ public:
|
|||||||
// area (normal windows can't, but e.g. menubar or statusbar can):
|
// area (normal windows can't, but e.g. menubar or statusbar can):
|
||||||
virtual bool CanBeOutsideClientArea() const { return false; }
|
virtual bool CanBeOutsideClientArea() const { return false; }
|
||||||
|
|
||||||
|
// returns true if the platform should explicitly apply a theme border
|
||||||
|
virtual bool CanApplyThemeBorder() const { return true; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// event handling specific to wxWindow
|
// event handling specific to wxWindow
|
||||||
virtual bool TryValidator(wxEvent& event);
|
virtual bool TryValidator(wxEvent& event);
|
||||||
@@ -1381,6 +1384,11 @@ protected:
|
|||||||
// specified) border for the window class
|
// specified) border for the window class
|
||||||
virtual wxBorder GetDefaultBorder() const;
|
virtual wxBorder GetDefaultBorder() const;
|
||||||
|
|
||||||
|
// 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(); }
|
||||||
|
|
||||||
// Get the default size for the new window if no explicit size given. TLWs
|
// 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.
|
// have their own default size so this is just for non top-level windows.
|
||||||
static int WidthDefault(int w) { return w == wxDefaultCoord ? 20 : w; }
|
static int WidthDefault(int w) { return w == wxDefaultCoord ? 20 : w; }
|
||||||
|
@@ -682,13 +682,13 @@ MyFrame::MyFrame(const wxString& title, wxWindowID id, const wxPoint& pos,
|
|||||||
|
|
||||||
toolBar->Realize();
|
toolBar->Realize();
|
||||||
|
|
||||||
wxSplitterWindow* splitter = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, GetClientSize(), wxSP_NO_XP_THEME|wxSP_3D|wxSP_LIVE_UPDATE);
|
wxSplitterWindow* splitter = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, GetClientSize(), wxSP_LIVE_UPDATE);
|
||||||
|
|
||||||
wxFont textFont = wxFont(12, wxROMAN, wxNORMAL, wxNORMAL);
|
wxFont textFont = wxFont(12, wxROMAN, wxNORMAL, wxNORMAL);
|
||||||
wxFont boldFont = wxFont(12, wxROMAN, wxNORMAL, wxBOLD);
|
wxFont boldFont = wxFont(12, wxROMAN, wxNORMAL, wxBOLD);
|
||||||
wxFont italicFont = wxFont(12, wxROMAN, wxITALIC, wxNORMAL);
|
wxFont italicFont = wxFont(12, wxROMAN, wxITALIC, wxNORMAL);
|
||||||
|
|
||||||
m_richTextCtrl = new wxRichTextCtrl(splitter, ID_RICHTEXT_CTRL, wxEmptyString, wxDefaultPosition, wxSize(200, 200), wxVSCROLL|wxHSCROLL|wxNO_BORDER|wxWANTS_CHARS);
|
m_richTextCtrl = new wxRichTextCtrl(splitter, ID_RICHTEXT_CTRL, wxEmptyString, wxDefaultPosition, wxSize(200, 200), wxVSCROLL|wxHSCROLL|wxWANTS_CHARS);
|
||||||
wxFont font(12, wxROMAN, wxNORMAL, wxNORMAL);
|
wxFont font(12, wxROMAN, wxNORMAL, wxNORMAL);
|
||||||
|
|
||||||
m_richTextCtrl->SetFont(font);
|
m_richTextCtrl->SetFont(font);
|
||||||
|
@@ -325,6 +325,12 @@ bool wxSearchCtrl::Create(wxWindow *parent, wxWindowID id,
|
|||||||
style &= ~wxBORDER_MASK;
|
style &= ~wxBORDER_MASK;
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
style |= wxBORDER_SUNKEN;
|
style |= wxBORDER_SUNKEN;
|
||||||
|
#elif defined(__WXMSW__)
|
||||||
|
// Don't set the style explicitly, let GetDefaultBorder() work it out, unless
|
||||||
|
// we will get a sunken border (e.g. on Windows 200) in which case we must
|
||||||
|
// override with a simple border.
|
||||||
|
if (GetDefaultBorder() == wxBORDER_SUNKEN)
|
||||||
|
style |= wxBORDER_SIMPLE;
|
||||||
#else
|
#else
|
||||||
style |= wxBORDER_SIMPLE;
|
style |= wxBORDER_SIMPLE;
|
||||||
#endif
|
#endif
|
||||||
|
@@ -77,6 +77,11 @@ bool wxVListBox::Create(wxWindow *parent,
|
|||||||
long style,
|
long style,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
if ((style & wxBORDER_MASK) == wxDEFAULT)
|
||||||
|
style |= wxBORDER_THEME;
|
||||||
|
#endif
|
||||||
|
|
||||||
style |= wxWANTS_CHARS | wxFULL_REPAINT_ON_RESIZE;
|
style |= wxWANTS_CHARS | wxFULL_REPAINT_ON_RESIZE;
|
||||||
if ( !wxVScrolledWindow::Create(parent, id, pos, size, style, name) )
|
if ( !wxVScrolledWindow::Create(parent, id, pos, size, style, name) )
|
||||||
return false;
|
return false;
|
||||||
|
@@ -228,14 +228,7 @@ bool wxControl::MSWCreateControl(const wxChar *classname,
|
|||||||
|
|
||||||
wxBorder wxControl::GetDefaultBorder() const
|
wxBorder wxControl::GetDefaultBorder() const
|
||||||
{
|
{
|
||||||
// we want to automatically give controls a sunken style (confusingly,
|
return GetDefaultBorderForControl();
|
||||||
// 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)
|
|
||||||
#if defined(__POCKETPC__) || defined(__SMARTPHONE__)
|
|
||||||
return wxBORDER_SIMPLE;
|
|
||||||
#else
|
|
||||||
return wxBORDER_SUNKEN;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WXDWORD wxControl::MSWGetStyle(long style, WXDWORD *exstyle) const
|
WXDWORD wxControl::MSWGetStyle(long style, WXDWORD *exstyle) const
|
||||||
|
@@ -301,11 +301,6 @@ bool wxTextCtrl::Create(wxWindow *parent,
|
|||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
#ifdef __WXWINCE__
|
|
||||||
if ((style & wxBORDER_MASK) == 0)
|
|
||||||
style |= wxBORDER_SIMPLE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// base initialization
|
// base initialization
|
||||||
if ( !CreateControl(parent, id, pos, size, style, validator, name) )
|
if ( !CreateControl(parent, id, pos, size, style, validator, name) )
|
||||||
return false;
|
return false;
|
||||||
@@ -316,6 +311,17 @@ bool wxTextCtrl::Create(wxWindow *parent,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// returns true if the platform should explicitly apply a theme border
|
||||||
|
bool wxTextCtrl::CanApplyThemeBorder() const
|
||||||
|
{
|
||||||
|
#ifdef __WXWINCE__
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
// Standard text control already handles theming
|
||||||
|
return ((GetWindowStyle() & (wxTE_RICH|wxTE_RICH2)) != 0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
bool wxTextCtrl::MSWCreateText(const wxString& value,
|
bool wxTextCtrl::MSWCreateText(const wxString& value,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size)
|
const wxSize& size)
|
||||||
|
@@ -121,6 +121,18 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if wxUSE_UXTHEME
|
||||||
|
#include "wx/msw/uxtheme.h"
|
||||||
|
#define EP_EDITTEXT 1
|
||||||
|
#define ETS_NORMAL 1
|
||||||
|
#define ETS_HOT 2
|
||||||
|
#define ETS_SELECTED 3
|
||||||
|
#define ETS_DISABLED 4
|
||||||
|
#define ETS_FOCUSED 5
|
||||||
|
#define ETS_READONLY 6
|
||||||
|
#define ETS_ASSIST 7
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(TME_LEAVE) && defined(WM_MOUSELEAVE) && wxUSE_DYNLIB_CLASS
|
#if defined(TME_LEAVE) && defined(WM_MOUSELEAVE) && wxUSE_DYNLIB_CLASS
|
||||||
#define HAVE_TRACKMOUSEEVENT
|
#define HAVE_TRACKMOUSEEVENT
|
||||||
#endif // everything needed for TrackMouseEvent()
|
#endif // everything needed for TrackMouseEvent()
|
||||||
@@ -1274,6 +1286,27 @@ void wxWindowMSW::MSWUpdateStyle(long flagsOld, long exflagsOld)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxBorder wxWindowMSW::GetDefaultBorderForControl() 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)
|
||||||
|
|
||||||
|
#if defined(__POCKETPC__) || defined(__SMARTPHONE__)
|
||||||
|
return wxBORDER_SIMPLE;
|
||||||
|
#else
|
||||||
|
#if wxUSE_UXTHEME
|
||||||
|
if (CanApplyThemeBorder())
|
||||||
|
{
|
||||||
|
wxUxThemeEngine* theme = wxUxThemeEngine::GetIfActive();
|
||||||
|
if (theme)
|
||||||
|
return wxBORDER_THEME;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return wxBORDER_SUNKEN;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const
|
WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const
|
||||||
{
|
{
|
||||||
// translate common wxWidgets styles to Windows ones
|
// translate common wxWidgets styles to Windows ones
|
||||||
@@ -1328,6 +1361,7 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const
|
|||||||
|
|
||||||
case wxBORDER_NONE:
|
case wxBORDER_NONE:
|
||||||
case wxBORDER_SIMPLE:
|
case wxBORDER_SIMPLE:
|
||||||
|
case wxBORDER_THEME:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxBORDER_STATIC:
|
case wxBORDER_STATIC:
|
||||||
@@ -1343,9 +1377,9 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const
|
|||||||
style &= ~WS_BORDER;
|
style &= ~WS_BORDER;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxBORDER_DOUBLE:
|
// case wxBORDER_DOUBLE:
|
||||||
*exstyle |= WS_EX_DLGMODALFRAME;
|
// *exstyle |= WS_EX_DLGMODALFRAME;
|
||||||
break;
|
// break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// wxUniv doesn't use Windows dialog navigation functions at all
|
// wxUniv doesn't use Windows dialog navigation functions at all
|
||||||
@@ -2542,7 +2576,7 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#if 0
|
||||||
case WM_ENTERSIZEMOVE:
|
case WM_ENTERSIZEMOVE:
|
||||||
{
|
{
|
||||||
processed = HandleEnterSizeMove();
|
processed = HandleEnterSizeMove();
|
||||||
@@ -2554,7 +2588,7 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l
|
|||||||
processed = HandleExitSizeMove();
|
processed = HandleExitSizeMove();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case WM_SIZING:
|
case WM_SIZING:
|
||||||
{
|
{
|
||||||
LPRECT pRect = (LPRECT)lParam;
|
LPRECT pRect = (LPRECT)lParam;
|
||||||
@@ -3200,6 +3234,94 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l
|
|||||||
break;
|
break;
|
||||||
#endif // __WXWINCE__
|
#endif // __WXWINCE__
|
||||||
|
|
||||||
|
#if wxUSE_UXTHEME
|
||||||
|
// If we want the default themed border then we need to draw it ourselves
|
||||||
|
case WM_NCCALCSIZE:
|
||||||
|
{
|
||||||
|
wxUxThemeEngine* theme = wxUxThemeEngine::GetIfActive();
|
||||||
|
if (theme && GetBorder() == wxBORDER_THEME)
|
||||||
|
{
|
||||||
|
// first ask the widget to calculate the border size
|
||||||
|
rc.result = MSWDefWindowProc(message, wParam, lParam);
|
||||||
|
processed = true;
|
||||||
|
|
||||||
|
// now alter the client size making room for drawing a themed border
|
||||||
|
NCCALCSIZE_PARAMS *csparam = NULL;
|
||||||
|
RECT rect;
|
||||||
|
if (wParam)
|
||||||
|
{
|
||||||
|
csparam = (NCCALCSIZE_PARAMS*)lParam;
|
||||||
|
rect = csparam->rgrc[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rect = *((RECT*)lParam);
|
||||||
|
}
|
||||||
|
wxUxThemeHandle hTheme(this, L"EDIT");
|
||||||
|
RECT rcClient = { 0, 0, 0, 0 };
|
||||||
|
wxClientDC dc(this);
|
||||||
|
|
||||||
|
if (theme->GetThemeBackgroundContentRect(
|
||||||
|
hTheme, GetHdcOf(dc), EP_EDITTEXT, ETS_NORMAL,
|
||||||
|
&rect, &rcClient) == S_OK)
|
||||||
|
{
|
||||||
|
InflateRect(&rcClient, -1, -1);
|
||||||
|
if (wParam)
|
||||||
|
csparam->rgrc[0] = rcClient;
|
||||||
|
else
|
||||||
|
*((RECT*)lParam) = rcClient;
|
||||||
|
rc.result = WVR_REDRAW;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_NCPAINT:
|
||||||
|
{
|
||||||
|
wxUxThemeEngine* theme = wxUxThemeEngine::GetIfActive();
|
||||||
|
if (theme && GetBorder() == wxBORDER_THEME)
|
||||||
|
{
|
||||||
|
// first ask the widget to paint its non-client area, such as scrollbars, etc.
|
||||||
|
rc.result = MSWDefWindowProc(message, wParam, lParam);
|
||||||
|
processed = true;
|
||||||
|
|
||||||
|
wxUxThemeHandle hTheme(this, L"EDIT");
|
||||||
|
wxWindowDC dc(this);
|
||||||
|
|
||||||
|
// Clip the DC so that you only draw on the non-client area
|
||||||
|
RECT rcBorder;
|
||||||
|
wxCopyRectToRECT(GetSize(), rcBorder);
|
||||||
|
|
||||||
|
RECT rcClient;
|
||||||
|
theme->GetThemeBackgroundContentRect(
|
||||||
|
hTheme, GetHdcOf(dc), EP_EDITTEXT, ETS_NORMAL, &rcBorder, &rcClient);
|
||||||
|
InflateRect(&rcClient, -1, -1);
|
||||||
|
|
||||||
|
::ExcludeClipRect(GetHdcOf(dc), rcClient.left, rcClient.top,
|
||||||
|
rcClient.right, rcClient.bottom);
|
||||||
|
|
||||||
|
// Make sure the background is in a proper state
|
||||||
|
if (theme->IsThemeBackgroundPartiallyTransparent(hTheme, EP_EDITTEXT, ETS_NORMAL))
|
||||||
|
{
|
||||||
|
theme->DrawThemeParentBackground(GetHwnd(), GetHdcOf(dc), &rcBorder);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw the border
|
||||||
|
int nState;
|
||||||
|
if ( !IsEnabled() )
|
||||||
|
nState = ETS_DISABLED;
|
||||||
|
// should we check this?
|
||||||
|
//else if ( ::GetWindowLong(GetHwnd(), GWL_STYLE) & ES_READONLY)
|
||||||
|
// nState = ETS_READONLY;
|
||||||
|
else
|
||||||
|
nState = ETS_NORMAL;
|
||||||
|
theme->DrawThemeBackground(hTheme, GetHdcOf(dc), EP_EDITTEXT, nState, &rcBorder, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
#endif // wxUSE_UXTHEME
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// try a custom message handler
|
// try a custom message handler
|
||||||
const MSWMessageHandlers::const_iterator
|
const MSWMessageHandlers::const_iterator
|
||||||
|
@@ -129,6 +129,14 @@ wxRichTextCtrl::wxRichTextCtrl(wxWindow* parent,
|
|||||||
bool wxRichTextCtrl::Create( wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style,
|
bool wxRichTextCtrl::Create( wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style,
|
||||||
const wxValidator& validator, const wxString& name)
|
const wxValidator& validator, const wxString& name)
|
||||||
{
|
{
|
||||||
|
// Try to make this only necessary in 2.8
|
||||||
|
#if 0
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
if ((style & wxBORDER_MASK) == wxDEFAULT)
|
||||||
|
style |= wxBORDER_THEME;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!wxTextCtrlBase::Create(parent, id, pos, size,
|
if (!wxTextCtrlBase::Create(parent, id, pos, size,
|
||||||
style|wxFULL_REPAINT_ON_RESIZE,
|
style|wxFULL_REPAINT_ON_RESIZE,
|
||||||
validator, name))
|
validator, name))
|
||||||
|
@@ -822,7 +822,7 @@ bool wxRichTextStyleListCtrl::Create(wxWindow* parent, wxWindowID id, const wxPo
|
|||||||
|
|
||||||
bool showSelector = ((style & wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR) == 0);
|
bool showSelector = ((style & wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR) == 0);
|
||||||
|
|
||||||
m_styleListBox = new wxRichTextStyleListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, showSelector ? wxSIMPLE_BORDER : wxNO_BORDER);
|
m_styleListBox = new wxRichTextStyleListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, showSelector ? wxBORDER_DEFAULT : wxBORDER_NONE);
|
||||||
|
|
||||||
wxBoxSizer* boxSizer = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* boxSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
@@ -837,7 +837,7 @@ bool wxRichTextStyleListCtrl::Create(wxWindow* parent, wxWindowID id, const wxPo
|
|||||||
m_styleChoice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, choices);
|
m_styleChoice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, choices);
|
||||||
|
|
||||||
boxSizer->Add(m_styleListBox, 1, wxALL|wxEXPAND, 5);
|
boxSizer->Add(m_styleListBox, 1, wxALL|wxEXPAND, 5);
|
||||||
boxSizer->Add(m_styleChoice, 0, wxALL|wxEXPAND, 5);
|
boxSizer->Add(m_styleChoice, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND, 5);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -998,6 +998,17 @@ BEGIN_EVENT_TABLE(wxRichTextStyleComboPopup, wxRichTextStyleListBox)
|
|||||||
EVT_LEFT_DOWN(wxRichTextStyleComboPopup::OnMouseClick)
|
EVT_LEFT_DOWN(wxRichTextStyleComboPopup::OnMouseClick)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
bool wxRichTextStyleComboPopup::Create( wxWindow* parent )
|
||||||
|
{
|
||||||
|
int borderStyle = GetDefaultBorder();
|
||||||
|
if (borderStyle == wxBORDER_SUNKEN)
|
||||||
|
borderStyle = wxBORDER_SIMPLE;
|
||||||
|
|
||||||
|
return wxRichTextStyleListBox::Create(parent, wxID_ANY,
|
||||||
|
wxPoint(0,0), wxDefaultSize,
|
||||||
|
borderStyle);
|
||||||
|
}
|
||||||
|
|
||||||
void wxRichTextStyleComboPopup::SetStringValue( const wxString& s )
|
void wxRichTextStyleComboPopup::SetStringValue( const wxString& s )
|
||||||
{
|
{
|
||||||
m_value = SetStyleSelection(s);
|
m_value = SetStyleSelection(s);
|
||||||
|
Reference in New Issue
Block a user