gtkmm-documentation r78 - in trunk: . examples/book/range_widgets



Author: murrayc
Date: Tue Dec 16 08:16:30 2008
New Revision: 78
URL: http://svn.gnome.org/viewvc/gtkmm-documentation?rev=78&view=rev

Log:
2008-12-16  FabrÃcio Godoy  <skarllot gmail com>

* examples/book/range_widgets/examplewindow.cc: Remove unnecessary 
casts to int.

Modified:
   trunk/ChangeLog
   trunk/examples/book/range_widgets/examplewindow.cc

Modified: trunk/examples/book/range_widgets/examplewindow.cc
==============================================================================
--- trunk/examples/book/range_widgets/examplewindow.cc	(original)
+++ trunk/examples/book/range_widgets/examplewindow.cc	Tue Dec 16 08:16:30 2008
@@ -28,8 +28,8 @@
   m_HBox_Digits(false, 10),
   m_HBox_PageSize(false, 10),
 
-  // value, lower, upper, step_increment, page_increment, page_size
-  // note that the page_size value only makes a difference for
+  // Value, lower, upper, step_increment, page_increment, page_size:
+  // Note that the page_size value only makes a difference for
   // scrollbar widgets, and the highest value you'll get is actually
   // (upper - page_size).
   m_adjustment(0.0, 0.0, 101.0, 0.1, 1.0, 1.0),
@@ -41,13 +41,13 @@
   m_Scale_Digits(m_adjustment_digits),
   m_Scale_PageSize(m_adjustment_pagesize),
 
-  // a checkbutton to control whether the value is displayed or not
+  // A checkbutton to control whether the value is displayed or not:
   m_CheckButton("Display value on scale widgets", 0),
 
-  // reuse the same adjustment again
+  // Reuse the same adjustment again.
+  // Notice how this causes the scales to always be updated 
+  // continuously when the scrollbar is moved.
   m_Scrollbar(m_adjustment),
-  // notice how this causes the scales to always be update
-  // continuously when the scrollbar is moved
 
   m_Button_Quit("Quit")
 {
@@ -84,66 +84,66 @@
   //CheckButton:
   m_CheckButton.set_active();
   m_CheckButton.signal_toggled().connect( sigc::mem_fun(*this,
-              &ExampleWindow::on_checkbutton_toggled) );
+    &ExampleWindow::on_checkbutton_toggled) );
   m_VBox2.pack_start(m_CheckButton);
 
-  //OptionMenus:
+  //Menus:
   {
-      using namespace Gtk::Menu_Helpers;
+    using namespace Gtk::Menu_Helpers;
 
-      MenuList& list_vpos = m_Menu_Position.items();
-      list_vpos.push_back(
-              MenuElem("Top", sigc::bind(sigc::mem_fun(*this,
-                          &ExampleWindow::on_menu_position), Gtk::POS_TOP)));
-      list_vpos.push_back(
-              MenuElem("Bottom", sigc::bind(sigc::mem_fun(*this,
-                          &ExampleWindow::on_menu_position), Gtk::POS_BOTTOM)));
-      list_vpos.push_back(
-              MenuElem("Left", sigc::bind(sigc::mem_fun(*this,
-                          &ExampleWindow::on_menu_position), Gtk::POS_LEFT)));
-      list_vpos.push_back(
-              MenuElem("Right", sigc::bind(sigc::mem_fun(*this,
-                          &ExampleWindow::on_menu_position), Gtk::POS_RIGHT)));
-
-      m_VBox2.pack_start(
-              *Gtk::manage(new LabeledOptionMenu("Scale Value Position:",
-                      m_Menu_Position)));
-
-
-      MenuList& list_upd = m_Menu_Policy.items();
-      list_upd.push_back(
-              MenuElem("Continuous", sigc::bind(sigc::mem_fun(*this,
-                          &ExampleWindow::on_menu_policy),
-                      Gtk::UPDATE_CONTINUOUS)));
-      list_upd.push_back(
-              MenuElem("Discontinuous", sigc::bind(sigc::mem_fun(*this,
-                          &ExampleWindow::on_menu_policy),
-                      Gtk::UPDATE_DISCONTINUOUS)));
-      list_upd.push_back(
-              MenuElem("Delayed", sigc::bind(sigc::mem_fun(*this,
-                          &ExampleWindow::on_menu_policy),
-                      Gtk::UPDATE_DELAYED)));
-
-      m_VBox2.pack_start(
-              *Gtk::manage(new LabeledOptionMenu("Scale Update Policy:",
-                      m_Menu_Policy)));
+    MenuList& list_vpos = m_Menu_Position.items();
+    list_vpos.push_back(
+      MenuElem("Top", sigc::bind(sigc::mem_fun(*this,
+      &ExampleWindow::on_menu_position), Gtk::POS_TOP)));
+    list_vpos.push_back(
+      MenuElem("Bottom", sigc::bind(sigc::mem_fun(*this,
+      &ExampleWindow::on_menu_position), Gtk::POS_BOTTOM)));
+    list_vpos.push_back(
+      MenuElem("Left", sigc::bind(sigc::mem_fun(*this,
+      &ExampleWindow::on_menu_position), Gtk::POS_LEFT)));
+    list_vpos.push_back(
+      MenuElem("Right", sigc::bind(sigc::mem_fun(*this,
+      &ExampleWindow::on_menu_position), Gtk::POS_RIGHT)));
+
+    m_VBox2.pack_start(
+    *Gtk::manage(new LabeledOptionMenu("Scale Value Position:",
+      m_Menu_Position)));
+
+
+    MenuList& list_upd = m_Menu_Policy.items();
+    list_upd.push_back(
+      MenuElem("Continuous", sigc::bind(sigc::mem_fun(*this,
+      &ExampleWindow::on_menu_policy),
+      Gtk::UPDATE_CONTINUOUS)));
+    list_upd.push_back(
+      MenuElem("Discontinuous", sigc::bind(sigc::mem_fun(*this,
+      &ExampleWindow::on_menu_policy),
+      Gtk::UPDATE_DISCONTINUOUS)));
+    list_upd.push_back(
+      MenuElem("Delayed", sigc::bind(sigc::mem_fun(*this,
+      &ExampleWindow::on_menu_policy),
+      Gtk::UPDATE_DELAYED)));
+
+    m_VBox2.pack_start(
+      *Gtk::manage(new LabeledOptionMenu("Scale Update Policy:",
+      m_Menu_Policy)));
   }
 
   //Digits:
   m_HBox_Digits.pack_start(
-          *Gtk::manage(new Gtk::Label("Scale Digits:", 0)), Gtk::PACK_SHRINK);
+    *Gtk::manage(new Gtk::Label("Scale Digits:", 0)), Gtk::PACK_SHRINK);
   m_Scale_Digits.set_digits(0);
   m_adjustment_digits.signal_value_changed().connect(sigc::mem_fun(*this,
-              &ExampleWindow::on_adjustment1_value_changed));
+    &ExampleWindow::on_adjustment1_value_changed));
   m_HBox_Digits.pack_start(m_Scale_Digits);
 
   //Page Size:
   m_HBox_PageSize.pack_start(
-          *Gtk::manage(new Gtk::Label("Scrollbar Page Size:", 0)),
-          Gtk::PACK_SHRINK);
+    *Gtk::manage(new Gtk::Label("Scrollbar Page Size:", 0)),
+    Gtk::PACK_SHRINK);
   m_Scale_PageSize.set_digits(0);
   m_adjustment_pagesize.signal_value_changed().connect(sigc::mem_fun(*this,
-              &ExampleWindow::on_adjustment2_value_changed));
+    &ExampleWindow::on_adjustment2_value_changed));
   m_HBox_PageSize.pack_start(m_Scale_PageSize);
 
   m_VBox2.pack_start(m_HBox_Digits);
@@ -154,7 +154,7 @@
   m_Button_Quit.set_flags(Gtk::CAN_DEFAULT);
   m_Button_Quit.grab_default();
   m_Button_Quit.signal_clicked().connect(sigc::mem_fun(*this,
-              &ExampleWindow::on_button_quit));
+    &ExampleWindow::on_button_quit));
   m_Button_Quit.set_border_width(10);
 
   show_all_children();
@@ -166,40 +166,41 @@
 
 void ExampleWindow::on_checkbutton_toggled()
 {
-    m_VScale.set_draw_value(m_CheckButton.get_active());
-    m_HScale.set_draw_value(m_CheckButton.get_active());
+  m_VScale.set_draw_value(m_CheckButton.get_active());
+  m_HScale.set_draw_value(m_CheckButton.get_active());
 }
 
 void ExampleWindow::on_menu_position(Gtk::PositionType postype)
 {
-    m_VScale.set_value_pos(postype);
-    m_HScale.set_value_pos(postype);
+  m_VScale.set_value_pos(postype);
+  m_HScale.set_value_pos(postype);
 }
 
 void ExampleWindow::on_menu_policy(Gtk::UpdateType type)
 {
-    m_VScale.set_update_policy(type);
-    m_HScale.set_update_policy(type);
+  m_VScale.set_update_policy(type);
+  m_HScale.set_update_policy(type);
 }
 
 void ExampleWindow::on_adjustment1_value_changed()
 {
-    double val = m_adjustment_digits.get_value();
-    m_VScale.set_digits((int)val);
-    m_HScale.set_digits((int)val);
+  double val = m_adjustment_digits.get_value();
+  m_VScale.set_digits((int)val);
+  m_HScale.set_digits((int)val);
 }
 
 void ExampleWindow::on_adjustment2_value_changed()
 {
-    double val = m_adjustment_pagesize.get_value();
-    m_adjustment.set_page_size((int)val);
-    m_adjustment.set_page_increment((int)val);
+  double val = m_adjustment_pagesize.get_value();
+  m_adjustment.set_page_size(val);
+  m_adjustment.set_page_increment(val);
 
-    // note that we don't have to emit the "changed" signal;
-    // gtkmm does this for us
+  // Note that we don't have to emit the "changed" signal 
+  // because gtkmm does this for us.
 }
 
 void ExampleWindow::on_button_quit()
 {
-    hide();
+  hide();
 }
+



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