avoid functions deprecated in GTK3

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73013 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett
2012-11-25 03:41:42 +00:00
parent 6968a3b87c
commit 1897abe1d8
19 changed files with 207 additions and 119 deletions

View File

@@ -435,5 +435,91 @@ static inline GtkWidget* wx_gtk_tree_view_column_get_button(GtkTreeViewColumn* t
}
#define gtk_tree_view_column_get_button wx_gtk_tree_view_column_get_button
static inline GtkWidget* wx_gtk_box_new(GtkOrientation orientation, gint spacing)
{
GtkWidget* widget;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
widget = gtk_hbox_new(false, spacing);
else
widget = gtk_vbox_new(false, spacing);
return widget;
}
#define gtk_box_new wx_gtk_box_new
static inline GtkWidget* wx_gtk_button_box_new(GtkOrientation orientation)
{
GtkWidget* widget;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
widget = gtk_hbutton_box_new();
else
widget = gtk_vbutton_box_new();
return widget;
}
#define gtk_button_box_new wx_gtk_button_box_new
static inline GtkWidget* wx_gtk_scale_new(GtkOrientation orientation, GtkAdjustment* adjustment)
{
GtkWidget* widget;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
widget = gtk_hscale_new(adjustment);
else
widget = gtk_vscale_new(adjustment);
return widget;
}
#define gtk_scale_new wx_gtk_scale_new
static inline GtkWidget* wx_gtk_scrollbar_new(GtkOrientation orientation, GtkAdjustment* adjustment)
{
GtkWidget* widget;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
widget = gtk_hscrollbar_new(adjustment);
else
widget = gtk_vscrollbar_new(adjustment);
return widget;
}
#define gtk_scrollbar_new wx_gtk_scrollbar_new
static inline GtkWidget* wx_gtk_separator_new(GtkOrientation orientation)
{
GtkWidget* widget;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
widget = gtk_hseparator_new();
else
widget = gtk_vseparator_new();
return widget;
}
#define gtk_separator_new wx_gtk_separator_new
static inline void wx_gtk_widget_get_preferred_height(GtkWidget* widget, gint* minimum, gint* natural)
{
GtkRequisition req;
gtk_widget_size_request(widget, &req);
if (minimum)
*minimum = req.height;
if (natural)
*natural = req.height;
}
#define gtk_widget_get_preferred_height wx_gtk_widget_get_preferred_height
static inline void wx_gtk_widget_get_preferred_width(GtkWidget* widget, gint* minimum, gint* natural)
{
GtkRequisition req;
gtk_widget_size_request(widget, &req);
if (minimum)
*minimum = req.width;
if (natural)
*natural = req.width;
}
#define gtk_widget_get_preferred_width wx_gtk_widget_get_preferred_width
static inline void wx_gtk_widget_get_preferred_size(GtkWidget* widget, GtkRequisition* minimum, GtkRequisition* natural)
{
GtkRequisition* req = minimum;
if (req == NULL)
req = natural;
gtk_widget_size_request(widget, req);
}
#define gtk_widget_get_preferred_size wx_gtk_widget_get_preferred_size
#endif // !__WXGTK3__
#endif // _WX_GTK_PRIVATE_COMPAT_H_

View File

@@ -323,7 +323,14 @@ bool wxPopupTransientWindow::Show( bool show )
#ifdef __WXGTK__
if (!show)
{
#ifdef __WXGTK3__
GdkDisplay* display = gtk_widget_get_display(m_widget);
GdkDeviceManager* manager = gdk_display_get_device_manager(display);
GdkDevice* device = gdk_device_manager_get_client_pointer(manager);
gdk_device_ungrab(device, unsigned(GDK_CURRENT_TIME));
#else
gdk_pointer_ungrab( (guint32)GDK_CURRENT_TIME );
#endif
gtk_grab_remove( m_widget );
}
@@ -350,15 +357,25 @@ bool wxPopupTransientWindow::Show( bool show )
{
gtk_grab_add( m_widget );
gdk_pointer_grab( gtk_widget_get_window(m_widget), true,
(GdkEventMask)
(GDK_BUTTON_PRESS_MASK |
const GdkEventMask mask = GdkEventMask(
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_HINT_MASK |
GDK_POINTER_MOTION_MASK),
GDK_POINTER_MOTION_MASK);
GdkWindow* window = gtk_widget_get_window(m_widget);
#ifdef __WXGTK3__
GdkDisplay* display = gdk_window_get_display(window);
GdkDeviceManager* manager = gdk_display_get_device_manager(display);
GdkDevice* device = gdk_device_manager_get_client_pointer(manager);
gdk_device_grab(device, window,
GDK_OWNERSHIP_NONE, false, mask, NULL, unsigned(GDK_CURRENT_TIME));
#else
gdk_pointer_grab( window, true,
mask,
NULL,
NULL,
(guint32)GDK_CURRENT_TIME );
#endif
}
#endif

View File

@@ -205,7 +205,16 @@ GdkPixbuf *CreateStockIcon(const char *stockid, GtkIconSize size)
// with "stock-id" representation (in addition to pixmap and pixbuf
// ones) and would convert it to pixbuf when rendered.
GtkStyle* style = gtk_widget_get_style(wxGTKPrivate::GetButtonWidget());
GtkWidget* widget = wxGTKPrivate::GetButtonWidget();
#ifdef __WXGTK3__
GtkStyleContext* sc = gtk_widget_get_style_context(widget);
GtkIconSet* iconset = gtk_style_context_lookup_icon_set(sc, stockid);
GdkPixbuf* pixbuf = NULL;
if (iconset)
pixbuf = gtk_icon_set_render_icon_pixbuf(iconset, sc, size);
return pixbuf;
#else
GtkStyle* style = gtk_widget_get_style(widget);
GtkIconSet* iconset = gtk_style_lookup_icon_set(style, stockid);
if (!iconset)
@@ -214,6 +223,7 @@ GdkPixbuf *CreateStockIcon(const char *stockid, GtkIconSize size)
return gtk_icon_set_render_icon(iconset, style,
gtk_widget_get_default_direction(),
GTK_STATE_NORMAL, size, NULL, NULL);
#endif
}
GdkPixbuf *CreateThemeIcon(const char *iconname, int size)
@@ -309,8 +319,14 @@ wxGTK2ArtProvider::CreateIconBundle(const wxArtID& id,
const wxString stockid = wxArtIDToStock(id);
// try to load the bundle as stock icon first
GtkStyle* style = gtk_widget_get_style(wxGTKPrivate::GetButtonWidget());
GtkWidget* widget = wxGTKPrivate::GetButtonWidget();
#ifdef __WXGTK3__
GtkStyleContext* sc = gtk_widget_get_style_context(widget);
GtkIconSet* iconset = gtk_style_context_lookup_icon_set(sc, stockid.utf8_str());
#else
GtkStyle* style = gtk_widget_get_style(widget);
GtkIconSet* iconset = gtk_style_lookup_icon_set(style, stockid.utf8_str());
#endif
if ( iconset )
{
GtkIconSize *sizes;

View File

@@ -29,9 +29,6 @@
#define SOURCE_FILE_COLIDX 2
#define LINE_NUMBER_COLIDX 3
/* ----------------------------------------------------------------------------
GtkAssertDialog helpers
---------------------------------------------------------------------------- */
@@ -117,11 +114,13 @@ void gtk_assert_dialog_process_backtrace (GtkAssertDialog *dlg)
/* toggle busy cursor */
gdk_window_set_cursor (parent, NULL);
#ifdef __WXGTK3__
g_object_unref(cur);
#else
gdk_cursor_unref (cur);
#endif
}
extern "C" {
/* ----------------------------------------------------------------------------
GtkAssertDialog signal handlers
@@ -223,7 +222,6 @@ static void gtk_assert_dialog_continue_callback(GtkWidget*, GtkAssertDialog* dlg
static void gtk_assert_dialog_init (GtkAssertDialog *self);
static void gtk_assert_dialog_class_init (GtkAssertDialogClass *klass);
GType gtk_assert_dialog_get_type()
{
static GType assert_dialog_type;
@@ -263,13 +261,13 @@ static void gtk_assert_dialog_init(GtkAssertDialog* dlg)
/* start the main vbox */
gtk_widget_push_composite_child ();
vbox = gtk_vbox_new (FALSE, 8);
vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8);
gtk_container_set_border_width (GTK_CONTAINER(vbox), 8);
gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dlg))), vbox, true, true, 5);
/* add the icon+message hbox */
hbox = gtk_hbox_new (FALSE, 0);
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
/* icon */
@@ -280,7 +278,7 @@ static void gtk_assert_dialog_init(GtkAssertDialog* dlg)
GtkWidget *vbox2, *info;
/* message */
vbox2 = gtk_vbox_new (FALSE, 0);
vbox2 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
info = gtk_label_new ("An assertion failed!");
gtk_box_pack_start (GTK_BOX(vbox2), info, TRUE, TRUE, 8);
@@ -306,7 +304,7 @@ static void gtk_assert_dialog_init(GtkAssertDialog* dlg)
GtkWidget *hbox, *vbox, *button, *sw;
/* create expander's vbox */
vbox = gtk_vbox_new (FALSE, 0);
vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (dlg->expander), vbox);
/* add a scrollable window under the expander */
@@ -322,7 +320,7 @@ static void gtk_assert_dialog_init(GtkAssertDialog* dlg)
gtk_container_add (GTK_CONTAINER (sw), dlg->treeview);
/* create button's hbox */
hbox = gtk_hbutton_box_new ();
hbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
gtk_box_pack_end (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
gtk_button_box_set_layout (GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END);
@@ -361,8 +359,6 @@ static void gtk_assert_dialog_init(GtkAssertDialog* dlg)
gtk_widget_show_all (GTK_WIDGET(dlg));
}
/* ----------------------------------------------------------------------------
GtkAssertDialog public API
---------------------------------------------------------------------------- */

View File

@@ -171,17 +171,12 @@ wxSize wxButtonBase::GetDefaultSize()
// button's size. We have to retrieve both values and combine them.
GtkWidget *wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL);
GtkWidget *box = gtk_hbutton_box_new();
GtkWidget *box = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
GtkWidget *btn = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
gtk_container_add(GTK_CONTAINER(box), btn);
gtk_container_add(GTK_CONTAINER(wnd), box);
GtkRequisition req;
#ifdef __WXGTK3__
gtk_widget_get_preferred_height(btn, NULL, &req.height);
gtk_widget_get_preferred_width_for_height(btn, req.height, NULL, &req.width);
#else
gtk_widget_size_request(btn, &req);
#endif
gtk_widget_get_preferred_size(btn, NULL, &req);
gint minwidth, minheight;
gtk_widget_style_get(box,

View File

@@ -120,7 +120,7 @@ bool wxCheckBox::Create(wxWindow *parent,
m_widgetLabel = gtk_label_new("");
gtk_misc_set_alignment(GTK_MISC(m_widgetLabel), 0.0, 0.5);
m_widget = gtk_hbox_new(FALSE, 0);
m_widget = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start(GTK_BOX(m_widget), m_widgetLabel, FALSE, FALSE, 3);
gtk_box_pack_start(GTK_BOX(m_widget), m_widgetCheckbox, FALSE, FALSE, 3);

View File

@@ -324,7 +324,6 @@ int wxChoice::GetColumns() const
return intval;
}
void wxChoice::GTKDisableEvents()
{
g_signal_handlers_block_by_func(m_widget,
@@ -337,7 +336,6 @@ void wxChoice::GTKEnableEvents()
(gpointer) gtk_choice_changed_callback, this);
}
GdkWindow *wxChoice::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const
{
return gtk_widget_get_window(m_widget);
@@ -366,7 +364,7 @@ wxSize wxChoice::DoGetSizeFromTextSize(int xlen, int ylen) const
// We are interested in the difference of sizes between the whole contol
// and its child part. I.e. arrow, separators, etc.
GtkRequisition req;
gtk_widget_size_request(childPart, &req);
gtk_widget_get_preferred_size(childPart, NULL, &req);
wxSize totalS = GTKGetPreferredSize(m_widget);
wxSize tsize(xlen + totalS.x - req.width, totalS.y);
@@ -388,7 +386,6 @@ void wxChoice::DoApplyWidgetStyle(GtkRcStyle *style)
GTKApplyStyle(gtk_bin_get_child(GTK_BIN(m_widget)), style);
}
// static
wxVisualAttributes
wxChoice::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
@@ -396,5 +393,4 @@ wxChoice::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
return GetDefaultAttributesFromGTKWidget(gtk_combo_box_new());
}
#endif // wxUSE_CHOICE || wxUSE_COMBOBOX

View File

@@ -223,8 +223,7 @@ wxSize wxCollapsiblePane::DoGetBestSize() const
GtkRequisition req;
#ifdef __WXGTK3__
gtk_widget_get_preferred_width(m_widget, NULL, &req.width);
gtk_widget_get_preferred_height_for_width(m_widget, req.width, NULL, &req.height);
gtk_widget_get_preferred_size(m_widget, NULL, &req);
#else
GTK_WIDGET_GET_CLASS(m_widget)->size_request(m_widget, &req);
#endif

View File

@@ -317,16 +317,7 @@ wxSize wxControl::GTKGetPreferredSize(GtkWidget* widget) const
{
GtkRequisition req;
#ifdef __WXGTK3__
if (gtk_widget_get_request_mode(widget) != GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
{
gtk_widget_get_preferred_height(widget, NULL, &req.height);
gtk_widget_get_preferred_width_for_height(widget, req.height, NULL, &req.width);
}
else
{
gtk_widget_get_preferred_width(widget, NULL, &req.width);
gtk_widget_get_preferred_height_for_width(widget, req.width, NULL, &req.height);
}
gtk_widget_get_preferred_size(widget, NULL, &req);
#else
GTK_WIDGET_GET_CLASS(widget)->size_request(widget, &req);
#endif

View File

@@ -1705,8 +1705,11 @@ bool wxGtkDataViewModelNotifier::ValueChanged( const wxDataViewItem &item, unsig
GTK_TREE_MODEL(wxgtk_model), &iter ));
GdkRectangle cell_area;
gtk_tree_view_get_cell_area( widget, path, gcolumn, &cell_area );
#ifdef __WXGTK3__
GtkAdjustment* hadjust = gtk_scrollable_get_hadjustment(GTK_SCROLLABLE(widget));
#else
GtkAdjustment* hadjust = gtk_tree_view_get_hadjustment( widget );
#endif
double d = gtk_adjustment_get_value( hadjust );
int xdiff = (int) d;
@@ -2987,7 +2990,7 @@ void wxDataViewColumn::Init(wxAlignment align, int flags, int width)
SetWidth( width );
// Create container for icon and label
GtkWidget *box = gtk_hbox_new( FALSE, 1 );
GtkWidget* box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1);
gtk_widget_show( box );
// gtk_container_set_border_width((GtkContainer*)box, 2);
m_image = gtk_image_new();
@@ -4353,7 +4356,7 @@ void gtk_dataviewctrl_size_callback( GtkWidget *WXUNUSED(widget),
wxWindow *child = node->GetData();
GtkRequisition req;
gtk_widget_size_request( child->m_widget, &req );
gtk_widget_get_preferred_size(child->m_widget, NULL, &req);
GtkAllocation alloc;
alloc.x = child->m_x;
@@ -4376,14 +4379,15 @@ gtk_dataview_motion_notify_callback( GtkWidget *WXUNUSED(widget),
GdkEventMotion *gdk_event,
wxDataViewCtrl *dv )
{
int x = gdk_event->x;
int y = gdk_event->y;
if (gdk_event->is_hint)
{
int x = 0;
int y = 0;
GdkModifierType state;
gdk_window_get_pointer(gdk_event->window, &x, &y, &state);
gdk_event->x = x;
gdk_event->y = y;
#ifdef __WXGTK3__
gdk_window_get_device_position(gdk_event->window, gdk_event->device, &x, &y, NULL);
#else
gdk_window_get_pointer(gdk_event->window, &x, &y, NULL);
#endif
}
wxGtkTreePath path;
@@ -4392,7 +4396,7 @@ gtk_dataview_motion_notify_callback( GtkWidget *WXUNUSED(widget),
gint cell_y = 0;
if (gtk_tree_view_get_path_at_pos(
GTK_TREE_VIEW(dv->GtkGetTreeView()),
(int) gdk_event->x, (int) gdk_event->y,
x, y,
path.ByRef(),
&column,
&cell_x,

View File

@@ -19,6 +19,7 @@
#endif // WX_PRECOMP
#include <gtk/gtk.h>
#include "wx/gtk/private/gtk2-compat.h"
#if wxUSE_LIBHILDON
#include <hildon-widgets/hildon-window.h>
@@ -79,10 +80,10 @@ void wxFrame::DoGetClientSize( int *width, int *height ) const
// menu bar
if (m_frameMenuBar && m_frameMenuBar->IsShown())
{
GtkRequisition req;
gtk_widget_size_request(m_frameMenuBar->m_widget, &req);
int h;
gtk_widget_get_preferred_height(m_frameMenuBar->m_widget, NULL, &h);
#if !wxUSE_LIBHILDON && !wxUSE_LIBHILDON2
*height -= req.height;
*height -= h;
#endif
}
#endif // wxUSE_MENUS_NATIVE
@@ -98,17 +99,23 @@ void wxFrame::DoGetClientSize( int *width, int *height ) const
// tool bar
if (m_frameToolBar && m_frameToolBar->IsShown())
{
GtkRequisition req;
gtk_widget_size_request(m_frameToolBar->m_widget, &req);
if (m_frameToolBar->IsVertical())
{
if (width)
*width -= req.width;
{
int w;
gtk_widget_get_preferred_width(m_frameToolBar->m_widget, NULL, &w);
*width -= w;
}
}
else
{
if (height)
*height -= req.height;
{
int h;
gtk_widget_get_preferred_height(m_frameToolBar->m_widget, NULL, &h);
*height -= h;
}
}
}
#endif // wxUSE_TOOLBAR
@@ -323,11 +330,11 @@ void wxFrame::SetToolBar(wxToolBar *toolbar)
// Vertical toolbar and m_wxwindow go into an hbox, inside the
// vbox (m_mainWidget). hbox is created on demand.
GtkWidget* hbox = gtk_widget_get_parent(m_wxwindow);
if (!GTK_IS_HBOX(hbox))
if (hbox == m_mainWidget)
{
hbox = gtk_hbox_new(false, 0);
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_show(hbox);
gtk_container_add(GTK_CONTAINER(m_mainWidget), hbox);
gtk_box_pack_start(GTK_BOX(m_mainWidget), hbox, true, true, 0);
gtk_widget_reparent(m_wxwindow, hbox);
}
gtk_widget_reparent(toolbar->m_widget, hbox);

View File

@@ -36,7 +36,7 @@
#include "wx/gtk/treeentry_gtk.h"
#include <gdk/gdkkeysyms.h>
#if GTK_CHECK_VERSION(3,0,0)
#ifdef __WXGTK3__
#include <gdk/gdkkeysyms-compat.h>
#endif
@@ -781,7 +781,7 @@ void wxListBox::DoScrollToCell(int n, float alignY, float alignX)
wxCHECK_RET( IsValid(n), wxT("invalid index"));
//RN: I have no idea why this line is needed...
if (gdk_pointer_is_grabbed () && gtk_widget_has_grab(GTK_WIDGET(m_treeview)))
if (gtk_widget_has_grab(GTK_WIDGET(m_treeview)))
return;
GtkTreeIter iter;

View File

@@ -200,7 +200,7 @@ void wxMDIParentFrame::DoGetClientSize(int* width, int* height) const
if (menubar && menubar->IsShown())
{
GtkRequisition req;
gtk_widget_size_request(menubar->m_widget, &req);
gtk_widget_get_preferred_height(menubar->m_widget, NULL, &req.height);
*height -= req.height;
if (*height < 0) *height = 0;
}

View File

@@ -314,7 +314,7 @@ wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) const
for ( size_t n = 0; n < pageCount; n++ )
{
GtkRequisition req;
gtk_widget_size_request(GetNotebookPage(n)->m_box, &req);
gtk_widget_get_preferred_size(GetNotebookPage(n)->m_box, NULL, &req);
sizeTabMax.IncTo(wxSize(req.width, req.height));
}
@@ -429,7 +429,7 @@ bool wxNotebook::InsertPage( size_t position,
// first page.
pageData->m_imageIndex = imageId;
pageData->m_box = gtk_hbox_new(false, 1);
pageData->m_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1);
gtk_container_set_border_width(GTK_CONTAINER(pageData->m_box), 2);
pageData->m_image = NULL;
@@ -503,7 +503,7 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const
const size_t count = GetPageCount();
size_t i = 0;
#if !GTK_CHECK_VERSION(3,0,0) && !defined(GSEAL_ENABLE)
#ifndef __WXGTK3__
GtkNotebook * notebook = GTK_NOTEBOOK(m_widget);
if (gtk_notebook_get_scrollable(notebook))
i = g_list_position( notebook->children, notebook->first_tab );

View File

@@ -138,10 +138,7 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
}
const bool isVertical = (style & wxSB_VERTICAL) != 0;
if (isVertical)
m_widget = gtk_vscrollbar_new( NULL );
else
m_widget = gtk_hscrollbar_new( NULL );
m_widget = gtk_scrollbar_new(GtkOrientation(isVertical), NULL);
g_object_ref(m_widget);
m_scrollBar[0] = (GtkRange*)m_widget;
@@ -235,7 +232,7 @@ void wxScrollBar::SetRange(int range)
wxVisualAttributes
wxScrollBar::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
{
return GetDefaultAttributesFromGTKWidget(gtk_vscrollbar_new(NULL));
return GetDefaultAttributesFromGTKWidget(gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, NULL));
}
#endif // wxUSE_SCROLLBAR

View File

@@ -307,45 +307,32 @@ bool wxSlider::Create(wxWindow *parent,
return false;
}
if (style & wxSL_VERTICAL)
m_scale = gtk_vscale_new( NULL );
else
m_scale = gtk_hscale_new( NULL );
const bool isVertical = (style & wxSL_VERTICAL) != 0;
m_scale = gtk_scale_new(GtkOrientation(isVertical), NULL);
if (style & wxSL_MIN_MAX_LABELS)
{
gtk_widget_show( m_scale );
if (style & wxSL_VERTICAL)
m_widget = gtk_hbox_new(false, 0);
else
m_widget = gtk_vbox_new(false, 0);
gtk_container_add( GTK_CONTAINER(m_widget), m_scale );
m_widget = gtk_box_new(GtkOrientation(!isVertical), 0);
gtk_box_pack_start(GTK_BOX(m_widget), m_scale, true, true, 0);
GtkWidget *box;
if (style & wxSL_VERTICAL)
box = gtk_vbox_new(false,0);
else
box = gtk_hbox_new(false,0);
GtkWidget* box = gtk_box_new(GtkOrientation(isVertical), 0);
gtk_widget_show(box);
gtk_container_add( GTK_CONTAINER(m_widget), box );
gtk_box_pack_start(GTK_BOX(m_widget), box, true, true, 0);
m_minLabel = gtk_label_new(NULL);
gtk_widget_show( m_minLabel );
gtk_container_add( GTK_CONTAINER(box), m_minLabel );
gtk_box_set_child_packing( GTK_BOX(box), m_minLabel, FALSE, FALSE, 0, GTK_PACK_START );
gtk_box_pack_start(GTK_BOX(box), m_minLabel, false, false, 0);
// expanding empty space between the min/max labels
GtkWidget *space = gtk_label_new(NULL);
gtk_widget_show( space );
gtk_container_add( GTK_CONTAINER(box), space );
gtk_box_set_child_packing( GTK_BOX(box), space, TRUE, FALSE, 0, GTK_PACK_START );
gtk_box_pack_start(GTK_BOX(box), space, true, false, 0);
m_maxLabel = gtk_label_new(NULL);
gtk_widget_show( m_maxLabel );
gtk_container_add( GTK_CONTAINER(box), m_maxLabel );
gtk_box_set_child_packing( GTK_BOX(box), m_maxLabel, FALSE, FALSE, 0, GTK_PACK_END );
gtk_box_pack_end(GTK_BOX(box), m_maxLabel, false, false, 0);
}
else
{
@@ -533,7 +520,7 @@ GdkWindow *wxSlider::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const
wxVisualAttributes
wxSlider::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
{
return GetDefaultAttributesFromGTKWidget(gtk_vscale_new(NULL));
return GetDefaultAttributesFromGTKWidget(gtk_scale_new(GTK_ORIENTATION_VERTICAL, NULL));
}
#endif // wxUSE_SLIDER

View File

@@ -14,8 +14,8 @@
#if wxUSE_STATLINE
#include "gdk/gdk.h"
#include "gtk/gtk.h"
#include <gtk/gtk.h>
#include "wx/gtk/private/gtk2-compat.h"
//-----------------------------------------------------------------------------
// wxStaticLine
@@ -43,9 +43,11 @@ bool wxStaticLine::Create( wxWindow *parent, wxWindowID id,
return FALSE;
}
if ( IsVertical() )
const bool isVertical = IsVertical();
m_widget = gtk_separator_new(GtkOrientation(isVertical));
g_object_ref(m_widget);
if (isVertical)
{
m_widget = gtk_vseparator_new();
if (size.x == -1)
{
wxSize new_size( size );
@@ -55,7 +57,6 @@ bool wxStaticLine::Create( wxWindow *parent, wxWindowID id,
}
else
{
m_widget = gtk_hseparator_new();
if (size.y == -1)
{
wxSize new_size( size );
@@ -63,7 +64,6 @@ bool wxStaticLine::Create( wxWindow *parent, wxWindowID id,
SetSize( new_size );
}
}
g_object_ref(m_widget);
m_parent->DoAddChild( this );
@@ -76,7 +76,7 @@ bool wxStaticLine::Create( wxWindow *parent, wxWindowID id,
wxVisualAttributes
wxStaticLine::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
{
return GetDefaultAttributesFromGTKWidget(gtk_vseparator_new());
return GetDefaultAttributesFromGTKWidget(gtk_separator_new(GTK_ORIENTATION_VERTICAL));
}
#endif

View File

@@ -271,18 +271,15 @@ void wxToolBarTool::SetImage()
void wxToolBarTool::CreateDropDown()
{
gtk_tool_item_set_homogeneous(m_item, false);
GtkWidget* box;
GtkWidget* arrow;
GtkOrientation orient = GTK_ORIENTATION_HORIZONTAL;
GtkArrowType arrowType = GTK_ARROW_DOWN;
if (GetToolBar()->HasFlag(wxTB_LEFT | wxTB_RIGHT))
{
box = gtk_vbox_new(false, 0);
arrow = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_NONE);
}
else
{
box = gtk_hbox_new(false, 0);
arrow = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE);
orient = GTK_ORIENTATION_VERTICAL;
arrowType = GTK_ARROW_RIGHT;
}
GtkWidget* box = gtk_box_new(orient, 0);
GtkWidget* arrow = gtk_arrow_new(arrowType, GTK_SHADOW_NONE);
GtkWidget* tool_button = gtk_bin_get_child(GTK_BIN(m_item));
gtk_widget_reparent(tool_button, box);
GtkWidget* arrow_button = gtk_toggle_button_new();

View File

@@ -598,7 +598,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
G_CALLBACK (gtk_frame_delete_callback), this);
// m_mainWidget is a GtkVBox, holding the bars and client area (m_wxwindow)
m_mainWidget = gtk_vbox_new(false, 0);
m_mainWidget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_show( m_mainWidget );
gtk_widget_set_can_focus(m_mainWidget, false);
gtk_container_add( GTK_CONTAINER(m_widget), m_mainWidget );
@@ -606,7 +606,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
// m_wxwindow is the client area
m_wxwindow = wxPizza::New();
gtk_widget_show( m_wxwindow );
gtk_container_add( GTK_CONTAINER(m_mainWidget), m_wxwindow );
gtk_box_pack_start(GTK_BOX(m_mainWidget), m_wxwindow, true, true, 0);
// we donm't allow the frame to get the focus as otherwise
// the frame will grab it at arbitrary focus changes