aboutsummaryrefslogtreecommitdiffhomepage
path: root/gtk/PlatGTK.cxx
diff options
context:
space:
mode:
authornyamatongwe <unknown>2011-05-01 14:44:14 +1000
committernyamatongwe <unknown>2011-05-01 14:44:14 +1000
commit2751da9c2498e62517aa68152207b57d1bb855bd (patch)
treea41004c8a7da8147f0074955530cc23a6a3122bc /gtk/PlatGTK.cxx
parent83604f7e2606b5e8da617153f830c8cc3a92b36c (diff)
downloadscintilla-mirror-2751da9c2498e62517aa68152207b57d1bb855bd.tar.gz
Use accessor function for allocation and style for GTK+ 3.
Diffstat (limited to 'gtk/PlatGTK.cxx')
-rw-r--r--gtk/PlatGTK.cxx24
1 files changed, 19 insertions, 5 deletions
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx
index a89b1e4f5..0a7806f19 100644
--- a/gtk/PlatGTK.cxx
+++ b/gtk/PlatGTK.cxx
@@ -2023,11 +2023,17 @@ PRectangle Window::GetPosition() {
// Before any size allocated pretend its 1000 wide so not scrolled
PRectangle rc(0, 0, 1000, 1000);
if (wid) {
- rc.left = PWidget(wid)->allocation.x;
- rc.top = PWidget(wid)->allocation.y;
- if (PWidget(wid)->allocation.width > 20) {
- rc.right = rc.left + PWidget(wid)->allocation.width;
- rc.bottom = rc.top + PWidget(wid)->allocation.height;
+ GtkAllocation allocation;
+#if GTK_CHECK_VERSION(3,0,0)
+ gtk_widget_get_allocation(PWidget(wid), &allocation);
+#else
+ allocation = PWidget(wid)->allocation;
+#endif
+ rc.left = allocation.x;
+ rc.top = allocation.y;
+ if (allocation.width > 20) {
+ rc.right = rc.left + allocation.width;
+ rc.bottom = rc.top + allocation.height;
}
}
return rc;
@@ -2378,10 +2384,18 @@ PRectangle ListBoxX::GetDesiredRect() {
gtk_tree_view_get_column(GTK_TREE_VIEW(list), 0);
gtk_tree_view_column_cell_get_size(column, NULL,
NULL, NULL, &row_width, &row_height);
+#if GTK_CHECK_VERSION(3,0,0)
+ GtkStyle *styleList = gtk_widget_get_style(PWidget(list));
+ int ythickness = styleList->ythickness;
+ height = (rows * row_height
+ + 2 * (ythickness
+ + gtk_container_get_border_width(GTK_CONTAINER(PWidget(list))) + 1));
+#else
int ythickness = PWidget(list)->style->ythickness;
height = (rows * row_height
+ 2 * (ythickness
+ GTK_CONTAINER(PWidget(list))->border_width + 1));
+#endif
gtk_widget_set_size_request(GTK_WIDGET(PWidget(list)), -1, height);
// Get the size of the scroller because we set usize on the window