[gtkmm] Gtk::Dialog: Add constructors with DialogFlags
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Gtk::Dialog: Add constructors with DialogFlags
- Date: Thu, 23 Oct 2014 16:40:19 +0000 (UTC)
commit 792c5178e84d9dbddba3af6f691548cd76054598
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date: Thu Oct 23 18:34:46 2014 +0200
Gtk::Dialog: Add constructors with DialogFlags
* gtk/src/dialog.[hg|ccg]: Wrap enum GtkDialogFlags. Add constructors that
wrap gtk_dialog_new_with_buttons() and take a Gtk::DialogFlags parameter.
A dialog can then be created with a header bar. Bug #738513.
gtk/src/dialog.ccg | 24 ++++++++++++++++++++++++
gtk/src/dialog.hg | 9 ++++++++-
2 files changed, 32 insertions(+), 1 deletions(-)
---
diff --git a/gtk/src/dialog.ccg b/gtk/src/dialog.ccg
index 6558a06..bf5a27e 100644
--- a/gtk/src/dialog.ccg
+++ b/gtk/src/dialog.ccg
@@ -35,6 +35,30 @@ Dialog::Dialog(const Glib::ustring& title, bool modal)
set_modal(modal);
}
+Dialog::Dialog(const Glib::ustring& title, DialogFlags flags)
+:
+ // Mark this class as non-derived to allow C++ vfuncs to be skipped.
+ Glib::ObjectBase(0),
+ // G_GNUC_NULL_TERMINATED in the declaration of gtk_dialog_new_with_buttons()
+ // makes it necessary to add at least one parameter corresponding to the ...,
+ // and end with a null pointer.
+ Gtk::Window((GtkWindow*)gtk_dialog_new_with_buttons(title.c_str(), 0,
+ (GtkDialogFlags)flags, 0, RESPONSE_NONE, static_cast<const char*>(0)))
+{
+}
+
+Dialog::Dialog(const Glib::ustring& title, Gtk::Window& parent, DialogFlags flags)
+:
+ // Mark this class as non-derived to allow C++ vfuncs to be skipped.
+ Glib::ObjectBase(0),
+ // G_GNUC_NULL_TERMINATED in the declaration of gtk_dialog_new_with_buttons()
+ // makes it necessary to add at least one parameter corresponding to the ...,
+ // and end with a null pointer.
+ Gtk::Window((GtkWindow*)gtk_dialog_new_with_buttons(title.c_str(), parent.gobj(),
+ (GtkDialogFlags)flags, 0, RESPONSE_NONE, static_cast<const char*>(0)))
+{
+}
+
_DEPRECATE_IFDEF_START
void Dialog::set_alternative_button_order_from_array(const std::vector<int>& new_order)
{
diff --git a/gtk/src/dialog.hg b/gtk/src/dialog.hg
index 20d2988..061f019 100644
--- a/gtk/src/dialog.hg
+++ b/gtk/src/dialog.hg
@@ -40,6 +40,7 @@ namespace Gtk
*/
_CC_INCLUDE(gtk/gtk.h)
+_WRAP_ENUM(DialogFlags, GtkDialogFlags)
_WRAP_ENUM(ResponseType, GtkResponseType)
/** Create popup windows.
@@ -62,7 +63,7 @@ _WRAP_ENUM(ResponseType, GtkResponseType)
* signal_response() with a "response id" you specified. You are encouraged
* to use the Gtk::ResponseType enum. If a dialog receives a delete event,
* the "response" signal will be emitted with a response id of
- * Gtk::RESPONSE_NONE.
+ * Gtk::RESPONSE_DELETE_EVENT.
*
* If you want to block waiting for a dialog to return before returning control
* flow to your code, you can call run(). This function enters a
@@ -80,6 +81,12 @@ public:
_CTOR_DEFAULT()
explicit Dialog(const Glib::ustring& title, bool modal = false);
Dialog(const Glib::ustring& title, Gtk::Window& parent, bool modal = false);
+ /** @newin{3,16}
+ */
+ Dialog(const Glib::ustring& title, DialogFlags flags);
+ /** @newin{3,16}
+ */
+ Dialog(const Glib::ustring& title, Gtk::Window& parent, DialogFlags flags);
_WRAP_METHOD(void add_action_widget(Widget& child, int response_id), gtk_dialog_add_action_widget)
_WRAP_METHOD(Button* add_button(const Glib::ustring& button_text, int response_id), gtk_dialog_add_button)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]