[gtkmm-documentation] Examples: Remove static_cast<int> on Gtk::ResponseType



commit 198b6a60bb5fd7f0cb827c861d2269d27bdaa733
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Sun Jun 11 13:31:26 2017 +0200

    Examples: Remove static_cast<int> on Gtk::ResponseType
    
    Gtk::ResponseType can now be implicitly converted to int. Bug 86864

 examples/book/dialogs/aboutdialog/examplewindow.cc |   12 ++++++------
 .../dialogs/colorchooserdialog/examplewindow.cc    |    4 ++--
 .../dialogs/filechooserdialog/examplewindow.cc     |    8 ++++----
 .../dialogs/fontchooserdialog/examplewindow.cc     |    4 ++--
 .../book/dialogs/messagedialog/examplewindow.cc    |    4 ++--
 examples/book/scrolledwindow/examplewindow.cc      |    4 ++--
 6 files changed, 18 insertions(+), 18 deletions(-)
---
diff --git a/examples/book/dialogs/aboutdialog/examplewindow.cc 
b/examples/book/dialogs/aboutdialog/examplewindow.cc
index 6d8eb73..0574f73 100644
--- a/examples/book/dialogs/aboutdialog/examplewindow.cc
+++ b/examples/book/dialogs/aboutdialog/examplewindow.cc
@@ -68,16 +68,16 @@ ExampleWindow::~ExampleWindow()
 void ExampleWindow::on_about_dialog_response(int response_id)
 {
   std::cout << response_id
-    << ", close=" << static_cast<int>(Gtk::ResponseType::CLOSE)
-    << ", cancel=" << static_cast<int>(Gtk::ResponseType::CANCEL)
-    << ", delete_event=" << static_cast<int>(Gtk::ResponseType::DELETE_EVENT)
+    << ", close=" << Gtk::ResponseType::CLOSE
+    << ", cancel=" << Gtk::ResponseType::CANCEL
+    << ", delete_event=" << Gtk::ResponseType::DELETE_EVENT
     << std::endl;
 
   switch (response_id)
   {
-  case static_cast<int>(Gtk::ResponseType::CLOSE):
-  case static_cast<int>(Gtk::ResponseType::CANCEL):
-  case static_cast<int>(Gtk::ResponseType::DELETE_EVENT):
+  case Gtk::ResponseType::CLOSE:
+  case Gtk::ResponseType::CANCEL:
+  case Gtk::ResponseType::DELETE_EVENT:
     m_Dialog.hide();
     break;
   default:
diff --git a/examples/book/dialogs/colorchooserdialog/examplewindow.cc 
b/examples/book/dialogs/colorchooserdialog/examplewindow.cc
index b393f8d..c5b2e18 100644
--- a/examples/book/dialogs/colorchooserdialog/examplewindow.cc
+++ b/examples/book/dialogs/colorchooserdialog/examplewindow.cc
@@ -68,14 +68,14 @@ void ExampleWindow::on_button_dialog_clicked()
   //Handle the response:
   switch(result)
   {
-    case static_cast<int>(Gtk::ResponseType::OK):
+    case Gtk::ResponseType::OK:
     {
       //Store the chosen color:
       m_Color = dialog.get_rgba();
       m_ColorButton.set_rgba(m_Color);
       break;
     }
-    case static_cast<int>(Gtk::ResponseType::CANCEL):
+    case Gtk::ResponseType::CANCEL:
     {
       std::cout << "Cancel clicked." << std::endl;
       break;
diff --git a/examples/book/dialogs/filechooserdialog/examplewindow.cc 
b/examples/book/dialogs/filechooserdialog/examplewindow.cc
index f3bdd53..1263cc5 100644
--- a/examples/book/dialogs/filechooserdialog/examplewindow.cc
+++ b/examples/book/dialogs/filechooserdialog/examplewindow.cc
@@ -55,14 +55,14 @@ void ExampleWindow::on_button_folder_clicked()
   //Handle the response:
   switch(result)
   {
-    case static_cast<int>(Gtk::ResponseType::OK):
+    case Gtk::ResponseType::OK:
     {
       std::cout << "Select clicked." << std::endl;
       std::cout << "Folder selected: " << dialog.get_filename()
           << std::endl;
       break;
     }
-    case static_cast<int>(Gtk::ResponseType::CANCEL):
+    case Gtk::ResponseType::CANCEL:
     {
       std::cout << "Cancel clicked." << std::endl;
       break;
@@ -110,7 +110,7 @@ void ExampleWindow::on_button_file_clicked()
   //Handle the response:
   switch(result)
   {
-    case static_cast<int>(Gtk::ResponseType::OK):
+    case Gtk::ResponseType::OK:
     {
       std::cout << "Open clicked." << std::endl;
 
@@ -119,7 +119,7 @@ void ExampleWindow::on_button_file_clicked()
       std::cout << "File selected: " <<  filename << std::endl;
       break;
     }
-    case static_cast<int>(Gtk::ResponseType::CANCEL):
+    case Gtk::ResponseType::CANCEL:
     {
       std::cout << "Cancel clicked." << std::endl;
       break;
diff --git a/examples/book/dialogs/fontchooserdialog/examplewindow.cc 
b/examples/book/dialogs/fontchooserdialog/examplewindow.cc
index 214df6b..1c071e5 100644
--- a/examples/book/dialogs/fontchooserdialog/examplewindow.cc
+++ b/examples/book/dialogs/fontchooserdialog/examplewindow.cc
@@ -59,14 +59,14 @@ void ExampleWindow::on_button_dialog_clicked()
   //Handle the response:
   switch(result)
   {
-    case static_cast<int>(Gtk::ResponseType::OK):
+    case Gtk::ResponseType::OK:
     {
       auto font_name = dialog.get_font();
       std::cout << "Font chosen: " << font_name << std::endl;
       m_FontButton.set_font_name(font_name);
       break;
     }
-    case static_cast<int>(Gtk::ResponseType::CANCEL):
+    case Gtk::ResponseType::CANCEL:
     {
       std::cout << "Cancel clicked." << std::endl;
       break;
diff --git a/examples/book/dialogs/messagedialog/examplewindow.cc 
b/examples/book/dialogs/messagedialog/examplewindow.cc
index 68bffdf..88839c2 100644
--- a/examples/book/dialogs/messagedialog/examplewindow.cc
+++ b/examples/book/dialogs/messagedialog/examplewindow.cc
@@ -63,12 +63,12 @@ void ExampleWindow::on_button_question_clicked()
   //Handle the response:
   switch(result)
   {
-    case static_cast<int>(Gtk::ResponseType::OK):
+    case Gtk::ResponseType::OK:
     {
       std::cout << "OK clicked." << std::endl;
       break;
     }
-    case static_cast<int>(Gtk::ResponseType::CANCEL):
+    case Gtk::ResponseType::CANCEL:
     {
       std::cout << "Cancel clicked." << std::endl;
       break;
diff --git a/examples/book/scrolledwindow/examplewindow.cc b/examples/book/scrolledwindow/examplewindow.cc
index 73899e2..8be849b 100644
--- a/examples/book/scrolledwindow/examplewindow.cc
+++ b/examples/book/scrolledwindow/examplewindow.cc
@@ -70,8 +70,8 @@ void ExampleWindow::on_dialog_response(int response_id)
 {
   switch (response_id)
   {
-  case static_cast<int>(Gtk::ResponseType::CLOSE):
-  case static_cast<int>(Gtk::ResponseType::DELETE_EVENT):
+  case Gtk::ResponseType::CLOSE:
+  case Gtk::ResponseType::DELETE_EVENT:
     hide();
     break;
   default:


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