Correct orientation of splitter sash again.

Query splitter sash size at runtime.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32771 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 2005-03-12 12:24:10 +00:00
parent 8fbc991227
commit 384188277d
2 changed files with 52 additions and 30 deletions

View File

@ -215,28 +215,37 @@ wxRendererGTK::DrawTreeItemButton(wxWindow* win,
// splitter sash drawing
// ----------------------------------------------------------------------------
// all this should probably be read from the current theme settings somehow?
#ifdef __WXGTK20__
// the full sash size
static const wxCoord SASH_FULL_SIZE = 5;
#else // GTK+ 1.x
#ifndef __WXGTK20__
// the full sash width (should be even)
static const wxCoord SASH_SIZE = 8;
// margin around the sash
static const wxCoord SASH_MARGIN = 2;
// the full sash size
static const wxCoord SASH_FULL_SIZE = SASH_SIZE + SASH_MARGIN;
#endif // GTK+ 2.x/1.x
static int GetGtkSplitterFullSize()
{
#ifdef __WXGTK20__
static GtkWidget *s_paned = NULL;
if (s_paned == NULL)
s_paned = gtk_vpaned_new();
gint handle_size;
gtk_widget_style_get (s_paned, "handle_size", &handle_size, NULL);
return handle_size;
#else
return SASH_SIZE + SASH_MARGIN;
#endif
}
wxSplitterRenderParams
wxRendererGTK::GetSplitterParams(const wxWindow * WXUNUSED(win))
wxRendererGTK::GetSplitterParams(const wxWindow *WXUNUSED(win))
{
// we don't draw any border, hence 0 for the second field
return wxSplitterRenderParams
(
SASH_FULL_SIZE,
GetGtkSplitterFullSize(),
0,
#ifdef __WXGTK20__
true // hot sensitive
@ -269,6 +278,8 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
return;
}
wxCoord full_size = GetGtkSplitterFullSize();
// are we drawing vertical or horizontal splitter?
const bool isVert = orient == wxVERTICAL;
@ -280,12 +291,12 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
rect.x = position;
rect.y = 0;
rect.width = SASH_FULL_SIZE;
rect.width = full_size;
rect.height = h;
erase_rect.x = position;
erase_rect.y = 0;
erase_rect.width = SASH_FULL_SIZE;
erase_rect.width = full_size;
erase_rect.height = h;
}
else // horz
@ -294,12 +305,12 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
rect.x = 0;
rect.y = position;
rect.height = SASH_FULL_SIZE;
rect.height = full_size;
rect.width = w;
erase_rect.y = position;
erase_rect.x = 0;
erase_rect.height = SASH_FULL_SIZE;
erase_rect.height = full_size;
erase_rect.width = w;
}
@ -340,7 +351,7 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
rect.y,
rect.width,
rect.height,
!isVert ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL
isVert ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL
);
#else // GTK+ 1.x

View File

@ -215,28 +215,37 @@ wxRendererGTK::DrawTreeItemButton(wxWindow* win,
// splitter sash drawing
// ----------------------------------------------------------------------------
// all this should probably be read from the current theme settings somehow?
#ifdef __WXGTK20__
// the full sash size
static const wxCoord SASH_FULL_SIZE = 5;
#else // GTK+ 1.x
#ifndef __WXGTK20__
// the full sash width (should be even)
static const wxCoord SASH_SIZE = 8;
// margin around the sash
static const wxCoord SASH_MARGIN = 2;
// the full sash size
static const wxCoord SASH_FULL_SIZE = SASH_SIZE + SASH_MARGIN;
#endif // GTK+ 2.x/1.x
static int GetGtkSplitterFullSize()
{
#ifdef __WXGTK20__
static GtkWidget *s_paned = NULL;
if (s_paned == NULL)
s_paned = gtk_vpaned_new();
gint handle_size;
gtk_widget_style_get (s_paned, "handle_size", &handle_size, NULL);
return handle_size;
#else
return SASH_SIZE + SASH_MARGIN;
#endif
}
wxSplitterRenderParams
wxRendererGTK::GetSplitterParams(const wxWindow * WXUNUSED(win))
wxRendererGTK::GetSplitterParams(const wxWindow *WXUNUSED(win))
{
// we don't draw any border, hence 0 for the second field
return wxSplitterRenderParams
(
SASH_FULL_SIZE,
GetGtkSplitterFullSize(),
0,
#ifdef __WXGTK20__
true // hot sensitive
@ -269,6 +278,8 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
return;
}
wxCoord full_size = GetGtkSplitterFullSize();
// are we drawing vertical or horizontal splitter?
const bool isVert = orient == wxVERTICAL;
@ -280,12 +291,12 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
rect.x = position;
rect.y = 0;
rect.width = SASH_FULL_SIZE;
rect.width = full_size;
rect.height = h;
erase_rect.x = position;
erase_rect.y = 0;
erase_rect.width = SASH_FULL_SIZE;
erase_rect.width = full_size;
erase_rect.height = h;
}
else // horz
@ -294,12 +305,12 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
rect.x = 0;
rect.y = position;
rect.height = SASH_FULL_SIZE;
rect.height = full_size;
rect.width = w;
erase_rect.y = position;
erase_rect.x = 0;
erase_rect.height = SASH_FULL_SIZE;
erase_rect.height = full_size;
erase_rect.width = w;
}
@ -340,7 +351,7 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
rect.y,
rect.width,
rect.height,
!isVert ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL
isVert ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL
);
#else // GTK+ 1.x