diff options
author | nyamatongwe <unknown> | 2011-05-01 15:49:17 +1000 |
---|---|---|
committer | nyamatongwe <unknown> | 2011-05-01 15:49:17 +1000 |
commit | b0ed06bc9d323e3663e5aabe0ff63eb835925afd (patch) | |
tree | a2a3c0095ba3c98202e7237071fdc7e78cacd2bf | |
parent | f9e99946dee68ea86cd499d45de15c8f93b767b8 (diff) | |
download | scintilla-mirror-b0ed06bc9d323e3663e5aabe0ff63eb835925afd.tar.gz |
Switch from SizeRequest to GTK+ 3 preferred width and height.
-rw-r--r-- | gtk/ScintillaGTK.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index a67494678..3788275c9 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -238,6 +238,8 @@ private: gint FocusOutThis(GtkWidget *widget); static gint FocusOut(GtkWidget *widget, GdkEventFocus *event); static void SizeRequest(GtkWidget *widget, GtkRequisition *requisition); + static void GetPreferredWidth(GtkWidget *widget, gint *minimalWidth, gint *naturalWidth); + static void GetPreferredHeight(GtkWidget *widget, gint *minimalHeight, gint *naturalHeight); static void SizeAllocate(GtkWidget *widget, GtkAllocation *allocation); gboolean Expose(GtkWidget *widget, GdkEventExpose *ose); static gboolean ExposeMain(GtkWidget *widget, GdkEventExpose *ose); @@ -637,6 +639,18 @@ void ScintillaGTK::SizeRequest(GtkWidget *widget, GtkRequisition *requisition) { gtk_widget_size_request(PWidget(sciThis->scrollbarv), &child_requisition); } +void ScintillaGTK::GetPreferredWidth(GtkWidget *widget, gint *minimalWidth, gint *naturalWidth) { + GtkRequisition requisition; + SizeRequest(widget, &requisition); + *minimalWidth = *naturalWidth = requisition.width; +} + +void ScintillaGTK::GetPreferredHeight(GtkWidget *widget, gint *minimalHeight, gint *naturalHeight) { + GtkRequisition requisition; + SizeRequest(widget, &requisition); + *minimalHeight = *naturalHeight = requisition.height; +} + void ScintillaGTK::SizeAllocate(GtkWidget *widget, GtkAllocation *allocation) { ScintillaGTK *sciThis = ScintillaFromWidget(widget); try { @@ -2672,7 +2686,12 @@ void ScintillaGTK::ClassInit(OBJECT_CLASS* object_class, GtkWidgetClass *widget_ // in Initialise() may require coordinate translation?) object_class->finalize = Destroy; +#if GTK_CHECK_VERSION(3,0,0) + widget_class->get_preferred_width = GetPreferredWidth; + widget_class->get_preferred_height = GetPreferredHeight; +#else widget_class->size_request = SizeRequest; +#endif widget_class->size_allocate = SizeAllocate; widget_class->expose_event = ExposeMain; widget_class->motion_notify_event = Motion; |