[gtkmm-documentation] Added a ScaleButton example.



commit e422990435726e09486dccc64a726cf1f86912b9
Author: Murray Cumming <murrayc murrayc com>
Date:   Sun Dec 7 19:59:40 2014 +0100

    Added a ScaleButton example.
    
    Just to test my corrections to its constructor.
    
    However, I don't know how it is really supposed to work.

 examples/Makefile.am                               |    6 +++
 examples/book/buttons/scalebutton/examplewindow.cc |   42 ++++++++++++++++++++
 examples/book/buttons/scalebutton/examplewindow.h  |   39 ++++++++++++++++++
 examples/book/buttons/scalebutton/main.cc          |   30 ++++++++++++++
 4 files changed, 117 insertions(+), 0 deletions(-)
---
diff --git a/examples/Makefile.am b/examples/Makefile.am
index e664bb0..4b0dfda 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -23,6 +23,7 @@ check_PROGRAMS =                                      \
        book/buttons/checkbutton/example                \
        book/buttons/filechooserbutton/example          \
        book/buttons/radiobutton/radiobuttons           \
+       book/buttons/scalebutton/example                        \
        book/buttons/togglebutton/example               \
        book/clipboard/ideal/example                    \
        book/clipboard/simple/example                   \
@@ -229,6 +230,11 @@ book_buttons_radiobutton_radiobuttons_SOURCES =            \
        book/buttons/radiobutton/radiobuttons.cc        \
        book/buttons/radiobutton/radiobuttons.h
 
+book_buttons_scalebutton_example_SOURCES =             \
+       book/buttons/scalebutton/examplewindow.cc       \
+       book/buttons/scalebutton/examplewindow.h        \
+       book/buttons/scalebutton/main.cc
+
 book_buttons_togglebutton_example_SOURCES =            \
        book/buttons/togglebutton/examplewindow.cc      \
        book/buttons/togglebutton/examplewindow.h       \
diff --git a/examples/book/buttons/scalebutton/examplewindow.cc 
b/examples/book/buttons/scalebutton/examplewindow.cc
new file mode 100644
index 0000000..bfc0ee9
--- /dev/null
+++ b/examples/book/buttons/scalebutton/examplewindow.cc
@@ -0,0 +1,42 @@
+//$Id: buttons.cc 836 2007-05-09 03:02:38Z jjongsma $ -*- c++ -*-
+
+/* gtkmm example Copyright (C) 2002 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 <iostream>
+
+ExampleWindow::ExampleWindow()
+: m_button(Gtk::ICON_SIZE_BUTTON, 0, 100, 10)
+{
+  m_button.set_label("Some Value");
+
+  set_title("ScaleButton Example");
+  set_border_width(12);
+
+  add(m_button);
+
+  show_all_children();
+}
+
+ExampleWindow::~ExampleWindow()
+{
+}
+
+void ExampleWindow::on_button_clicked()
+{
+  std::cout << "The Button was clicked." << std::endl;
+}
diff --git a/examples/book/buttons/scalebutton/examplewindow.h 
b/examples/book/buttons/scalebutton/examplewindow.h
new file mode 100644
index 0000000..20faf77
--- /dev/null
+++ b/examples/book/buttons/scalebutton/examplewindow.h
@@ -0,0 +1,39 @@
+//$Id: buttons.h 2 2003-01-21 13:41:59Z murrayc $ -*- c++ -*-
+
+/* gtkmm example Copyright (C) 2002 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_EXAMPLE_BUTTONS_H
+#define GTKMM_EXAMPLE_BUTTONS_H
+
+#include <gtkmm/window.h>
+#include <gtkmm/scalebutton.h>
+
+class ExampleWindow : public Gtk::Window
+{
+public:
+  ExampleWindow();
+  virtual ~ExampleWindow();
+
+protected:
+  //Signal handlers:
+  void on_button_clicked();
+
+  //Child widgets:
+  Gtk::ScaleButton m_button;
+};
+
+#endif //GTKMM_EXAMPLE_BUTTONS_H
diff --git a/examples/book/buttons/scalebutton/main.cc b/examples/book/buttons/scalebutton/main.cc
new file mode 100644
index 0000000..74145c8
--- /dev/null
+++ b/examples/book/buttons/scalebutton/main.cc
@@ -0,0 +1,30 @@
+//$Id: main.cc 836 2007-05-09 03:02:38Z jjongsma $ -*- c++ -*-
+
+/* gtkmm example Copyright (C) 2002 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");
+
+  ExampleWindow exampleWindow;
+
+  //Shows the window and returns when it is closed.
+  return app->run(exampleWindow);
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]