[gtkmm-documentation] Fix the make check build with gtkmm from git master.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm-documentation] Fix the make check build with gtkmm from git master.
- Date: Tue, 21 Sep 2010 09:44:31 +0000 (UTC)
commit 5e2620e0650d10db244eb45f41e253bdf51e65c4
Author: Murray Cumming <murrayc murrayc com>
Date: Tue Sep 21 11:44:24 2010 +0200
Fix the make check build with gtkmm from git master.
* examples/Makefile.am: Disable examples/others/gdk/radar because it is
just an example of GDK drawing, but people should use cairo now.
We might bring it back as a cairo widget example later.
Temporarily disable examples/others/window/wheelbarrow because it needs a function that is
not yet in GTK+ 3.
* examples/book/progressbar/examplewindow.[h|cc]: Use set_inverted()
instead of set_orientation(), matching the change in the C test code.
* examples/others/cellrenderercustom/cellrendererpopup.[h|cc]:
* examples/others/cellrenderercustom/cellrenderertoggle.cc:
* examples/others/cellrenderercustom/popupentry.cc:
Replace use of CellRenderer::get_size() with CellSizeRequest::get_size(),
though we should probably do more to really support natural-size.
* examples/book/custom/custom_container/mycontainer.cc:
Replace use of Widget::size_allocate() with SizeRequest::get_size()
though we should probably do more to really support natural-size.
* examples/others/dnd/dndwindow.[h|cc]: Replace use of Gdk::Pixmap with
Gdk::Pixbuf.
ChangeLog | 33 ++-
examples/Makefile.am | 5 +-
.../book/custom/custom_container/mycontainer.cc | 15 +-
examples/book/progressbar/examplewindow.cc | 20 +-
examples/book/progressbar/examplewindow.h | 2 +-
.../others/cellrenderercustom/cellrendererpopup.cc | 18 +-
.../others/cellrenderercustom/cellrendererpopup.h | 7 +-
.../cellrenderercustom/cellrenderertoggle.cc | 20 +-
examples/others/cellrenderercustom/popupentry.cc | 13 +-
examples/others/dnd/dndwindow.cc | 19 +-
examples/others/dnd/dndwindow.h | 13 +-
examples/others/gdk/radar.cc | 371 --------------------
examples/others/window/wheelbarrow.cc | 14 +-
13 files changed, 101 insertions(+), 449 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b5489dc..18a9912 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2010-09-21 Murray Cumming <murrayc murrayc com>
+
+ Fix the make check build with gtkmm from git master.
+
+ * examples/Makefile.am: Disable examples/others/gdk/radar because it is
+ just an example of GDK drawing, but people should use cairo now.
+ We might bring it back as a cairo widget example later.
+ Temporarily disable examples/others/window/wheelbarrow because it needs a function that is
+ not yet in GTK+ 3.
+
+ * examples/book/progressbar/examplewindow.[h|cc]: Use set_inverted()
+ instead of set_orientation(), matching the change in the C test code.
+ * examples/others/cellrenderercustom/cellrendererpopup.[h|cc]:
+ * examples/others/cellrenderercustom/cellrenderertoggle.cc:
+ * examples/others/cellrenderercustom/popupentry.cc:
+ Replace use of CellRenderer::get_size() with CellSizeRequest::get_size(),
+ though we should probably do more to really support natural-size.
+ * examples/book/custom/custom_container/mycontainer.cc:
+ Replace use of Widget::size_allocate() with SizeRequest::get_size()
+ though we should probably do more to really support natural-size.
+ * examples/others/dnd/dndwindow.[h|cc]: Replace use of Gdk::Pixmap with
+ Gdk::Pixbuf.
+
2010-09-15 Murray Cumming <murrayc murrayc com>
Replace use of ALIGN_LEFT/RIGHT/TOP/BOTTOM with START/END.
@@ -5,7 +28,7 @@
* examples/book/alignment/examplewindow.cc:
* examples/book/box/examplewindow.cc:
* examples/book/frame/examplewindow.cc:
- * examples/book/spinbutton/examplewindow.cc: Use only the non-deprecated
+ * examples/book/spinbutton/examplewindow.cc: Use only the non-deprecated
enum values.
2010-07-27 Murray Cumming <murrayc murrayc com>
@@ -24,21 +47,21 @@
* examples/others/stock/stock.cc:
* examples/others/treemodelcustom/exampletreemodel.[h|cc]:
Replace use of MenuList and NotebookPage.
-
+
This is the master branch. See also the gtkmm-2-22 branch.
2010-07-21 Murray Cumming <murrayc murrayc com>
Buttons chapter: Remove text about non-existant XPMLabelBox class.
- * docs/tutorial/C/gtkmm-tutorial-in.xml: The mention of an XPMLabelBox
+ * docs/tutorial/C/gtkmm-tutorial-in.xml: The mention of an XPMLabelBox
was very odd and probably about a very very old version of the API.
2010-07-16 Murray Cumming <murrayc murrayc com>
Fix the build with latest gtkmm-2.22 with --enable-warnings=fatal.
-
- Generally include gtkmm/box.h before other gtkmm headers and include
+
+ Generally include gtkmm/box.h before other gtkmm headers and include
gtkmm/main.h after other gtkmm headers. Not pleasant.
2010-06-01 Murray Cumming <murrayc murrayc com>
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 7be786a..5aa6eed 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -103,14 +103,13 @@ check_PROGRAMS = \
others/cellrenderercustom/testpopup \
others/dnd/testdnd \
others/exception/exceptiontest \
- others/gdk/radar \
others/idle/idle \
others/rulers/rulers \
others/statusbar/statusbar \
others/stock/stock \
others/tictactoe/ttt_test \
- others/treemodelcustom/example \
- others/window/wheelbarrow
+ others/treemodelcustom/example
+#Waiting for a gdk_cairo_region_from_surface(): others/window/wheelbarrow
dist_noinst_DATA = \
README \
diff --git a/examples/book/custom/custom_container/mycontainer.cc b/examples/book/custom/custom_container/mycontainer.cc
index 4a8e461..a9f85a4 100644
--- a/examples/book/custom/custom_container/mycontainer.cc
+++ b/examples/book/custom/custom_container/mycontainer.cc
@@ -52,10 +52,18 @@ void MyContainer::on_size_request(Gtk::Requisition* requisition)
Gtk::Requisition child_requisition_one = {0, 0};
Gtk::Requisition child_requisition_two = {0, 0};
if(m_child_one && m_child_one->get_visible())
- child_requisition_one = m_child_one->size_request();
+ {
+ //TODO: Support natural-size properly:
+ Gtk::Requisition child_requisition_one_natural;
+ m_child_one->get_size(child_requisition_one, child_requisition_one_natural);
+ }
if(m_child_two && m_child_two->get_visible())
- child_requisition_two = m_child_two->size_request();
+ {
+ //TODO: Support natural-size properly:
+ Gtk::Requisition child_requisition_two_natural;
+ m_child_two->get_size(child_requisition_two, child_requisition_two_natural);
+ }
//See which one has the most width:
int max_width = MAX(child_requisition_one.width,
@@ -83,7 +91,7 @@ void MyContainer::on_size_allocate(Gtk::Allocation& allocation)
//Assign sign space to the child:
Gtk::Allocation child_allocation_one, child_allocation_two;
- //Place the first child at the top-left,
+ //Place the first child at the top-left,
child_allocation_one.set_x( allocation.get_x() );
child_allocation_one.set_y( allocation.get_y() );
@@ -176,4 +184,3 @@ GType MyContainer::child_type_vfunc() const
return G_TYPE_NONE;
}
}
-
diff --git a/examples/book/progressbar/examplewindow.cc b/examples/book/progressbar/examplewindow.cc
index 39bcbe0..e8e1025 100644
--- a/examples/book/progressbar/examplewindow.cc
+++ b/examples/book/progressbar/examplewindow.cc
@@ -25,7 +25,7 @@ ExampleWindow::ExampleWindow()
m_Table(2, 2, true),
m_CheckButton_Text("Show text"),
m_CheckButton_Activity("Activity mode"),
- m_CheckButton_Orientation("Right to Left"),
+ m_CheckButton_Inverted("Right to Left"),
m_Button_Close("Close"),
m_bActivityMode(false)
{
@@ -58,9 +58,9 @@ ExampleWindow::ExampleWindow()
&ExampleWindow::on_checkbutton_activity) );
//Add a check button to toggle activity mode:
- m_Table.attach(m_CheckButton_Orientation, 0, 1, 2, 3, Gtk::EXPAND | Gtk::FILL,
+ m_Table.attach(m_CheckButton_Inverted, 0, 1, 2, 3, Gtk::EXPAND | Gtk::FILL,
Gtk::EXPAND | Gtk::FILL, 5, 5);
- m_CheckButton_Orientation.signal_clicked().connect(sigc::mem_fun(*this,
+ m_CheckButton_Inverted.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_checkbutton_orientation) );
//Add a button to exit the program.
@@ -99,17 +99,8 @@ void ExampleWindow::on_checkbutton_activity()
void ExampleWindow::on_checkbutton_orientation()
{
- switch(m_ProgressBar.get_orientation())
- {
- case Gtk::PROGRESS_LEFT_TO_RIGHT:
- m_ProgressBar.set_orientation(Gtk::PROGRESS_RIGHT_TO_LEFT);
- break;
- case Gtk::PROGRESS_RIGHT_TO_LEFT:
- m_ProgressBar.set_orientation(Gtk::PROGRESS_LEFT_TO_RIGHT);
- break;
- default:
- break; // do nothing
- }
+ const bool inverted = m_CheckButton_Inverted.get_active();
+ m_ProgressBar.set_inverted(inverted);
}
void ExampleWindow::on_button_close()
@@ -138,4 +129,3 @@ bool ExampleWindow::on_timeout()
//continues to get called
return true;
}
-
diff --git a/examples/book/progressbar/examplewindow.h b/examples/book/progressbar/examplewindow.h
index c12aa7d..e4330a1 100644
--- a/examples/book/progressbar/examplewindow.h
+++ b/examples/book/progressbar/examplewindow.h
@@ -41,7 +41,7 @@ protected:
Gtk::Table m_Table;
Gtk::ProgressBar m_ProgressBar;
Gtk::HSeparator m_Separator;
- Gtk::CheckButton m_CheckButton_Text, m_CheckButton_Activity, m_CheckButton_Orientation;
+ Gtk::CheckButton m_CheckButton_Text, m_CheckButton_Activity, m_CheckButton_Inverted;
Gtk::Button m_Button_Close;
int m_connection_id_timeout;
diff --git a/examples/others/cellrenderercustom/cellrendererpopup.cc b/examples/others/cellrenderercustom/cellrendererpopup.cc
index 46966f0..627dfe5 100644
--- a/examples/others/cellrenderercustom/cellrendererpopup.cc
+++ b/examples/others/cellrenderercustom/cellrendererpopup.cc
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#include <gtkmm.h>
#include "cellrendererpopup.h"
#include "popupentry.h"
@@ -101,6 +101,8 @@ void CellRendererPopup::hide_popup()
signal_hide_popup_();
}
+//TODO: Port this to gtkmm 3:
+/*
void CellRendererPopup::get_size_vfunc(Gtk::Widget& widget,
const Gdk::Rectangle* cell_area,
int* x_offset, int* y_offset,
@@ -115,6 +117,7 @@ void CellRendererPopup::get_size_vfunc(Gtk::Widget& widget,
if(width)
*width += button_width_;
}
+*/
Gtk::CellEditable* CellRendererPopup::start_editing_vfunc(GdkEvent*,
Gtk::Widget&,
@@ -239,7 +242,7 @@ bool CellRendererPopup::on_button_press_event(GdkEventButton* event)
editing_canceled_ = true;
signal_hide_popup_();
-
+
return false;
}
@@ -247,13 +250,13 @@ bool CellRendererPopup::on_key_press_event(GdkEventKey* event)
{
switch(event->keyval)
{
- case GDK_Escape:
+ case GDK_KEY_Escape:
editing_canceled_ = true; break;
- case GDK_Return:
- case GDK_KP_Enter:
- case GDK_ISO_Enter:
- case GDK_3270_Enter:
+ case GDK_KEY_Return:
+ case GDK_KEY_KP_Enter:
+ case GDK_KEY_ISO_Enter:
+ case GDK_KEY_3270_Enter:
editing_canceled_ = false; break;
default:
@@ -305,4 +308,3 @@ void CellRendererPopup::on_popup_hide()
{
popup_entry_ = 0;
}
-
diff --git a/examples/others/cellrenderercustom/cellrendererpopup.h b/examples/others/cellrenderercustom/cellrendererpopup.h
index 8f9a004..db8d47f 100644
--- a/examples/others/cellrenderercustom/cellrendererpopup.h
+++ b/examples/others/cellrenderercustom/cellrendererpopup.h
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#include <gtkmm/cellrenderertext.h>
#include <gtkmm/window.h>
#include <gdkmm.h>
@@ -44,10 +44,14 @@ public:
void hide_popup();
protected:
+
+ //TODO: Port this to gtkmm 3:
+ /*
virtual void get_size_vfunc(Gtk::Widget& widget,
const Gdk::Rectangle* cell_area,
int* x_offset, int* y_offset,
int* width, int* height) const;
+ */
virtual Gtk::CellEditable* start_editing_vfunc(GdkEvent* event,
Gtk::Widget& widget,
@@ -80,4 +84,3 @@ private:
void on_popup_arrow_clicked();
void on_popup_hide();
};
-
diff --git a/examples/others/cellrenderercustom/cellrenderertoggle.cc b/examples/others/cellrenderercustom/cellrenderertoggle.cc
index 9087229..9ab5b1e 100644
--- a/examples/others/cellrenderercustom/cellrenderertoggle.cc
+++ b/examples/others/cellrenderercustom/cellrenderertoggle.cc
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
/*
* Example Gtk::CellRendererCustom implementation. The custom
* MyCellRendererToggle is functionally equivalent to Gtk::CellRendererToggle.
@@ -178,8 +178,13 @@ void MyCellRendererToggle::render_vfunc(const Glib::RefPtr<Gdk::Drawable>& windo
const unsigned int cell_ypad = property_ypad();
- int x_offset = 0, y_offset = 0, width = 0, height = 0;
- get_size(widget, cell_area, x_offset, y_offset, width, height);
+ int width = 0, height = 0;
+
+ //TODO: Support natural size.
+ GtkRequisition requisition_min, requisition_natural;
+ get_size(widget, requisition_min, requisition_natural);
+ width = requisition_min.width;
+ height = requisition_min.height;
width -= cell_xpad * 2;
height -= cell_ypad * 2;
@@ -206,8 +211,8 @@ void MyCellRendererToggle::render_vfunc(const Glib::RefPtr<Gdk::Drawable>& windo
widget.get_style()->paint_option(
window_casted, state, shadow,
cell_area, widget, "cellradio",
- cell_area.get_x() + x_offset + cell_xpad,
- cell_area.get_y() + y_offset + cell_ypad,
+ cell_area.get_x() + cell_xpad,
+ cell_area.get_y() + cell_ypad,
width - 1, height - 1);
}
else
@@ -215,8 +220,8 @@ void MyCellRendererToggle::render_vfunc(const Glib::RefPtr<Gdk::Drawable>& windo
widget.get_style()->paint_check(
window_casted, state, shadow,
cell_area, widget, "cellcheck",
- cell_area.get_x() + x_offset + cell_xpad,
- cell_area.get_y() + y_offset + cell_ypad,
+ cell_area.get_x() + cell_xpad,
+ cell_area.get_y() + cell_ypad,
width - 1, height - 1);
}
}
@@ -298,4 +303,3 @@ int main(int argc, char** argv)
return 0;
}
-
diff --git a/examples/others/cellrenderercustom/popupentry.cc b/examples/others/cellrenderercustom/popupentry.cc
index 18b3b19..8d83fb0 100644
--- a/examples/others/cellrenderercustom/popupentry.cc
+++ b/examples/others/cellrenderercustom/popupentry.cc
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
#include <gtkmm.h>
#include "popupentry.h"
@@ -91,9 +91,11 @@ int PopupEntry::get_button_width()
window.move(-500, -500);
window.show_all();
- Gtk::Requisition requisition = window.size_request();
+ //TODO: Support natural-size:
+ Gtk::Requisition requisition_min, requisition_natural;
+ window.Gtk::SizeRequest::get_size(requisition_min, requisition_natural);
- return requisition.width;
+ return requisition_min.width;
}
PopupEntry::type_signal_arrow_clicked& PopupEntry::signal_arrow_clicked()
@@ -103,7 +105,7 @@ PopupEntry::type_signal_arrow_clicked& PopupEntry::signal_arrow_clicked()
bool PopupEntry::on_key_press_event(GdkEventKey* event)
{
- if(event->keyval == GDK_Escape)
+ if(event->keyval == GDK_KEY_Escape)
{
editing_canceled_ = true;
@@ -154,7 +156,7 @@ void PopupEntry::on_entry_activate()
bool PopupEntry::on_entry_key_press_event(GdkEventKey* event)
{
- if(event->keyval == GDK_Escape)
+ if(event->keyval == GDK_KEY_Escape)
{
editing_canceled_ = true;
@@ -166,4 +168,3 @@ bool PopupEntry::on_entry_key_press_event(GdkEventKey* event)
return false;
}
-
diff --git a/examples/others/dnd/dndwindow.cc b/examples/others/dnd/dndwindow.cc
index 6933b66..c5953cb 100644
--- a/examples/others/dnd/dndwindow.cc
+++ b/examples/others/dnd/dndwindow.cc
@@ -33,9 +33,9 @@ DnDWindow::DnDWindow()
add(m_Table);
- m_drag_icon = Gdk::Pixmap::create_from_xpm(get_colormap(), m_drag_mask, drag_icon_xpm);
- m_trashcan_open = Gdk::Pixmap::create_from_xpm(get_colormap(), m_trashcan_open_mask, trashcan_open_xpm);
- m_trashcan_closed = Gdk::Pixmap::create_from_xpm(get_colormap(), m_trashcan_closed_mask, trashcan_closed_xpm);
+ m_drag_icon = Gdk::Pixbuf::create_from_xpm_data(drag_icon_xpm);
+ m_trashcan_open = Gdk::Pixbuf::create_from_xpm_data(trashcan_open_xpm);
+ m_trashcan_closed = Gdk::Pixbuf::create_from_xpm_data(trashcan_closed_xpm);
//Targets:
m_listTargets.push_back( Gtk::TargetEntry("STRING", Gtk::TargetFlags(0), TARGET_STRING) );
@@ -62,7 +62,7 @@ DnDWindow::DnDWindow()
m_Label_Popup.signal_drag_motion().connect( sigc::mem_fun(*this, &DnDWindow::on_label_popup_drag_motion) );
m_Label_Popup.signal_drag_leave().connect( sigc::mem_fun(*this, &DnDWindow::on_label_popup_drag_leave) );
- m_Image.set(m_trashcan_closed, m_trashcan_closed_mask);
+ m_Image.set(m_trashcan_closed);
m_Image.drag_dest_set();
m_Table.attach(m_Image, 1, 2, 0, 1,
@@ -79,7 +79,7 @@ DnDWindow::DnDWindow()
m_Button.drag_source_set(m_listTargets, Gdk::ModifierType(GDK_BUTTON1_MASK | GDK_BUTTON3_MASK),
Gdk::DragAction(GDK_ACTION_COPY | GDK_ACTION_MOVE));
- m_Button.drag_source_set_icon(get_colormap(), m_drag_icon, m_drag_mask);
+ m_Button.drag_source_set_icon(m_drag_icon);
m_Table.attach(m_Button, 0, 1, 1, 2,
Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL,
@@ -150,7 +150,7 @@ bool DnDWindow::on_image_drag_motion(const Glib::RefPtr<Gdk::DragContext>& conte
if(!m_have_drag)
{
m_have_drag = true;
- m_Image.set(m_trashcan_open, m_trashcan_open_mask);
+ m_Image.set(m_trashcan_open);
}
Gtk::Widget* source_widget = Gtk::Widget::drag_get_source_widget(context);
@@ -174,7 +174,7 @@ void DnDWindow::on_image_drag_leave(const Glib::RefPtr<Gdk::DragContext>&, guint
{
g_print("leave\n");
m_have_drag = false;
- m_Image.set(m_trashcan_closed, m_trashcan_closed_mask);
+ m_Image.set(m_trashcan_closed);
}
bool DnDWindow::on_image_drag_drop(const Glib::RefPtr<Gdk::DragContext>& context, int, int, guint time)
@@ -182,7 +182,7 @@ bool DnDWindow::on_image_drag_drop(const Glib::RefPtr<Gdk::DragContext>& context
g_print("drop\n");
m_have_drag = false;
- m_Image.set(m_trashcan_closed, m_trashcan_closed_mask);
+ m_Image.set(m_trashcan_closed);
std::vector<Glib::ustring> targets = context->list_targets();
if(!targets.empty())
@@ -275,7 +275,7 @@ bool DnDWindow::on_popup_button_drag_motion(const Glib::RefPtr<Gdk::DragContext>
return true;
}
-
+
void DnDWindow::on_popup_button_drag_leave(const Glib::RefPtr<Gdk::DragContext>&, guint)
{
if(m_in_popup)
@@ -288,4 +288,3 @@ void DnDWindow::on_popup_button_drag_leave(const Glib::RefPtr<Gdk::DragContext>&
}
}
}
-
diff --git a/examples/others/dnd/dndwindow.h b/examples/others/dnd/dndwindow.h
index 0bee201..1ba804d 100644
--- a/examples/others/dnd/dndwindow.h
+++ b/examples/others/dnd/dndwindow.h
@@ -48,7 +48,7 @@ protected:
bool on_popdown_timeout();
bool on_popup_timeout();
- bool on_popup_button_drag_motion(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, guint time);
+ bool on_popup_button_drag_motion(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, guint time);
void on_popup_button_drag_leave(const Glib::RefPtr<Gdk::DragContext>& context, guint time);
@@ -58,14 +58,9 @@ protected:
Gtk::Image m_Image;
Gtk::Button m_Button;
- Glib::RefPtr<Gdk::Bitmap> m_drag_mask;
- Glib::RefPtr<Gdk::Pixmap> m_drag_icon;
-
- Glib::RefPtr<Gdk::Bitmap> m_trashcan_open_mask;
- Glib::RefPtr<Gdk::Pixmap> m_trashcan_open;
-
- Glib::RefPtr<Gdk::Bitmap> m_trashcan_closed_mask;
- Glib::RefPtr<Gdk::Pixmap> m_trashcan_closed;
+ Glib::RefPtr<Gdk::Pixbuf> m_drag_icon;
+ Glib::RefPtr<Gdk::Pixbuf> m_trashcan_open;
+ Glib::RefPtr<Gdk::Pixbuf> m_trashcan_closed;
bool m_have_drag;
diff --git a/examples/others/window/wheelbarrow.cc b/examples/others/window/wheelbarrow.cc
index c1b301d..3d4d5a1 100644
--- a/examples/others/window/wheelbarrow.cc
+++ b/examples/others/window/wheelbarrow.cc
@@ -150,21 +150,22 @@ Wheelbarrow::Wheelbarrow()
set_icon(Gdk::Pixbuf::create_from_xpm_data(wheelbarrow_xpm));
realize(); // the widget must be realized to create the GDK window
- const Glib::RefPtr<const Gdk::Drawable> drawable = get_window();
+ const Glib::RefPtr<const Gdk::Window> window = get_window();
const Gdk::Color transparent = Gtk::Widget::get_default_style()->get_bg(Gtk::STATE_NORMAL);
- Glib::RefPtr<Gdk::Bitmap> mask;
- const Glib::RefPtr<Gdk::Pixmap> pixmap =
- Gdk::Pixmap::create_from_xpm(drawable, mask, transparent, wheelbarrow_xpm);
+ const Glib::RefPtr<Gdk::Pixbuf> pixbuf =
+ Gdk::Pixbuf::create_from_xpm_data(drawable, transparent, wheelbarrow_xpm);
- Gtk::Image *const image = new Gtk::Image(pixmap, mask);
+ Gtk::Image *const image = new Gtk::Image(pixbuf);
add(*Gtk::manage(image));
image->set_size_request(48, 48);
image->show();
// Mask out transparent parts of the pixmap.
- shape_combine_mask(mask, 0, 0);
+ //TODO: Use gdk_cairo_region_from_surface() or suchlike when it exists.
+ //TODO: Use a Gtk::Widget::shape_combine_region() when it exists.
+ window->shape_combine_region(shape_region)
add_events(Gdk::BUTTON_PRESS_MASK);
}
@@ -195,4 +196,3 @@ int main(int argc, char** argv)
return 0;
}
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]