[gtkmm] Add FontChooser and FontChooserDialog, deprecating old widgets.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Add FontChooser and FontChooserDialog, deprecating old widgets.
- Date: Thu, 25 Aug 2011 08:50:44 +0000 (UTC)
commit d22f4e72edeb84861d25f0c06973180081d4bb13
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Aug 25 10:00:47 2011 +0200
Add FontChooser and FontChooserDialog, deprecating old widgets.
* gtk/src/gtk_methods.defs: Regenerated with h2defs.py.
* gtk/src/filelist.am:
* gtk/src/fontchooser.[hg|ccg]:
* gtk/src/fontchooserdialog.[hg|ccg]: Added FontChooser and FontChooserDialog.
* gtk/gtkmm.h: Add them here.
* gtk/src/fontselection.hg: Deprecate FontSelection and FontSelectionDialog.
The APIs are annoyingly similar, but GTK+ has done this.
ChangeLog | 12 ++
gtk/gtkmm.h | 2 +
gtk/src/filelist.am | 7 +-
gtk/src/fontchooser.ccg | 19 ++++
gtk/src/fontchooser.hg | 74 ++++++++++++++
gtk/src/fontchooserdialog.ccg | 30 ++++++
gtk/src/fontchooserdialog.hg | 62 ++++++++++++
gtk/src/fontselection.hg | 7 ++
gtk/src/gtk_methods.defs | 222 ++++++++++++++++++++++++++++++++++++++++-
9 files changed, 430 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b9bd46b..d0aa385 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2011-08-25 Murray Cumming <murrayc murrayc com>
+
+ Add FontChooser and FontChooserDialog, deprecating old widgets.
+
+ * gtk/src/gtk_methods.defs: Regenerated with h2defs.py.
+ * gtk/src/filelist.am:
+ * gtk/src/fontchooser.[hg|ccg]:
+ * gtk/src/fontchooserdialog.[hg|ccg]: Added FontChooser and FontChooserDialog.
+ * gtk/gtkmm.h: Add them here.
+ * gtk/src/fontselection.hg: Deprecate FontSelection and FontSelectionDialog.
+ The APIs are annoyingly similar, but GTK+ has done this.
+
2011-08-17 Chun-wei Fan <fanc999 src gnome org>
Update Visual C++ Projects
diff --git a/gtk/gtkmm.h b/gtk/gtkmm.h
index fb38358..86a6854 100644
--- a/gtk/gtkmm.h
+++ b/gtk/gtkmm.h
@@ -147,6 +147,8 @@ extern const int gtkmm_micro_version;
#include <gtkmm/filefilter.h>
#include <gtkmm/fixed.h>
#include <gtkmm/fontbutton.h>
+#include <gtkmm/fontchooser.h>
+#include <gtkmm/fontchooserdialog.h>
#include <gtkmm/fontselection.h>
#include <gtkmm/frame.h>
#include <gtkmm/grid.h>
diff --git a/gtk/src/filelist.am b/gtk/src/filelist.am
index 73ec97c..bcdc3e8 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -78,7 +78,8 @@ gtkmm_files_any_hg = \
filefilter.hg \
fixed.hg \
fontbutton.hg \
- fontselection.hg \
+ fontchooser.hg \
+ fontchooserdialog.hg \
frame.hg \
grid.hg \
handlebox.hg \
@@ -198,7 +199,9 @@ gtkmm_files_posix_hg = \
printunixdialog.hg \
socket.hg
-gtkmm_files_deprecated_hg = hvbox.hg \
+gtkmm_files_deprecated_hg = \
+ fontselection.hg \
+ hvbox.hg \
hvbuttonbox.hg \
hvpaned.hg \
hvscale.hg \
diff --git a/gtk/src/fontchooser.ccg b/gtk/src/fontchooser.ccg
new file mode 100644
index 0000000..5d7dafa
--- /dev/null
+++ b/gtk/src/fontchooser.ccg
@@ -0,0 +1,19 @@
+/* Copyright 2011 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <gtk/gtk.h>
+
diff --git a/gtk/src/fontchooser.hg b/gtk/src/fontchooser.hg
new file mode 100644
index 0000000..5b8173d
--- /dev/null
+++ b/gtk/src/fontchooser.hg
@@ -0,0 +1,74 @@
+/* Copyright (C) 2011 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(gtkmm/private/box_p.h)
+
+
+#include <gtkmm/box.h>
+
+
+namespace Gtk
+{
+
+/** A widget for selecting fonts.
+ *
+ * The Gtk::FontChooser widget lists the available fonts, styles and
+ * sizes, allowing the user to select a font. It is used in the
+ * Gtk::FontChooserDialog widget to provide a dialog box for selecting
+ * fonts.
+ *
+ * To set the font which is initially selected, use set_font_name().
+ *
+ * To get the selected font use get_font_name().
+ *
+ * To change the text which is shown in the preview area, use set_preview_text().
+ *
+ * @ingroup Widgets
+ * @newin{3,2}
+ */
+class FontChooser : public Box
+{
+ _CLASS_GTKOBJECT(FontChooser, GtkFontChooser, GTK_FONT_CHOOSER, Gtk::Box, GtkBox)
+ _IGNORE(gtk_font_chooser_get_font) //deprecated
+public:
+ _CTOR_DEFAULT()
+
+ _WRAP_METHOD(Glib::RefPtr<Pango::FontFamily> get_family(), gtk_font_chooser_get_family, refreturn)
+ _WRAP_METHOD(Glib::RefPtr<const Pango::FontFamily> get_family() const, gtk_font_chooser_get_family, refreturn, constversion)
+
+ _WRAP_METHOD(Glib::RefPtr<Pango::FontFace> get_face(), gtk_font_chooser_get_face, refreturn)
+ _WRAP_METHOD(Glib::RefPtr<const Pango::FontFace> get_face() const, gtk_font_chooser_get_face, refreturn, constversion)
+
+ _WRAP_METHOD(int get_size() const, gtk_font_chooser_get_size)
+
+ _WRAP_METHOD(Glib::ustring get_font_name() const, gtk_font_chooser_get_font_name)
+ _WRAP_METHOD(bool set_font_name(const Glib::ustring& fontname), gtk_font_chooser_set_font_name)
+ _WRAP_METHOD(Glib::ustring get_preview_text() const, gtk_font_chooser_get_preview_text)
+ _WRAP_METHOD(void set_preview_text(const Glib::ustring& fontname),gtk_font_chooser_set_preview_text)
+
+ _WRAP_METHOD(bool get_show_preview_entry() const, gtk_font_chooser_get_show_preview_entry)
+ _WRAP_METHOD(void set_show_preview_entry(bool show_preview_entry = true), gtk_font_chooser_set_show_preview_entry)
+
+
+ //Note: The GdkFont "font" property is deprecated, or should be.
+ _WRAP_PROPERTY("font_name", Glib::ustring)
+ _WRAP_PROPERTY("preview_text", Glib::ustring)
+ _WRAP_PROPERTY("show-preview-entry", bool)
+};
+
+} // namespace Gtk
diff --git a/gtk/src/fontchooserdialog.ccg b/gtk/src/fontchooserdialog.ccg
new file mode 100644
index 0000000..3fe322b
--- /dev/null
+++ b/gtk/src/fontchooserdialog.ccg
@@ -0,0 +1,30 @@
+/* Copyright 2011 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <gtk/gtk.h>
+
+namespace Gtk
+{
+
+FontChooserDialog::FontChooserDialog(const Glib::ustring& title)
+:
+ _CONSTRUCT("title", title.c_str())
+{
+}
+
+
+} //namespace Gtk
diff --git a/gtk/src/fontchooserdialog.hg b/gtk/src/fontchooserdialog.hg
new file mode 100644
index 0000000..a7f5639
--- /dev/null
+++ b/gtk/src/fontchooserdialog.hg
@@ -0,0 +1,62 @@
+/* Copyright (C) 2011 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(gtkmm/private/dialog_p.h)
+
+
+#include <gtkmm/dialog.h>
+#include <gtkmm/fontchooser.h>
+
+
+namespace Gtk
+{
+
+/** A dialog box for selecting fonts.
+ *
+ * To set the font which is initially selected, use set_font_name().
+ *
+ * To get the selected font use get_font_name().
+ *
+ * To change the text which is shown in the preview area, use set_preview_text().
+ *
+ * @ingroup Dialogs
+ * @newin{3,2}
+ */
+class FontChooserDialog : public Dialog
+{
+ _CLASS_GTKOBJECT(FontChooserDialog, GtkFontChooserDialog, GTK_FONT_CHOOSER_DIALOG, Gtk::Dialog, GtkDialog)
+public:
+ _CTOR_DEFAULT()
+ explicit FontChooserDialog(const Glib::ustring& title);
+
+ //Note: We renamed the parent parameter to transient_for because that is the property name.
+ _WRAP_CTOR(FontChooserDialog(const Glib::ustring& title, Window& transient_for), gtk_font_chooser_dialog_new)
+
+
+#m4 _CONVERSION(`GtkWidget*',`FontChooser*',`Glib::wrap((GtkFontChooser*)($3))')
+#m4 _CONVERSION(`GtkWidget*',`const FontChooser*',`Glib::wrap((GtkFontChooser*)($3))')
+ _WRAP_METHOD(FontChooser* get_font_chooser(), gtk_font_chooser_dialog_get_font_chooser)
+ _WRAP_METHOD(const FontChooser* get_font_chooser() const, gtk_font_chooser_dialog_get_font_chooser, constversion)
+
+ _WRAP_METHOD(Glib::ustring get_font_name() const, gtk_font_chooser_dialog_get_font_name)
+ _WRAP_METHOD(bool set_font_name(const Glib::ustring& fontname), gtk_font_chooser_dialog_set_font_name)
+ _WRAP_METHOD(Glib::ustring get_preview_text() const, gtk_font_chooser_dialog_get_preview_text)
+ _WRAP_METHOD(void set_preview_text(const Glib::ustring& fontname),gtk_font_chooser_dialog_set_preview_text)
+};
+
+} // namespace Gtk
diff --git a/gtk/src/fontselection.hg b/gtk/src/fontselection.hg
index 5d640b5..798ae7d 100644
--- a/gtk/src/fontselection.hg
+++ b/gtk/src/fontselection.hg
@@ -21,6 +21,9 @@ _DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/hvbox_p.h)
_PINCLUDE(gtkmm/private/dialog_p.h)
+#m4 _PUSH(SECTION_CC_PRE_INCLUDES)
+#undef GTK_DISABLE_DEPRECATED
+#m4 _POP()
#include <gtkmm/dialog.h>
#include <gtkmm/box.h>
@@ -42,11 +45,13 @@ class RadioButton;
* Gtk::FontSelectionDialog widget to provide a dialog box for selecting
* fonts.
*
+ * @deprecated Use FontChooser instead.
* @ingroup Widgets
*/
class FontSelection : public VBox
{
_CLASS_GTKOBJECT(FontSelection,GtkFontSelection,GTK_FONT_SELECTION,Gtk::VBox,GtkVBox)
+ _IS_DEPRECATED
_IGNORE(gtk_font_selection_get_font) //deprecated
public:
_CTOR_DEFAULT()
@@ -94,11 +99,13 @@ public:
* A FontSelectionDialog looks like this:
* @image html fontselectiondialog1.png
*
+ * @deprecated Use FontChooserDialog instead.
* @ingroup Dialogs
*/
class FontSelectionDialog : public Dialog
{
_CLASS_GTKOBJECT(FontSelectionDialog,GtkFontSelectionDialog,GTK_FONT_SELECTION_DIALOG,Gtk::Dialog,GtkDialog)
+ _IS_DEPRECATED
_IGNORE(gtk_font_selection_dialog_get_font)
_UNMANAGEABLE()
public:
diff --git a/gtk/src/gtk_methods.defs b/gtk/src/gtk_methods.defs
index a805ca5..eb189e3 100644
--- a/gtk/src/gtk_methods.defs
+++ b/gtk/src/gtk_methods.defs
@@ -1093,6 +1093,13 @@
(gtype-id "GTK_TYPE_FONT_SELECTION")
)
+(define-object FontChooser
+ (in-module "Gtk")
+ (parent "GtkBox")
+ (c-name "GtkFontChooser")
+ (gtype-id "GTK_TYPE_FONT_CHOOSER")
+)
+
(define-object FileChooserWidget
(in-module "Gtk")
(parent "GtkBox")
@@ -1219,6 +1226,13 @@
(gtype-id "GTK_TYPE_FONT_SELECTION_DIALOG")
)
+(define-object FontChooserDialog
+ (in-module "Gtk")
+ (parent "GtkDialog")
+ (c-name "GtkFontChooserDialog")
+ (gtype-id "GTK_TYPE_FONT_CHOOSER_DIALOG")
+)
+
(define-object FileChooserDialog
(in-module "Gtk")
(parent "GtkDialog")
@@ -4466,11 +4480,11 @@
)
)
-(define-function gtk_asssistant_remove_page
- (c-name "gtk_asssistant_remove_page")
+(define-method remove_page
+ (of-object "GtkAssistant")
+ (c-name "gtk_assistant_remove_page")
(return-type "none")
(parameters
- '("GtkAssistant*" "assistant")
'("gint" "page_num")
)
)
@@ -11011,6 +11025,150 @@
+;; From gtkfontchooserdialog.h
+
+(define-function gtk_font_chooser_dialog_get_type
+ (c-name "gtk_font_chooser_dialog_get_type")
+ (return-type "GType")
+)
+
+(define-function gtk_font_chooser_dialog_new
+ (c-name "gtk_font_chooser_dialog_new")
+ (is-constructor-of "GtkFontChooserDialog")
+ (return-type "GtkWidget*")
+ (parameters
+ '("const-gchar*" "title")
+ '("GtkWindow*" "window")
+ )
+)
+
+(define-method get_font_chooser
+ (of-object "GtkFontChooserDialog")
+ (c-name "gtk_font_chooser_dialog_get_font_chooser")
+ (return-type "GtkWidget*")
+)
+
+(define-method get_font_name
+ (of-object "GtkFontChooserDialog")
+ (c-name "gtk_font_chooser_dialog_get_font_name")
+ (return-type "gchar*")
+)
+
+(define-method set_font_name
+ (of-object "GtkFontChooserDialog")
+ (c-name "gtk_font_chooser_dialog_set_font_name")
+ (return-type "gboolean")
+ (parameters
+ '("const-gchar*" "fontname")
+ )
+)
+
+(define-method get_preview_text
+ (of-object "GtkFontChooserDialog")
+ (c-name "gtk_font_chooser_dialog_get_preview_text")
+ (return-type "const-gchar*")
+)
+
+(define-method set_preview_text
+ (of-object "GtkFontChooserDialog")
+ (c-name "gtk_font_chooser_dialog_set_preview_text")
+ (return-type "none")
+ (parameters
+ '("const-gchar*" "text")
+ )
+)
+
+
+
+;; From gtkfontchooser.h
+
+(define-function gtk_font_chooser_get_type
+ (c-name "gtk_font_chooser_get_type")
+ (return-type "GType")
+)
+
+(define-function gtk_font_chooser_new
+ (c-name "gtk_font_chooser_new")
+ (is-constructor-of "GtkFontChooser")
+ (return-type "GtkWidget*")
+)
+
+(define-method get_family
+ (of-object "GtkFontChooser")
+ (c-name "gtk_font_chooser_get_family")
+ (return-type "PangoFontFamily*")
+)
+
+(define-method get_face
+ (of-object "GtkFontChooser")
+ (c-name "gtk_font_chooser_get_face")
+ (return-type "PangoFontFace*")
+)
+
+(define-method get_size
+ (of-object "GtkFontChooser")
+ (c-name "gtk_font_chooser_get_size")
+ (return-type "gint")
+)
+
+(define-method get_font_name
+ (of-object "GtkFontChooser")
+ (c-name "gtk_font_chooser_get_font_name")
+ (return-type "gchar*")
+)
+
+(define-method set_font_name
+ (of-object "GtkFontChooser")
+ (c-name "gtk_font_chooser_set_font_name")
+ (return-type "gboolean")
+ (parameters
+ '("const-gchar*" "fontname")
+ )
+)
+
+(define-method get_preview_text
+ (of-object "GtkFontChooser")
+ (c-name "gtk_font_chooser_get_preview_text")
+ (return-type "const-gchar*")
+)
+
+(define-method set_preview_text
+ (of-object "GtkFontChooser")
+ (c-name "gtk_font_chooser_set_preview_text")
+ (return-type "none")
+ (parameters
+ '("const-gchar*" "text")
+ )
+)
+
+(define-method get_show_preview_entry
+ (of-object "GtkFontChooser")
+ (c-name "gtk_font_chooser_get_show_preview_entry")
+ (return-type "gboolean")
+)
+
+(define-method set_show_preview_entry
+ (of-object "GtkFontChooser")
+ (c-name "gtk_font_chooser_set_show_preview_entry")
+ (return-type "none")
+ (parameters
+ '("gboolean" "show_preview_entry")
+ )
+)
+
+(define-method set_filter_func
+ (of-object "GtkFontChooser")
+ (c-name "gtk_font_chooser_set_filter_func")
+ (return-type "none")
+ (parameters
+ '("GtkFontFilterFunc" "filter")
+ '("gpointer" "data")
+ '("GDestroyNotify" "destroy")
+ )
+)
+
+
+
;; From gtkfontsel.h
(define-function gtk_font_selection_get_type
@@ -11359,6 +11517,34 @@
)
)
+(define-method insert_row
+ (of-object "GtkGrid")
+ (c-name "gtk_grid_insert_row")
+ (return-type "none")
+ (parameters
+ '("gint" "position")
+ )
+)
+
+(define-method insert_column
+ (of-object "GtkGrid")
+ (c-name "gtk_grid_insert_column")
+ (return-type "none")
+ (parameters
+ '("gint" "position")
+ )
+)
+
+(define-method insert_next_to
+ (of-object "GtkGrid")
+ (c-name "gtk_grid_insert_next_to")
+ (return-type "none")
+ (parameters
+ '("GtkWidget*" "sibling")
+ '("GtkPositionType" "side")
+ )
+)
+
(define-method set_row_homogeneous
(of-object "GtkGrid")
(c-name "gtk_grid_set_row_homogeneous")
@@ -23426,6 +23612,15 @@
(return-type "none")
)
+(define-method assign
+ (of-object "GtkTextIter")
+ (c-name "gtk_text_iter_assign")
+ (return-type "none")
+ (parameters
+ '("const-GtkTextIter*" "other")
+ )
+)
+
(define-function gtk_text_iter_get_type
(c-name "gtk_text_iter_get_type")
(return-type "GType")
@@ -30413,6 +30608,12 @@
(return-type "gboolean")
)
+(define-method has_visible_focus
+ (of-object "GtkWidget")
+ (c-name "gtk_widget_has_visible_focus")
+ (return-type "gboolean")
+)
+
(define-method grab_focus
(of-object "GtkWidget")
(c-name "gtk_widget_grab_focus")
@@ -32313,6 +32514,21 @@
(return-type "gboolean")
)
+(define-method set_focus_visible
+ (of-object "GtkWindow")
+ (c-name "gtk_window_set_focus_visible")
+ (return-type "none")
+ (parameters
+ '("gboolean" "setting")
+ )
+)
+
+(define-method get_focus_visible
+ (of-object "GtkWindow")
+ (c-name "gtk_window_get_focus_visible")
+ (return-type "gboolean")
+)
+
(define-method set_resizable
(of-object "GtkWindow")
(c-name "gtk_window_set_resizable")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]