1. added flags to splitter drawing functions and replaced
GetSplitterBorderAndSash() with GetSplitterParams() 2. added support for "hot tracking" to wxSplitterWindow 3. added GTK2 support for the splitter to GTK renderer git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22427 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -245,12 +245,18 @@ protected:
|
|||||||
// set the sash position and send an event about it having been changed
|
// set the sash position and send an event about it having been changed
|
||||||
void SetSashPositionAndNotify(int sashPos);
|
void SetSashPositionAndNotify(int sashPos);
|
||||||
|
|
||||||
|
// callbacks executed when we detect that the mouse has entered or left
|
||||||
|
// the sash
|
||||||
|
virtual void OnEnterSash();
|
||||||
|
virtual void OnLeaveSash();
|
||||||
|
|
||||||
// set the cursor appropriate for the current split mode
|
// set the cursor appropriate for the current split mode
|
||||||
void SetResizeCursor();
|
void SetResizeCursor();
|
||||||
|
|
||||||
|
// redraw the splitter if its "hotness" changed if necessary
|
||||||
|
void RedrawIfHotSensitive(bool isHot);
|
||||||
|
|
||||||
wxSplitMode m_splitMode;
|
wxSplitMode m_splitMode;
|
||||||
bool m_permitUnsplitAlways;
|
|
||||||
bool m_needUpdating; // when in live mode, set this to TRUE to resize children in idle
|
|
||||||
wxWindow* m_windowOne;
|
wxWindow* m_windowOne;
|
||||||
wxWindow* m_windowTwo;
|
wxWindow* m_windowTwo;
|
||||||
int m_dragMode;
|
int m_dragMode;
|
||||||
@@ -266,6 +272,11 @@ protected:
|
|||||||
wxCursor m_sashCursorNS;
|
wxCursor m_sashCursorNS;
|
||||||
wxPen *m_sashTrackerPen;
|
wxPen *m_sashTrackerPen;
|
||||||
|
|
||||||
|
// when in live mode, set this to TRUE to resize children in idle
|
||||||
|
bool m_needUpdating:1;
|
||||||
|
bool m_permitUnsplitAlways:1;
|
||||||
|
bool m_isHot:1;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WX_DECLARE_CONTROL_CONTAINER();
|
WX_DECLARE_CONTROL_CONTAINER();
|
||||||
|
|
||||||
|
@@ -62,6 +62,29 @@ enum
|
|||||||
wxCONTROL_DIRTY = 0x80000000
|
wxCONTROL_DIRTY = 0x80000000
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// helper structs
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// wxSplitterWindow parameters
|
||||||
|
struct WXDLLEXPORT wxSplitterRenderParams
|
||||||
|
{
|
||||||
|
// the only way to initialize this struct is by using this ctor
|
||||||
|
wxSplitterRenderParams(wxCoord widthSash_, wxCoord border_, bool isSens_)
|
||||||
|
: widthSash(widthSash_), border(border_), isHotSensitive(isSens_)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// the width of the splitter sash
|
||||||
|
const wxCoord widthSash;
|
||||||
|
|
||||||
|
// the width of the border of the splitter window
|
||||||
|
const wxCoord border;
|
||||||
|
|
||||||
|
// true if the splitter changes its appearance when the mouse is over it
|
||||||
|
const bool isHotSensitive;
|
||||||
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxRendererNative: abstracts drawing methods needed by the native controls
|
// wxRendererNative: abstracts drawing methods needed by the native controls
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -90,14 +113,16 @@ public:
|
|||||||
// drawn by DrawSash() blends into it well
|
// drawn by DrawSash() blends into it well
|
||||||
virtual void DrawSplitterBorder(wxWindow *win,
|
virtual void DrawSplitterBorder(wxWindow *win,
|
||||||
wxDC& dc,
|
wxDC& dc,
|
||||||
const wxRect& rect) = 0;
|
const wxRect& rect,
|
||||||
|
int flags = 0) = 0;
|
||||||
|
|
||||||
// draw a (vertical) sash
|
// draw a (vertical) sash
|
||||||
virtual void DrawSplitterSash(wxWindow *win,
|
virtual void DrawSplitterSash(wxWindow *win,
|
||||||
wxDC& dc,
|
wxDC& dc,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
wxCoord position,
|
wxCoord position,
|
||||||
wxOrientation orient) = 0;
|
wxOrientation orient,
|
||||||
|
int flags = 0) = 0;
|
||||||
|
|
||||||
|
|
||||||
// geometry functions
|
// geometry functions
|
||||||
@@ -105,7 +130,7 @@ public:
|
|||||||
|
|
||||||
// get the splitter parameters: the x field of the returned point is the
|
// get the splitter parameters: the x field of the returned point is the
|
||||||
// sash width and the y field is the border width
|
// sash width and the y field is the border width
|
||||||
virtual wxPoint GetSplitterSashAndBorder(const wxWindow *win) = 0;
|
virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win) = 0;
|
||||||
|
|
||||||
|
|
||||||
// pseudo constructors
|
// pseudo constructors
|
||||||
@@ -149,19 +174,21 @@ public:
|
|||||||
|
|
||||||
virtual void DrawSplitterBorder(wxWindow *win,
|
virtual void DrawSplitterBorder(wxWindow *win,
|
||||||
wxDC& dc,
|
wxDC& dc,
|
||||||
const wxRect& rect)
|
const wxRect& rect,
|
||||||
|
int flags = 0)
|
||||||
{ m_rendererNative.DrawSplitterBorder(win, dc, rect); }
|
{ m_rendererNative.DrawSplitterBorder(win, dc, rect); }
|
||||||
|
|
||||||
virtual void DrawSplitterSash(wxWindow *win,
|
virtual void DrawSplitterSash(wxWindow *win,
|
||||||
wxDC& dc,
|
wxDC& dc,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
wxCoord position,
|
wxCoord position,
|
||||||
wxOrientation orient)
|
wxOrientation orient,
|
||||||
|
int flags = 0)
|
||||||
{ m_rendererNative.DrawSplitterSash(win, dc, size, position, orient); }
|
{ m_rendererNative.DrawSplitterSash(win, dc, size, position, orient); }
|
||||||
|
|
||||||
|
|
||||||
virtual wxPoint GetSplitterSashAndBorder(const wxWindow *win)
|
virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win)
|
||||||
{ return m_rendererNative.GetSplitterSashAndBorder(win); }
|
{ return m_rendererNative.GetSplitterParams(win); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxRendererNative& m_rendererNative;
|
wxRendererNative& m_rendererNative;
|
||||||
|
@@ -59,16 +59,18 @@ public:
|
|||||||
|
|
||||||
virtual void DrawSplitterBorder(wxWindow *win,
|
virtual void DrawSplitterBorder(wxWindow *win,
|
||||||
wxDC& dc,
|
wxDC& dc,
|
||||||
const wxRect& rect);
|
const wxRect& rect,
|
||||||
|
int flags = 0);
|
||||||
|
|
||||||
virtual void DrawSplitterSash(wxWindow *win,
|
virtual void DrawSplitterSash(wxWindow *win,
|
||||||
wxDC& dc,
|
wxDC& dc,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
wxCoord position,
|
wxCoord position,
|
||||||
wxOrientation orient);
|
wxOrientation orient,
|
||||||
|
int flags = 0);
|
||||||
|
|
||||||
|
|
||||||
virtual wxPoint GetSplitterSashAndBorder(const wxWindow *win);
|
virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -197,17 +199,32 @@ wxRendererGeneric::DrawTreeItemButton(wxWindow * WXUNUSED(win),
|
|||||||
// sash drawing
|
// sash drawing
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxPoint
|
wxSplitterRenderParams
|
||||||
wxRendererGeneric::GetSplitterSashAndBorder(const wxWindow *win)
|
wxRendererGeneric::GetSplitterParams(const wxWindow *win)
|
||||||
{
|
{
|
||||||
// see below
|
// see below
|
||||||
return win->HasFlag(wxSP_3D) ? wxPoint(7, 2) : wxPoint(3, 0);
|
wxCoord sashWidth,
|
||||||
|
border;
|
||||||
|
|
||||||
|
if ( win->HasFlag(wxSP_3D) )
|
||||||
|
{
|
||||||
|
sashWidth = 7;
|
||||||
|
border = 3;
|
||||||
|
}
|
||||||
|
else // no 3D effect
|
||||||
|
{
|
||||||
|
sashWidth = 2;
|
||||||
|
border = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return wxSplitterRenderParams(sashWidth, border, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wxRendererGeneric::DrawSplitterBorder(wxWindow *win,
|
wxRendererGeneric::DrawSplitterBorder(wxWindow *win,
|
||||||
wxDC& dc,
|
wxDC& dc,
|
||||||
const wxRect& rectOrig)
|
const wxRect& rectOrig,
|
||||||
|
int WXUNUSED(falgs))
|
||||||
{
|
{
|
||||||
if ( win->HasFlag(wxSP_3D) )
|
if ( win->HasFlag(wxSP_3D) )
|
||||||
{
|
{
|
||||||
@@ -222,7 +239,8 @@ wxRendererGeneric::DrawSplitterSash(wxWindow *win,
|
|||||||
wxDC& dcReal,
|
wxDC& dcReal,
|
||||||
const wxSize& sizeReal,
|
const wxSize& sizeReal,
|
||||||
wxCoord position,
|
wxCoord position,
|
||||||
wxOrientation orient)
|
wxOrientation orient,
|
||||||
|
int WXUNUSED(flags))
|
||||||
{
|
{
|
||||||
// to avoid duplicating the same code for horizontal and vertical sashes,
|
// to avoid duplicating the same code for horizontal and vertical sashes,
|
||||||
// simply mirror the DC instead if needed (i.e. if horz splitter)
|
// simply mirror the DC instead if needed (i.e. if horz splitter)
|
||||||
|
@@ -109,6 +109,7 @@ void wxSplitterWindow::Init()
|
|||||||
m_sashTrackerPen = new wxPen(*wxBLACK, 2, wxSOLID);
|
m_sashTrackerPen = new wxPen(*wxBLACK, 2, wxSOLID);
|
||||||
|
|
||||||
m_needUpdating = FALSE;
|
m_needUpdating = FALSE;
|
||||||
|
m_isHot = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSplitterWindow::~wxSplitterWindow()
|
wxSplitterWindow::~wxSplitterWindow()
|
||||||
@@ -116,12 +117,46 @@ wxSplitterWindow::~wxSplitterWindow()
|
|||||||
delete m_sashTrackerPen;
|
delete m_sashTrackerPen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// entering/leaving sash
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void wxSplitterWindow::RedrawIfHotSensitive(bool isHot)
|
||||||
|
{
|
||||||
|
if ( wxRendererNative::Get().GetSplitterParams(this).isHotSensitive )
|
||||||
|
{
|
||||||
|
m_isHot = isHot;
|
||||||
|
|
||||||
|
wxClientDC dc(this);
|
||||||
|
DrawSash(dc);
|
||||||
|
}
|
||||||
|
//else: we don't change our appearance, don't redraw to avoid flicker
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSplitterWindow::OnEnterSash()
|
||||||
|
{
|
||||||
|
SetResizeCursor();
|
||||||
|
|
||||||
|
RedrawIfHotSensitive(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSplitterWindow::OnLeaveSash()
|
||||||
|
{
|
||||||
|
SetCursor(*wxSTANDARD_CURSOR);
|
||||||
|
|
||||||
|
RedrawIfHotSensitive(false);
|
||||||
|
}
|
||||||
|
|
||||||
void wxSplitterWindow::SetResizeCursor()
|
void wxSplitterWindow::SetResizeCursor()
|
||||||
{
|
{
|
||||||
SetCursor(m_splitMode == wxSPLIT_VERTICAL ? m_sashCursorWE
|
SetCursor(m_splitMode == wxSPLIT_VERTICAL ? m_sashCursorWE
|
||||||
: m_sashCursorNS);
|
: m_sashCursorNS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// other event handlers
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
void wxSplitterWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
|
void wxSplitterWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxPaintDC dc(this);
|
wxPaintDC dc(this);
|
||||||
@@ -252,15 +287,10 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
|
|||||||
} // left up && dragging
|
} // left up && dragging
|
||||||
else if ((event.Moving() || event.Leaving() || event.Entering()) && (m_dragMode == wxSPLIT_DRAG_NONE))
|
else if ((event.Moving() || event.Leaving() || event.Entering()) && (m_dragMode == wxSPLIT_DRAG_NONE))
|
||||||
{
|
{
|
||||||
// Just change the cursor as required
|
if ( event.Leaving() || !SashHitTest(x, y) )
|
||||||
if ( !event.Leaving() && SashHitTest(x, y) )
|
OnLeaveSash();
|
||||||
{
|
|
||||||
SetResizeCursor();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
OnEnterSash();
|
||||||
SetCursor(* wxSTANDARD_CURSOR);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (event.Dragging() && (m_dragMode == wxSPLIT_DRAG_DRAGGING))
|
else if (event.Dragging() && (m_dragMode == wxSPLIT_DRAG_DRAGGING))
|
||||||
{
|
{
|
||||||
@@ -387,12 +417,12 @@ bool wxSplitterWindow::SashHitTest(int x, int y, int tolerance)
|
|||||||
|
|
||||||
int wxSplitterWindow::GetSashSize() const
|
int wxSplitterWindow::GetSashSize() const
|
||||||
{
|
{
|
||||||
return wxRendererNative::Get().GetSplitterSashAndBorder(this).x;
|
return wxRendererNative::Get().GetSplitterParams(this).widthSash;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxSplitterWindow::GetBorderSize() const
|
int wxSplitterWindow::GetBorderSize() const
|
||||||
{
|
{
|
||||||
return wxRendererNative::Get().GetSplitterSashAndBorder(this).y;
|
return wxRendererNative::Get().GetSplitterParams(this).border;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the sash
|
// Draw the sash
|
||||||
@@ -419,9 +449,9 @@ void wxSplitterWindow::DrawSash(wxDC& dc)
|
|||||||
dc,
|
dc,
|
||||||
GetClientSize(),
|
GetClientSize(),
|
||||||
m_sashPosition,
|
m_sashPosition,
|
||||||
m_splitMode == wxSPLIT_VERTICAL
|
m_splitMode == wxSPLIT_VERTICAL ? wxVERTICAL
|
||||||
? wxVERTICAL
|
: wxHORIZONTAL,
|
||||||
: wxHORIZONTAL
|
m_isHot ? wxCONTROL_CURRENT : 0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -38,6 +38,12 @@
|
|||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
#endif // GTK 2.0
|
#endif // GTK 2.0
|
||||||
|
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
#define WXUNUSED_IN_GTK1(arg) arg
|
||||||
|
#else
|
||||||
|
#define WXUNUSED_IN_GTK1(arg)
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxRendererGTK: our wxRendererNative implementation
|
// wxRendererGTK: our wxRendererNative implementation
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -61,14 +67,16 @@ public:
|
|||||||
|
|
||||||
virtual void DrawSplitterBorder(wxWindow *win,
|
virtual void DrawSplitterBorder(wxWindow *win,
|
||||||
wxDC& dc,
|
wxDC& dc,
|
||||||
const wxRect& rect) ;
|
const wxRect& rect,
|
||||||
|
int flags = 0);
|
||||||
virtual void DrawSplitterSash(wxWindow *win,
|
virtual void DrawSplitterSash(wxWindow *win,
|
||||||
wxDC& dc,
|
wxDC& dc,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
wxCoord position,
|
wxCoord position,
|
||||||
wxOrientation orient);
|
wxOrientation orient,
|
||||||
|
int flags = 0);
|
||||||
|
|
||||||
virtual wxPoint GetSplitterSashAndBorder(const wxWindow *win);
|
virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win);
|
||||||
};
|
};
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -151,24 +159,42 @@ wxRendererGTK::DrawTreeItemButton(wxWindow* WXUNUSED(win),
|
|||||||
// splitter sash drawing
|
// splitter sash drawing
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// the full sash width (should be even)
|
// all this should probably be read from the current theme settings somehow?
|
||||||
static const wxCoord SASH_SIZE = 10;
|
#ifdef __WXGTK20__
|
||||||
|
// the full sash size
|
||||||
|
static const wxCoord SASH_FULL_SIZE = 5;
|
||||||
|
#else // GTK+ 1.x
|
||||||
|
// the full sash width (should be even)
|
||||||
|
static const wxCoord SASH_SIZE = 10;
|
||||||
|
|
||||||
// margin around the sash
|
// margin around the sash
|
||||||
static const wxCoord SASH_MARGIN = 5;
|
static const wxCoord SASH_MARGIN = 5;
|
||||||
|
|
||||||
wxPoint
|
// the full sash size
|
||||||
wxRendererGTK::GetSplitterSashAndBorder(const wxWindow * WXUNUSED(win))
|
static const wxCoord SASH_FULL_SIZE = SASH_SIZE + SASH_MARGIN;
|
||||||
|
#endif // GTK+ 2.x/1.x
|
||||||
|
|
||||||
|
wxSplitterRenderParams
|
||||||
|
wxRendererGTK::GetSplitterParams(const wxWindow * WXUNUSED(win))
|
||||||
{
|
{
|
||||||
// we don't draw any border, hence 0 for the second field, but we must
|
// we don't draw any border, hence 0 for the second field
|
||||||
// leave some margin around the sash
|
return wxSplitterRenderParams
|
||||||
return wxPoint(SASH_SIZE + SASH_MARGIN, 0);
|
(
|
||||||
|
SASH_FULL_SIZE,
|
||||||
|
0,
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
true // hot sensitive
|
||||||
|
#else // GTK+ 1.x
|
||||||
|
false // not
|
||||||
|
#endif // GTK+ 2.x/1.x
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wxRendererGTK::DrawSplitterBorder(wxWindow * WXUNUSED(win),
|
wxRendererGTK::DrawSplitterBorder(wxWindow * WXUNUSED(win),
|
||||||
wxDC& WXUNUSED(dc),
|
wxDC& WXUNUSED(dc),
|
||||||
const wxRect& WXUNUSED(rect))
|
const wxRect& WXUNUSED(rect),
|
||||||
|
int WXUNUSED(flags))
|
||||||
{
|
{
|
||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
@@ -178,7 +204,8 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
|
|||||||
wxDC& dc,
|
wxDC& dc,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
wxCoord position,
|
wxCoord position,
|
||||||
wxOrientation orient)
|
wxOrientation orient,
|
||||||
|
int WXUNUSED_IN_GTK1(flags))
|
||||||
{
|
{
|
||||||
if ( !win->m_wxwindow->window )
|
if ( !win->m_wxwindow->window )
|
||||||
{
|
{
|
||||||
@@ -189,26 +216,43 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
|
|||||||
// are we drawing vertical or horizontal splitter?
|
// are we drawing vertical or horizontal splitter?
|
||||||
const bool isVert = orient == wxVERTICAL;
|
const bool isVert = orient == wxVERTICAL;
|
||||||
|
|
||||||
// we must erase everything first, otherwise the garbage from the old sash
|
|
||||||
// is left when dragging it
|
|
||||||
//
|
|
||||||
// TODO: is this the right way to draw themed background?
|
|
||||||
GdkRectangle rect;
|
GdkRectangle rect;
|
||||||
if ( isVert )
|
if ( isVert )
|
||||||
{
|
{
|
||||||
rect.x = position;
|
rect.x = position;
|
||||||
rect.y = 0;
|
rect.y = 0;
|
||||||
rect.width = SASH_SIZE + SASH_MARGIN;
|
rect.width = SASH_FULL_SIZE;
|
||||||
rect.height = size.y;
|
rect.height = size.y;
|
||||||
}
|
}
|
||||||
else // horz
|
else // horz
|
||||||
{
|
{
|
||||||
rect.x = 0;
|
rect.x = 0;
|
||||||
rect.y = position;
|
rect.y = position;
|
||||||
rect.height = SASH_SIZE + SASH_MARGIN;
|
rect.height = SASH_FULL_SIZE;
|
||||||
rect.width = size.x;
|
rect.width = size.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
gtk_paint_handle
|
||||||
|
(
|
||||||
|
win->m_wxwindow->style,
|
||||||
|
GTK_PIZZA(win->m_wxwindow)->bin_window,
|
||||||
|
flags & wxCONTROL_CURRENT ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL,
|
||||||
|
GTK_SHADOW_NONE,
|
||||||
|
NULL /* no clipping */,
|
||||||
|
win->m_wxwindow,
|
||||||
|
"paned",
|
||||||
|
rect.x,
|
||||||
|
rect.y,
|
||||||
|
rect.width,
|
||||||
|
rect.height,
|
||||||
|
isVert ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL
|
||||||
|
);
|
||||||
|
#else // GTK+ 1.x
|
||||||
|
// we must erase everything first, otherwise the garbage from the old sash
|
||||||
|
// is left when dragging it
|
||||||
|
//
|
||||||
|
// TODO: is this the right way to draw themed background?
|
||||||
gtk_paint_flat_box
|
gtk_paint_flat_box
|
||||||
(
|
(
|
||||||
win->m_wxwindow->style,
|
win->m_wxwindow->style,
|
||||||
@@ -229,11 +273,7 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
|
|||||||
typedef void (*GtkPaintLineFunc)(GtkStyle *, GdkWindow *,
|
typedef void (*GtkPaintLineFunc)(GtkStyle *, GdkWindow *,
|
||||||
GtkStateType,
|
GtkStateType,
|
||||||
GdkRectangle *, GtkWidget *,
|
GdkRectangle *, GtkWidget *,
|
||||||
#ifdef __WXGTK20__
|
|
||||||
const gchar *,
|
|
||||||
#else
|
|
||||||
gchar *,
|
gchar *,
|
||||||
#endif
|
|
||||||
gint, gint, gint);
|
gint, gint, gint);
|
||||||
|
|
||||||
GtkPaintLineFunc func = isVert ? gtk_paint_vline : gtk_paint_hline;
|
GtkPaintLineFunc func = isVert ? gtk_paint_vline : gtk_paint_hline;
|
||||||
@@ -262,5 +302,6 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
|
|||||||
isVert ? size.y - 2*SASH_SIZE : position,
|
isVert ? size.y - 2*SASH_SIZE : position,
|
||||||
SASH_SIZE, SASH_SIZE
|
SASH_SIZE, SASH_SIZE
|
||||||
);
|
);
|
||||||
|
#endif // GTK+ 2.x/1.x
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -38,6 +38,12 @@
|
|||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
#endif // GTK 2.0
|
#endif // GTK 2.0
|
||||||
|
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
#define WXUNUSED_IN_GTK1(arg) arg
|
||||||
|
#else
|
||||||
|
#define WXUNUSED_IN_GTK1(arg)
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxRendererGTK: our wxRendererNative implementation
|
// wxRendererGTK: our wxRendererNative implementation
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -61,14 +67,16 @@ public:
|
|||||||
|
|
||||||
virtual void DrawSplitterBorder(wxWindow *win,
|
virtual void DrawSplitterBorder(wxWindow *win,
|
||||||
wxDC& dc,
|
wxDC& dc,
|
||||||
const wxRect& rect) ;
|
const wxRect& rect,
|
||||||
|
int flags = 0);
|
||||||
virtual void DrawSplitterSash(wxWindow *win,
|
virtual void DrawSplitterSash(wxWindow *win,
|
||||||
wxDC& dc,
|
wxDC& dc,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
wxCoord position,
|
wxCoord position,
|
||||||
wxOrientation orient);
|
wxOrientation orient,
|
||||||
|
int flags = 0);
|
||||||
|
|
||||||
virtual wxPoint GetSplitterSashAndBorder(const wxWindow *win);
|
virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win);
|
||||||
};
|
};
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -151,24 +159,42 @@ wxRendererGTK::DrawTreeItemButton(wxWindow* WXUNUSED(win),
|
|||||||
// splitter sash drawing
|
// splitter sash drawing
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// the full sash width (should be even)
|
// all this should probably be read from the current theme settings somehow?
|
||||||
static const wxCoord SASH_SIZE = 10;
|
#ifdef __WXGTK20__
|
||||||
|
// the full sash size
|
||||||
|
static const wxCoord SASH_FULL_SIZE = 5;
|
||||||
|
#else // GTK+ 1.x
|
||||||
|
// the full sash width (should be even)
|
||||||
|
static const wxCoord SASH_SIZE = 10;
|
||||||
|
|
||||||
// margin around the sash
|
// margin around the sash
|
||||||
static const wxCoord SASH_MARGIN = 5;
|
static const wxCoord SASH_MARGIN = 5;
|
||||||
|
|
||||||
wxPoint
|
// the full sash size
|
||||||
wxRendererGTK::GetSplitterSashAndBorder(const wxWindow * WXUNUSED(win))
|
static const wxCoord SASH_FULL_SIZE = SASH_SIZE + SASH_MARGIN;
|
||||||
|
#endif // GTK+ 2.x/1.x
|
||||||
|
|
||||||
|
wxSplitterRenderParams
|
||||||
|
wxRendererGTK::GetSplitterParams(const wxWindow * WXUNUSED(win))
|
||||||
{
|
{
|
||||||
// we don't draw any border, hence 0 for the second field, but we must
|
// we don't draw any border, hence 0 for the second field
|
||||||
// leave some margin around the sash
|
return wxSplitterRenderParams
|
||||||
return wxPoint(SASH_SIZE + SASH_MARGIN, 0);
|
(
|
||||||
|
SASH_FULL_SIZE,
|
||||||
|
0,
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
true // hot sensitive
|
||||||
|
#else // GTK+ 1.x
|
||||||
|
false // not
|
||||||
|
#endif // GTK+ 2.x/1.x
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wxRendererGTK::DrawSplitterBorder(wxWindow * WXUNUSED(win),
|
wxRendererGTK::DrawSplitterBorder(wxWindow * WXUNUSED(win),
|
||||||
wxDC& WXUNUSED(dc),
|
wxDC& WXUNUSED(dc),
|
||||||
const wxRect& WXUNUSED(rect))
|
const wxRect& WXUNUSED(rect),
|
||||||
|
int WXUNUSED(flags))
|
||||||
{
|
{
|
||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
@@ -178,7 +204,8 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
|
|||||||
wxDC& dc,
|
wxDC& dc,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
wxCoord position,
|
wxCoord position,
|
||||||
wxOrientation orient)
|
wxOrientation orient,
|
||||||
|
int WXUNUSED_IN_GTK1(flags))
|
||||||
{
|
{
|
||||||
if ( !win->m_wxwindow->window )
|
if ( !win->m_wxwindow->window )
|
||||||
{
|
{
|
||||||
@@ -189,26 +216,43 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
|
|||||||
// are we drawing vertical or horizontal splitter?
|
// are we drawing vertical or horizontal splitter?
|
||||||
const bool isVert = orient == wxVERTICAL;
|
const bool isVert = orient == wxVERTICAL;
|
||||||
|
|
||||||
// we must erase everything first, otherwise the garbage from the old sash
|
|
||||||
// is left when dragging it
|
|
||||||
//
|
|
||||||
// TODO: is this the right way to draw themed background?
|
|
||||||
GdkRectangle rect;
|
GdkRectangle rect;
|
||||||
if ( isVert )
|
if ( isVert )
|
||||||
{
|
{
|
||||||
rect.x = position;
|
rect.x = position;
|
||||||
rect.y = 0;
|
rect.y = 0;
|
||||||
rect.width = SASH_SIZE + SASH_MARGIN;
|
rect.width = SASH_FULL_SIZE;
|
||||||
rect.height = size.y;
|
rect.height = size.y;
|
||||||
}
|
}
|
||||||
else // horz
|
else // horz
|
||||||
{
|
{
|
||||||
rect.x = 0;
|
rect.x = 0;
|
||||||
rect.y = position;
|
rect.y = position;
|
||||||
rect.height = SASH_SIZE + SASH_MARGIN;
|
rect.height = SASH_FULL_SIZE;
|
||||||
rect.width = size.x;
|
rect.width = size.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
gtk_paint_handle
|
||||||
|
(
|
||||||
|
win->m_wxwindow->style,
|
||||||
|
GTK_PIZZA(win->m_wxwindow)->bin_window,
|
||||||
|
flags & wxCONTROL_CURRENT ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL,
|
||||||
|
GTK_SHADOW_NONE,
|
||||||
|
NULL /* no clipping */,
|
||||||
|
win->m_wxwindow,
|
||||||
|
"paned",
|
||||||
|
rect.x,
|
||||||
|
rect.y,
|
||||||
|
rect.width,
|
||||||
|
rect.height,
|
||||||
|
isVert ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL
|
||||||
|
);
|
||||||
|
#else // GTK+ 1.x
|
||||||
|
// we must erase everything first, otherwise the garbage from the old sash
|
||||||
|
// is left when dragging it
|
||||||
|
//
|
||||||
|
// TODO: is this the right way to draw themed background?
|
||||||
gtk_paint_flat_box
|
gtk_paint_flat_box
|
||||||
(
|
(
|
||||||
win->m_wxwindow->style,
|
win->m_wxwindow->style,
|
||||||
@@ -229,11 +273,7 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
|
|||||||
typedef void (*GtkPaintLineFunc)(GtkStyle *, GdkWindow *,
|
typedef void (*GtkPaintLineFunc)(GtkStyle *, GdkWindow *,
|
||||||
GtkStateType,
|
GtkStateType,
|
||||||
GdkRectangle *, GtkWidget *,
|
GdkRectangle *, GtkWidget *,
|
||||||
#ifdef __WXGTK20__
|
|
||||||
const gchar *,
|
|
||||||
#else
|
|
||||||
gchar *,
|
gchar *,
|
||||||
#endif
|
|
||||||
gint, gint, gint);
|
gint, gint, gint);
|
||||||
|
|
||||||
GtkPaintLineFunc func = isVert ? gtk_paint_vline : gtk_paint_hline;
|
GtkPaintLineFunc func = isVert ? gtk_paint_vline : gtk_paint_hline;
|
||||||
@@ -262,5 +302,6 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
|
|||||||
isVert ? size.y - 2*SASH_SIZE : position,
|
isVert ? size.y - 2*SASH_SIZE : position,
|
||||||
SASH_SIZE, SASH_SIZE
|
SASH_SIZE, SASH_SIZE
|
||||||
);
|
);
|
||||||
|
#endif // GTK+ 2.x/1.x
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -57,7 +57,8 @@ public:
|
|||||||
wxDC& dc,
|
wxDC& dc,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
wxCoord position,
|
wxCoord position,
|
||||||
wxOrientation orient);
|
wxOrientation orient,
|
||||||
|
int flags = 0);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// the tree buttons
|
// the tree buttons
|
||||||
@@ -200,7 +201,8 @@ wxRendererMac::DrawSplitterSash(wxWindow *win,
|
|||||||
wxDC& dc,
|
wxDC& dc,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
wxCoord position,
|
wxCoord position,
|
||||||
wxOrientation orient)
|
wxOrientation orient,
|
||||||
|
int WXUNUSED(flags))
|
||||||
{
|
{
|
||||||
// VZ: we have to somehow determine if we're drawing a normal sash or
|
// VZ: we have to somehow determine if we're drawing a normal sash or
|
||||||
// a brushed metal one as they look quite differently... this is
|
// a brushed metal one as they look quite differently... this is
|
||||||
|
@@ -57,7 +57,8 @@ public:
|
|||||||
wxDC& dc,
|
wxDC& dc,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
wxCoord position,
|
wxCoord position,
|
||||||
wxOrientation orient);
|
wxOrientation orient,
|
||||||
|
int flags = 0);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// the tree buttons
|
// the tree buttons
|
||||||
@@ -200,7 +201,8 @@ wxRendererMac::DrawSplitterSash(wxWindow *win,
|
|||||||
wxDC& dc,
|
wxDC& dc,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
wxCoord position,
|
wxCoord position,
|
||||||
wxOrientation orient)
|
wxOrientation orient,
|
||||||
|
int WXUNUSED(flags))
|
||||||
{
|
{
|
||||||
// VZ: we have to somehow determine if we're drawing a normal sash or
|
// VZ: we have to somehow determine if we're drawing a normal sash or
|
||||||
// a brushed metal one as they look quite differently... this is
|
// a brushed metal one as they look quite differently... this is
|
||||||
|
Reference in New Issue
Block a user