[gtkmm] Deprecate Alignment because it is deprecated in GTK+.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Deprecate Alignment because it is deprecated in GTK+.
- Date: Fri, 30 May 2014 10:15:34 +0000 (UTC)
commit 31a96887b0a30a4194aeb65c16e38331079a1479
Author: Murray Cumming <murrayc murrayc com>
Date: Fri May 30 09:07:07 2014 +0200
Deprecate Alignment because it is deprecated in GTK+.
* gtk/src/alignment.hg: Deprecate this.
* demos/gtkmm-demo/example_colorsel.c:
* demos/gtkmm-demo/example_icontheme.cc:
* demos/gtkmm-demo/example_images.cc:
* demos/gtkmm-demo/example_textview.cc: Replace use of
Gtk::Alignment with Widget h/valign.
demos/gtk-demo/example_colorsel.cc | 9 ++++-----
demos/gtk-demo/example_icontheme.cc | 9 ++++-----
demos/gtk-demo/example_images.cc | 25 +++++++------------------
demos/gtk-demo/example_textview.cc | 8 ++++----
gtk/src/alignment.hg | 9 +++++++++
5 files changed, 28 insertions(+), 32 deletions(-)
---
diff --git a/demos/gtk-demo/example_colorsel.cc b/demos/gtk-demo/example_colorsel.cc
index 90647e6..d12785a 100644
--- a/demos/gtk-demo/example_colorsel.cc
+++ b/demos/gtk-demo/example_colorsel.cc
@@ -22,7 +22,6 @@ protected:
Gtk::DrawingArea m_DrawingArea;
Gtk::Button m_Button;
Gdk::RGBA m_Color;
- Gtk::Alignment m_Alignment;
};
//Called by DemoWindow;
@@ -33,8 +32,7 @@ Gtk::Window* do_colorsel()
Example_ColorSel::Example_ColorSel()
: m_VBox(Gtk::ORIENTATION_VERTICAL, 8),
- m_Button("_Change the above color", true),
- m_Alignment(Gtk::ALIGN_END, Gtk::ALIGN_END, 0.0, 0.0)
+ m_Button("_Change the above color", true)
{
set_title("Color Selection");
set_border_width(8);
@@ -64,9 +62,10 @@ Example_ColorSel::Example_ColorSel()
m_Frame.add(m_DrawingArea);
- m_Alignment.add(m_Button);
+ m_Button.set_halign(Gtk::ALIGN_END);
+ m_Button.set_valign(Gtk::ALIGN_CENTER);
- m_VBox.pack_start(m_Alignment,Gtk::PACK_SHRINK);
+ m_VBox.pack_start(m_Button, Gtk::PACK_SHRINK);
m_Button.signal_clicked().connect(sigc::mem_fun(*this, &Example_ColorSel::on_button_clicked));
diff --git a/demos/gtk-demo/example_icontheme.cc b/demos/gtk-demo/example_icontheme.cc
index abf1e21..2ba0b61 100644
--- a/demos/gtk-demo/example_icontheme.cc
+++ b/demos/gtk-demo/example_icontheme.cc
@@ -40,7 +40,6 @@ protected:
Gtk::ScrolledWindow m_ScrolledWindow;
Glib::RefPtr<Gtk::TreeModel> m_refTreeModel;
Gtk::TreeView m_TreeView;
- Gtk::Alignment m_Alignment;
Glib::RefPtr<Gtk::TreeSelection> m_refTreeSelection;
Gtk::Image m_Image;
@@ -85,8 +84,7 @@ Example_IconTheme::Example_IconTheme()
m_IconTheme(Gtk::IconTheme::get_default()),
m_Frame("Selected Icon"),
m_VBox(Gtk::ORIENTATION_VERTICAL, 8),
- m_HBox(Gtk::ORIENTATION_HORIZONTAL, 8),
- m_Alignment(Gtk::ALIGN_CENTER, Gtk::ALIGN_START, 0.0, 0.0)
+ m_HBox(Gtk::ORIENTATION_HORIZONTAL, 8)
{
set_title("Icons in Current Icon Theme");
set_default_size(1000, 500);
@@ -121,8 +119,9 @@ Example_IconTheme::Example_IconTheme()
m_TreeView.append_column("Context", m_columns.context);
//m_TreeView.append_column("Filename", m_columns.filename);
- m_HBox.pack_end(m_Alignment, Gtk::PACK_SHRINK);
- m_Alignment.add(m_Frame);
+ m_HBox.pack_end(m_Frame, Gtk::PACK_SHRINK);
+ m_Frame.set_halign(Gtk::ALIGN_CENTER);
+ m_Frame.set_valign(Gtk::ALIGN_START);
m_VBox.set_border_width(4);
m_Frame.add(m_VBox);
diff --git a/demos/gtk-demo/example_images.cc b/demos/gtk-demo/example_images.cc
index 1901a10..ee550d3 100644
--- a/demos/gtk-demo/example_images.cc
+++ b/demos/gtk-demo/example_images.cc
@@ -33,7 +33,6 @@ protected:
Gtk::Box m_VBox;
Gtk::Label m_Label_Image, m_Label_Animation, m_Label_Progressive;
Gtk::Frame m_Frame_Image, m_Frame_Animation, m_Frame_Progressive;
- Gtk::Alignment m_Alignment_Image, m_Alignment_Animation, m_Alignment_Progressive;
Gtk::Image m_Image_Progressive;
Glib::RefPtr<Gdk::PixbufLoader> m_refPixbufLoader;
@@ -49,8 +48,6 @@ Gtk::Window* do_images()
Example_Images::Example_Images()
:
m_VBox (Gtk::ORIENTATION_VERTICAL, 8),
- m_Alignment_Image (0.5, 0.5, 0, 0),
- m_Alignment_Animation (0.5, 0.5, 0, 0),
m_image_stream (0)
{
set_title("Images");
@@ -66,11 +63,9 @@ Example_Images::Example_Images()
m_Frame_Image.set_shadow_type(Gtk::SHADOW_IN);
- /* The alignment keeps the frame from growing when users resize
- * the window
- */
- m_Alignment_Image.add(m_Frame_Image);
- m_VBox.pack_start(m_Alignment_Image, Gtk::PACK_SHRINK);
+ m_Frame_Image.set_halign(Gtk::ALIGN_CENTER);
+ m_Frame_Image.set_valign(Gtk::ALIGN_CENTER);
+ m_VBox.pack_start(m_Frame_Image, Gtk::PACK_SHRINK);
Gtk::Image* pImage = Gtk::manage(new Gtk::Image(demo_find_file("gtk-logo-rgb.gif")));
m_Frame_Image.add(*pImage);
@@ -82,11 +77,9 @@ Example_Images::Example_Images()
m_Frame_Animation.set_shadow_type(Gtk::SHADOW_IN);
- /* The alignment keeps the frame from growing when users resize
- * the window
- */
- m_Alignment_Animation.add(m_Frame_Animation);
- m_VBox.pack_start(m_Alignment_Animation, Gtk::PACK_SHRINK);
+ m_Frame_Animation.set_halign(Gtk::ALIGN_CENTER);
+ m_Frame_Animation.set_valign(Gtk::ALIGN_CENTER);
+ m_VBox.pack_start(m_Frame_Animation, Gtk::PACK_SHRINK);
pImage = Gtk::manage(new Gtk::Image(demo_find_file("floppybuddy.gif")));
m_Frame_Animation.add(*pImage);
@@ -98,11 +91,7 @@ Example_Images::Example_Images()
m_Frame_Progressive.set_shadow_type(Gtk::SHADOW_IN);
- /* The alignment keeps the frame from growing when users resize
- * the window
- */
- m_Alignment_Progressive.add(m_Frame_Progressive);
- m_VBox.pack_start(m_Alignment_Progressive, Gtk::PACK_SHRINK);
+ m_VBox.pack_start(m_Frame_Progressive, Gtk::PACK_SHRINK);
/* Create an empty image for now; the progressive loader
* will create the pixbuf and fill it in.
diff --git a/demos/gtk-demo/example_textview.cc b/demos/gtk-demo/example_textview.cc
index feb72bf..3b03c80 100644
--- a/demos/gtk-demo/example_textview.cc
+++ b/demos/gtk-demo/example_textview.cc
@@ -469,11 +469,11 @@ void Window_EasterEgg::recursive_attach_view(int depth, Gtk::TextView& view, Gli
Gdk::RGBA color("black");
pEventBox->override_background_color(color);
- Gtk::Alignment* pAlign = Gtk::manage( new Gtk::Alignment(0.5, 0.5, 1.0, 1.0));
- pAlign->set_border_width(1);
+ pChildView->set_halign(Gtk::ALIGN_CENTER);
+ pChildView->set_valign(Gtk::ALIGN_CENTER);
+ pChildView->set_border_width(1);
- pEventBox->add(*pAlign);
- pAlign->add(*pChildView);
+ pEventBox->add(*pChildView);
view.add_child_at_anchor(*pEventBox, refAnchor);
recursive_attach_view (depth + 1, *pChildView, refAnchor);
diff --git a/gtk/src/alignment.hg b/gtk/src/alignment.hg
index 0b347ed..5160509 100644
--- a/gtk/src/alignment.hg
+++ b/gtk/src/alignment.hg
@@ -20,6 +20,11 @@
_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/bin_p.h)
+#m4 _PUSH(SECTION_CC_PRE_INCLUDES)
+#undef GTK_DISABLE_DEPRECATED
+#define GDK_DISABLE_DEPRECATION_WARNINGS 1
+#m4 _POP()
+
namespace Gtk
{
@@ -35,12 +40,16 @@ namespace Gtk
* The scale settings specify how much the child widget should expand to fill the space allocated to the
Gtk::Alignment. The values can range from 0 (meaning the child doesn't expand at all) to 1 (meaning the child
expands to fill all of the available space).
* The align settings place the child widget within the available area. The values range from 0 (top or
left) to 1 (bottom or right). Of course, if the scale settings are both set to 1, the alignment settings have
no effect.
*
+ *
+ * @deprecated Use Widget alignment and margin properties instead.
+
* @ingroup Widgets
* @ingroup Containers
*/
class Alignment : public Bin
{
_CLASS_GTKOBJECT(Alignment,GtkAlignment,GTK_ALIGNMENT,Gtk::Bin,GtkBin)
+ _IS_DEPRECATED
public:
/** Constructor to create an Alignment object.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]