[gtkmm-documentation] Add Gtk::ActionBar book example
- From: Juan R. Garcia Blanco <juanrgar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm-documentation] Add Gtk::ActionBar book example
- Date: Sat, 5 Apr 2014 11:45:17 +0000 (UTC)
commit 61fcc96e87409ec776d80424a3c5a1e4bdea43a8
Author: Juan R. GarcĂa Blanco <juanrgar gmail com>
Date: Thu Jan 30 21:50:29 2014 +0100
Add Gtk::ActionBar book example
examples/Makefile.am | 6 +++
examples/book/actionbar/examplewindow.cc | 63 ++++++++++++++++++++++++++++++
examples/book/actionbar/examplewindow.h | 47 ++++++++++++++++++++++
examples/book/actionbar/main.cc | 28 +++++++++++++
4 files changed, 144 insertions(+), 0 deletions(-)
---
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 399b1b0..31ae157 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -7,6 +7,7 @@ AM_CXXFLAGS = $(EXAMPLES_WXXFLAGS)
LDADD = $(GTKMM_LIBS)
check_PROGRAMS = \
+ book/actionbar/example \
book/alignment/example \
book/application/simple/example \
book/application/command_line_handling/example \
@@ -141,6 +142,11 @@ dist_noinst_DATA = \
book/iconview/xmms.xpm \
book/menus_and_toolbars/rain.png
+book_actionbar_example_SOURCES = \
+ book/actionbar/examplewindow.cc \
+ book/actionbar/examplewindow.h \
+ book/actionbar/main.cc
+
book_application_simple_example_SOURCES = \
book/application/simple/exampleapplication.cc \
book/application/simple/exampleapplication.h \
diff --git a/examples/book/actionbar/examplewindow.cc b/examples/book/actionbar/examplewindow.cc
new file mode 100644
index 0000000..00ead0b
--- /dev/null
+++ b/examples/book/actionbar/examplewindow.cc
@@ -0,0 +1,63 @@
+/* gtkmm example Copyright (C) 2013 gtkmm development team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "examplewindow.h"
+
+ExampleWindow::ExampleWindow()
+: m_gallery_button("Gallery"),
+ m_effects_button("Effects"),
+ m_box(Gtk::ORIENTATION_VERTICAL),
+ m_photo_box(Gtk::ORIENTATION_HORIZONTAL)
+{
+ // Window properties
+ set_title("ActionBar Example");
+ set_default_size(600, 400);
+
+ // Prefer dark theme
+ Glib::RefPtr<Gtk::Settings> settings = Gtk::Settings::get_default();
+ settings->property_gtk_application_prefer_dark_theme().set_value(true);
+
+ // Face
+ m_face_image.set_from_icon_name("face-cool", Gtk::IconSize(6));
+
+ // Center widget layout
+ m_prev_button.set_image_from_icon_name("go-previous-symbolic");
+ m_next_button.set_image_from_icon_name("go-next-symbolic");
+ m_photo_button.set_image_from_icon_name("media-record-symbolic");
+ m_photo_box.pack_start(m_prev_button, Gtk::PACK_SHRINK, 0);
+ m_photo_box.pack_start(m_photo_button, Gtk::PACK_SHRINK, 0);
+ m_photo_box.pack_start(m_next_button, Gtk::PACK_SHRINK, 0);
+ Glib::RefPtr<Gtk::StyleContext> style_context = m_photo_box.get_style_context();
+ style_context->add_class("raised");
+ style_context->add_class("linked");
+
+ // ActionBar layout
+ m_action_bar.pack_start(m_gallery_button);
+ m_action_bar.set_center_widget(m_photo_box);
+ m_action_bar.pack_end(m_effects_button);
+
+ // Layout
+ m_box.set_homogeneous(false);
+ m_box.pack_start(m_face_image, Gtk::PACK_EXPAND_WIDGET, 0);
+ m_box.pack_end(m_action_bar, Gtk::PACK_SHRINK, 0);
+ add(m_box);
+
+ show_all_children();
+}
+
+ExampleWindow::~ExampleWindow()
+{
+}
diff --git a/examples/book/actionbar/examplewindow.h b/examples/book/actionbar/examplewindow.h
new file mode 100644
index 0000000..ed473be
--- /dev/null
+++ b/examples/book/actionbar/examplewindow.h
@@ -0,0 +1,47 @@
+/* gtkmm example Copyright (C) 2013 gtkmm development team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef GTKMM_EXAMPLEWINDOW_H
+#define GTKMM_EXAMPLEWINDOW_H
+
+#include <gtkmm.h>
+
+class ExampleWindow : public Gtk::Window
+{
+public:
+ ExampleWindow();
+ virtual ~ExampleWindow();
+
+protected:
+ // Slots
+
+ // Widgets
+ Gtk::Image m_face_image;
+ Gtk::ActionBar m_action_bar;
+ Gtk::ToggleButton m_gallery_button;
+ Gtk::Button m_prev_button;
+ Gtk::Button m_next_button;
+ Gtk::Button m_photo_button;
+ Gtk::ToggleButton m_effects_button;
+
+ // Containers
+ Gtk::Box m_box;
+ Gtk::Box m_photo_box;
+
+private:
+};
+
+#endif // GTKMM_EXAMPLEWINDOW_H
diff --git a/examples/book/actionbar/main.cc b/examples/book/actionbar/main.cc
new file mode 100644
index 0000000..409dcc9
--- /dev/null
+++ b/examples/book/actionbar/main.cc
@@ -0,0 +1,28 @@
+/* gtkmm example Copyright (C) 2013 gtkmm development team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "examplewindow.h"
+#include <gtkmm/application.h>
+
+int main(int argc, char *argv[])
+{
+ Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv, "org.gtkmm.example.actionbar");
+
+ ExampleWindow window;
+
+ // Shows the window and returns when it is closed.
+ return app->run(window);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]