[gtkmm-documentation] Revealer Example: Match existing code style
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm-documentation] Revealer Example: Match existing code style
- Date: Wed, 7 Aug 2013 21:01:52 +0000 (UTC)
commit 70f291944bd2069f9bc232dbc54339901f84ab33
Author: Murray Cumming <murrayc murrayc com>
Date: Wed Aug 7 23:01:34 2013 +0200
Revealer Example: Match existing code style
.../{revealerwindow.cc => examplewindow.cc} | 96 +++++++++++---------
.../revealer/{revealerwindow.h => examplewindow.h} | 12 ++--
examples/book/revealer/main.cc | 4 +-
3 files changed, 59 insertions(+), 53 deletions(-)
---
diff --git a/examples/book/revealer/revealerwindow.cc b/examples/book/revealer/examplewindow.cc
similarity index 55%
rename from examples/book/revealer/revealerwindow.cc
rename to examples/book/revealer/examplewindow.cc
index 14c3eda..f8341c9 100644
--- a/examples/book/revealer/revealerwindow.cc
+++ b/examples/book/revealer/examplewindow.cc
@@ -14,11 +14,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "revealerwindow.h"
+#include "examplewindow.h"
-RevealerWindow::RevealerWindow()
-: m_label("A child widget."),
- m_vbox(Gtk::ORIENTATION_VERTICAL),
+ExampleWindow::ExampleWindow()
+: m_vbox(Gtk::ORIENTATION_VERTICAL),
+ m_label("A child widget."),
m_transition_duration(1.0, 0)
{
// Window properties
@@ -41,7 +41,7 @@ RevealerWindow::RevealerWindow()
// Switch
m_switch.set_active(true);
- m_switch.property_active().signal_changed().connect(sigc::mem_fun(*this,
&RevealerWindow::on_switch_active_changed));
+ m_switch.property_active().signal_changed().connect(sigc::mem_fun(*this,
&ExampleWindow::on_switch_active_changed));
// Revealer
m_revealer.add(m_label);
@@ -58,11 +58,11 @@ RevealerWindow::RevealerWindow()
show_all_children();
}
-RevealerWindow::~RevealerWindow()
+ExampleWindow::~ExampleWindow()
{
}
-void RevealerWindow::group_transition_type_buttons()
+void ExampleWindow::group_transition_type_buttons()
{
m_transition_type_buttons[1].join_group(m_transition_type_buttons[0]);
m_transition_type_buttons[2].join_group(m_transition_type_buttons[0]);
@@ -71,17 +71,17 @@ void RevealerWindow::group_transition_type_buttons()
m_transition_type_buttons[5].join_group(m_transition_type_buttons[0]);
}
-void RevealerWindow::format_transition_labels()
+void ExampleWindow::format_transition_labels()
{
- m_transition_type_buttons[0].set_label("None (NONE)");
- m_transition_type_buttons[1].set_label("Fade in (CROSSFADE)");
- m_transition_type_buttons[2].set_label("Slide in from the left (SLIDE_RIGHT)");
- m_transition_type_buttons[3].set_label("Slide in from the right (SLIDE_LEFT)");
- m_transition_type_buttons[4].set_label("Slide in from the bottom (SLIDE_UP)");
- m_transition_type_buttons[5].set_label("Slide in from the top (SLIDE_DOWN)");
+ m_transition_type_buttons[0].set_label("None (NONE)");
+ m_transition_type_buttons[1].set_label("Fade in (CROSSFADE)");
+ m_transition_type_buttons[2].set_label("Slide in from the left (SLIDE_RIGHT)");
+ m_transition_type_buttons[3].set_label("Slide in from the right (SLIDE_LEFT)");
+ m_transition_type_buttons[4].set_label("Slide in from the bottom (SLIDE_UP)");
+ m_transition_type_buttons[5].set_label("Slide in from the top (SLIDE_DOWN)");
}
-void RevealerWindow::compose_transition_selector()
+void ExampleWindow::compose_transition_selector()
{
m_transition_type_selector.pack_start(m_transition_type_buttons[0]);
m_transition_type_selector.pack_start(m_transition_type_buttons[1]);
@@ -91,40 +91,46 @@ void RevealerWindow::compose_transition_selector()
m_transition_type_selector.pack_start(m_transition_type_buttons[5]);
}
-void RevealerWindow::on_switch_active_changed()
+void ExampleWindow::on_switch_active_changed()
{
- bool reveal_child = m_switch.get_active();
- Gtk::RevealerTransitionType transition_type = get_selected_transition_type();
- guint transition_duration = m_transition_duration.get_value_as_int();
+ const bool reveal_child = m_switch.get_active();
+ const Gtk::RevealerTransitionType transition_type = get_selected_transition_type();
+ const guint transition_duration = m_transition_duration.get_value_as_int();
- m_revealer.set_transition_type(transition_type);
- m_revealer.set_transition_duration(transition_duration);
- m_revealer.set_reveal_child(reveal_child);
+ m_revealer.set_transition_type(transition_type);
+ m_revealer.set_transition_duration(transition_duration);
+ m_revealer.set_reveal_child(reveal_child);
}
-Gtk::RevealerTransitionType RevealerWindow::get_selected_transition_type()
+Gtk::RevealerTransitionType ExampleWindow::get_selected_transition_type()
{
- Gtk::RevealerTransitionType transition_type = Gtk::REVEALER_TRANSITION_TYPE_NONE;
-
- if (m_transition_type_buttons[0].get_active()) {
- transition_type = Gtk::REVEALER_TRANSITION_TYPE_NONE;
- }
- else if (m_transition_type_buttons[1].get_active()) {
- transition_type = Gtk::REVEALER_TRANSITION_TYPE_CROSSFADE;
- }
- else if (m_transition_type_buttons[2].get_active()) {
- transition_type = Gtk::REVEALER_TRANSITION_TYPE_SLIDE_RIGHT;
- }
- else if (m_transition_type_buttons[3].get_active()) {
- transition_type = Gtk::REVEALER_TRANSITION_TYPE_SLIDE_LEFT;
- }
- else if (m_transition_type_buttons[4].get_active()) {
- transition_type = Gtk::REVEALER_TRANSITION_TYPE_SLIDE_UP;
- }
- else if (m_transition_type_buttons[5].get_active()) {
- transition_type = Gtk::REVEALER_TRANSITION_TYPE_SLIDE_DOWN;
- }
-
- return transition_type;
+ Gtk::RevealerTransitionType transition_type = Gtk::REVEALER_TRANSITION_TYPE_NONE;
+
+ if (m_transition_type_buttons[0].get_active())
+ {
+ transition_type = Gtk::REVEALER_TRANSITION_TYPE_NONE;
+ }
+ else if (m_transition_type_buttons[1].get_active())
+ {
+ transition_type = Gtk::REVEALER_TRANSITION_TYPE_CROSSFADE;
+ }
+ else if (m_transition_type_buttons[2].get_active())
+ {
+ transition_type = Gtk::REVEALER_TRANSITION_TYPE_SLIDE_RIGHT;
+ }
+ else if (m_transition_type_buttons[3].get_active())
+ {
+ transition_type = Gtk::REVEALER_TRANSITION_TYPE_SLIDE_LEFT;
+ }
+ else if (m_transition_type_buttons[4].get_active())
+ {
+ transition_type = Gtk::REVEALER_TRANSITION_TYPE_SLIDE_UP;
+ }
+ else if (m_transition_type_buttons[5].get_active())
+ {
+ transition_type = Gtk::REVEALER_TRANSITION_TYPE_SLIDE_DOWN;
+ }
+
+ return transition_type;
}
diff --git a/examples/book/revealer/revealerwindow.h b/examples/book/revealer/examplewindow.h
similarity index 87%
rename from examples/book/revealer/revealerwindow.h
rename to examples/book/revealer/examplewindow.h
index 95d9846..3dfbc42 100644
--- a/examples/book/revealer/revealerwindow.h
+++ b/examples/book/revealer/examplewindow.h
@@ -14,16 +14,16 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef GTKMM_REVEALERWINDOW_H
-#define GTKMM_REVEALERWINDOW_H
+#ifndef GTKMM_EXAMPLEWINDOW_H
+#define GTKMM_EXAMPLEWINDOW_H
#include <gtkmm.h>
-class RevealerWindow : public Gtk::Window
+class ExampleWindow : public Gtk::Window
{
public:
- RevealerWindow();
- virtual ~RevealerWindow();
+ ExampleWindow();
+ virtual ~ExampleWindow();
protected:
// Slots
@@ -50,5 +50,5 @@ private:
Gtk::RevealerTransitionType get_selected_transition_type();
};
-#endif // GTKMM_REVEALERWINDOW_H
+#endif // GTKMM_EXAMPLEWINDOW_H
diff --git a/examples/book/revealer/main.cc b/examples/book/revealer/main.cc
index e24edea..cdc2b67 100644
--- a/examples/book/revealer/main.cc
+++ b/examples/book/revealer/main.cc
@@ -14,14 +14,14 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "revealerwindow.h"
+#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.revealer");
- RevealerWindow window;
+ 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]