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
 | 
			
		||||
    virtual bool AcceptsFocus() const { return false; }
 | 
			
		||||
 | 
			
		||||
    // returns true if the platform should explicitly apply a theme border
 | 
			
		||||
    virtual bool CanApplyThemeBorder() const { return false; }
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    // flags for DoSetSelection()
 | 
			
		||||
    enum
 | 
			
		||||
 
 | 
			
		||||
@@ -1406,7 +1406,8 @@ enum wxBorder
 | 
			
		||||
    wxBORDER_SIMPLE = 0x02000000,
 | 
			
		||||
    wxBORDER_RAISED = 0x04000000,
 | 
			
		||||
    wxBORDER_SUNKEN = 0x08000000,
 | 
			
		||||
    wxBORDER_DOUBLE = 0x10000000,
 | 
			
		||||
    wxBORDER_DOUBLE = 0x10000000, /* deprecated */
 | 
			
		||||
    wxBORDER_THEME  = 0x10000000,
 | 
			
		||||
 | 
			
		||||
    /*  a mask to extract border style from the combination of flags */
 | 
			
		||||
    wxBORDER_MASK   = 0x1f200000
 | 
			
		||||
 
 | 
			
		||||
@@ -58,6 +58,9 @@ public:
 | 
			
		||||
    virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
 | 
			
		||||
    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:
 | 
			
		||||
    void MakeOwnerDrawn();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -47,6 +47,9 @@ public:
 | 
			
		||||
    virtual bool SetForegroundColour(const wxColour& colour);
 | 
			
		||||
    virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
 | 
			
		||||
 | 
			
		||||
    // returns true if the platform should explicitly apply a theme border
 | 
			
		||||
    virtual bool CanApplyThemeBorder() const { return false; }
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    virtual wxSize DoGetBestSize() const;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -85,6 +85,9 @@ public:
 | 
			
		||||
    virtual bool MSWShouldPreProcessMessage(WXMSG *pMsg);
 | 
			
		||||
    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:
 | 
			
		||||
    // common part of all ctors
 | 
			
		||||
    void Init() { m_lastAcceptedSelection = wxID_NONE; }
 | 
			
		||||
 
 | 
			
		||||
@@ -57,6 +57,9 @@ public:
 | 
			
		||||
 | 
			
		||||
    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:
 | 
			
		||||
    virtual wxSize DoGetBestSize() const;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -58,6 +58,9 @@ public:
 | 
			
		||||
 | 
			
		||||
    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:
 | 
			
		||||
    virtual wxSize DoGetBestSize() const;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -133,6 +133,9 @@ public:
 | 
			
		||||
        return GetCompositeControlsDefaultAttributes(variant);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // returns true if the platform should explicitly apply a theme border
 | 
			
		||||
    virtual bool CanApplyThemeBorder() const { return false; }
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    virtual void DoSetSelection(int n, bool select);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -115,6 +115,9 @@ public:
 | 
			
		||||
    // it to behave normally
 | 
			
		||||
    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 SetButtonFont(const wxFont& font) { SetFont(font); }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -58,6 +58,9 @@ public:
 | 
			
		||||
 | 
			
		||||
    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:
 | 
			
		||||
    virtual wxSize DoGetBestSize() const;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -83,6 +83,8 @@ public:
 | 
			
		||||
    // we should let background show through the slider (and its labels)
 | 
			
		||||
    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);
 | 
			
		||||
    virtual bool MSWOnScroll(int orientation, WXWORD wParam,
 | 
			
		||||
 
 | 
			
		||||
@@ -57,6 +57,9 @@ public:
 | 
			
		||||
    // a wxSpinButton can't do anything useful with focus, only wxSpinCtrl can
 | 
			
		||||
    virtual bool AcceptsFocus() const { return false; }
 | 
			
		||||
 | 
			
		||||
    // returns true if the platform should explicitly apply a theme border
 | 
			
		||||
    virtual bool CanApplyThemeBorder() const { return false; }
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
   virtual wxSize DoGetBestSize() const;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -54,6 +54,9 @@ public:
 | 
			
		||||
 | 
			
		||||
    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:
 | 
			
		||||
    virtual wxBorder GetDefaultBorder() const;
 | 
			
		||||
    virtual wxSize DoGetBestSize() const;
 | 
			
		||||
 
 | 
			
		||||
@@ -40,6 +40,9 @@ public:
 | 
			
		||||
 | 
			
		||||
    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:
 | 
			
		||||
    virtual wxSize DoGetBestSize() const;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -170,6 +170,9 @@ public:
 | 
			
		||||
 | 
			
		||||
    virtual bool AcceptsFocus() const;
 | 
			
		||||
 | 
			
		||||
    // returns true if the platform should explicitly apply a theme border
 | 
			
		||||
    virtual bool CanApplyThemeBorder() const;
 | 
			
		||||
 | 
			
		||||
    // callbacks
 | 
			
		||||
    void OnDropFiles(wxDropFilesEvent& event);
 | 
			
		||||
    void OnChar(wxKeyEvent& event); // Process 'enter' if required
 | 
			
		||||
 
 | 
			
		||||
@@ -48,6 +48,9 @@ public:
 | 
			
		||||
    virtual void Command(wxCommandEvent& event);
 | 
			
		||||
    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:
 | 
			
		||||
    virtual wxSize DoGetBestSize() const;
 | 
			
		||||
    virtual wxBorder GetDefaultBorder() const;
 | 
			
		||||
 
 | 
			
		||||
@@ -107,6 +107,9 @@ public:
 | 
			
		||||
    // window proc for the frames
 | 
			
		||||
    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:
 | 
			
		||||
    // common part of all ctors
 | 
			
		||||
    void Init();
 | 
			
		||||
 
 | 
			
		||||
@@ -210,6 +210,9 @@ public:
 | 
			
		||||
    void SetState(const wxTreeItemId& node, int state);
 | 
			
		||||
    int GetState(const wxTreeItemId& node);
 | 
			
		||||
 | 
			
		||||
    // returns true if the platform should explicitly apply a theme border
 | 
			
		||||
    virtual bool CanApplyThemeBorder() const { return false; }
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    // SetImageList helper
 | 
			
		||||
    void SetAnyImageList(wxImageList *imageList, int which);
 | 
			
		||||
 
 | 
			
		||||
@@ -433,6 +433,11 @@ public:
 | 
			
		||||
    // check if a native double-buffering applies for this window
 | 
			
		||||
    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
 | 
			
		||||
    void GenerateMouseLeave();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -580,12 +580,7 @@ public:
 | 
			
		||||
        m_value = -1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual bool Create( wxWindow* parent )
 | 
			
		||||
    {
 | 
			
		||||
        return wxRichTextStyleListBox::Create(parent, wxID_ANY,
 | 
			
		||||
                                  wxPoint(0,0), wxDefaultSize,
 | 
			
		||||
                                  wxSIMPLE_BORDER);
 | 
			
		||||
    }
 | 
			
		||||
    virtual bool Create( wxWindow* parent );
 | 
			
		||||
 | 
			
		||||
    virtual wxWindow *GetControl() { return this; }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -201,6 +201,8 @@ public:
 | 
			
		||||
    static wxVisualAttributes
 | 
			
		||||
    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 | 
			
		||||
 | 
			
		||||
	virtual wxBorder GetDefaultBorder() const { return GetDefaultBorderForControl(); }
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    // the derived class must implement this function to actually draw the item
 | 
			
		||||
    // 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):
 | 
			
		||||
    virtual bool CanBeOutsideClientArea() const { return false; }
 | 
			
		||||
 | 
			
		||||
    // returns true if the platform should explicitly apply a theme border
 | 
			
		||||
    virtual bool CanApplyThemeBorder() const { return true; }
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    // event handling specific to wxWindow
 | 
			
		||||
    virtual bool TryValidator(wxEvent& event);
 | 
			
		||||
@@ -1381,6 +1384,11 @@ protected:
 | 
			
		||||
    // specified) border for the window class
 | 
			
		||||
    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
 | 
			
		||||
    // have their own default size so this is just for non top-level windows.
 | 
			
		||||
    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();
 | 
			
		||||
 | 
			
		||||
    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 boldFont = wxFont(12, wxROMAN, wxNORMAL, wxBOLD);
 | 
			
		||||
    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);
 | 
			
		||||
 | 
			
		||||
    m_richTextCtrl->SetFont(font);
 | 
			
		||||
 
 | 
			
		||||
@@ -325,6 +325,12 @@ bool wxSearchCtrl::Create(wxWindow *parent, wxWindowID id,
 | 
			
		||||
    style &= ~wxBORDER_MASK;
 | 
			
		||||
#ifdef __WXGTK__
 | 
			
		||||
    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
 | 
			
		||||
    style |= wxBORDER_SIMPLE;
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -77,6 +77,11 @@ bool wxVListBox::Create(wxWindow *parent,
 | 
			
		||||
                        long style,
 | 
			
		||||
                        const wxString& name)
 | 
			
		||||
{
 | 
			
		||||
#ifdef __WXMSW__
 | 
			
		||||
	if ((style & wxBORDER_MASK) == wxDEFAULT)
 | 
			
		||||
		style |= wxBORDER_THEME;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    style |= wxWANTS_CHARS | wxFULL_REPAINT_ON_RESIZE;
 | 
			
		||||
    if ( !wxVScrolledWindow::Create(parent, id, pos, size, style, name) )
 | 
			
		||||
        return false;
 | 
			
		||||
 
 | 
			
		||||
@@ -228,14 +228,7 @@ bool wxControl::MSWCreateControl(const wxChar *classname,
 | 
			
		||||
 | 
			
		||||
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)
 | 
			
		||||
#if defined(__POCKETPC__) || defined(__SMARTPHONE__)
 | 
			
		||||
    return wxBORDER_SIMPLE;
 | 
			
		||||
#else
 | 
			
		||||
    return wxBORDER_SUNKEN;
 | 
			
		||||
#endif
 | 
			
		||||
	return GetDefaultBorderForControl();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
WXDWORD wxControl::MSWGetStyle(long style, WXDWORD *exstyle) const
 | 
			
		||||
 
 | 
			
		||||
@@ -301,11 +301,6 @@ bool wxTextCtrl::Create(wxWindow *parent,
 | 
			
		||||
                        const wxValidator& validator,
 | 
			
		||||
                        const wxString& name)
 | 
			
		||||
{
 | 
			
		||||
#ifdef __WXWINCE__
 | 
			
		||||
    if ((style & wxBORDER_MASK) == 0)
 | 
			
		||||
        style |= wxBORDER_SIMPLE;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    // base initialization
 | 
			
		||||
    if ( !CreateControl(parent, id, pos, size, style, validator, name) )
 | 
			
		||||
        return false;
 | 
			
		||||
@@ -316,6 +311,17 @@ bool wxTextCtrl::Create(wxWindow *parent,
 | 
			
		||||
    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,
 | 
			
		||||
                               const wxPoint& pos,
 | 
			
		||||
                               const wxSize& size)
 | 
			
		||||
 
 | 
			
		||||
@@ -121,6 +121,18 @@
 | 
			
		||||
#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
 | 
			
		||||
    #define HAVE_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
 | 
			
		||||
{
 | 
			
		||||
    // translate common wxWidgets styles to Windows ones
 | 
			
		||||
@@ -1328,6 +1361,7 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const
 | 
			
		||||
 | 
			
		||||
            case wxBORDER_NONE:
 | 
			
		||||
            case wxBORDER_SIMPLE:
 | 
			
		||||
            case wxBORDER_THEME:
 | 
			
		||||
                break;
 | 
			
		||||
 | 
			
		||||
            case wxBORDER_STATIC:
 | 
			
		||||
@@ -1343,9 +1377,9 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const
 | 
			
		||||
                style &= ~WS_BORDER;
 | 
			
		||||
                break;
 | 
			
		||||
 | 
			
		||||
            case wxBORDER_DOUBLE:
 | 
			
		||||
                *exstyle |= WS_EX_DLGMODALFRAME;
 | 
			
		||||
                break;
 | 
			
		||||
//            case wxBORDER_DOUBLE:
 | 
			
		||||
//                *exstyle |= WS_EX_DLGMODALFRAME;
 | 
			
		||||
//                break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // wxUniv doesn't use Windows dialog navigation functions at all
 | 
			
		||||
@@ -2542,7 +2576,7 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
        case WM_ENTERSIZEMOVE:
 | 
			
		||||
            {
 | 
			
		||||
                processed = HandleEnterSizeMove();
 | 
			
		||||
@@ -2554,7 +2588,7 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l
 | 
			
		||||
                processed = HandleExitSizeMove();
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
        case WM_SIZING:
 | 
			
		||||
            {
 | 
			
		||||
                LPRECT pRect = (LPRECT)lParam;
 | 
			
		||||
@@ -3200,6 +3234,94 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l
 | 
			
		||||
            break;
 | 
			
		||||
#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:
 | 
			
		||||
            // try a custom message handler
 | 
			
		||||
            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,
 | 
			
		||||
                             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,
 | 
			
		||||
                                style|wxFULL_REPAINT_ON_RESIZE,
 | 
			
		||||
                                validator, name))
 | 
			
		||||
 
 | 
			
		||||
@@ -822,7 +822,7 @@ bool wxRichTextStyleListCtrl::Create(wxWindow* parent, wxWindowID id, const wxPo
 | 
			
		||||
 | 
			
		||||
    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);
 | 
			
		||||
 | 
			
		||||
@@ -837,7 +837,7 @@ bool wxRichTextStyleListCtrl::Create(wxWindow* parent, wxWindowID id, const wxPo
 | 
			
		||||
        m_styleChoice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, choices);
 | 
			
		||||
 | 
			
		||||
        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
 | 
			
		||||
    {
 | 
			
		||||
@@ -998,6 +998,17 @@ BEGIN_EVENT_TABLE(wxRichTextStyleComboPopup, wxRichTextStyleListBox)
 | 
			
		||||
    EVT_LEFT_DOWN(wxRichTextStyleComboPopup::OnMouseClick)
 | 
			
		||||
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 )
 | 
			
		||||
{
 | 
			
		||||
    m_value = SetStyleSelection(s);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user