[chronojump] genericWindow show only one widget can be unsensitive



commit 3fda4bbbdbafce89d63df511f515db8f8f373a3a
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Oct 4 13:06:29 2019 +0200

    genericWindow show only one widget can be unsensitive

 src/gui/genericWindow.cs | 49 +++++++++++++++++++++++++++++++++++++++++++++---
 src/gui/person.cs        |  6 +++---
 src/gui/report.cs        |  2 +-
 src/gui/run.cs           |  2 +-
 src/gui/session.cs       |  2 +-
 5 files changed, 52 insertions(+), 9 deletions(-)
---
diff --git a/src/gui/genericWindow.cs b/src/gui/genericWindow.cs
index 7a4246b9..bb6156d7 100644
--- a/src/gui/genericWindow.cs
+++ b/src/gui/genericWindow.cs
@@ -167,7 +167,7 @@ public class GenericWindow
        }
 
        //for only one widget
-       static public GenericWindow Show (string title, string textHeader, Constants.GenericWindowShow stuff)
+       static public GenericWindow Show (string title, string textHeader, Constants.GenericWindowShow stuff, 
bool sensitive)
        {
                if (GenericWindowBox == null) {
                        GenericWindowBox = new GenericWindow(title, textHeader);
@@ -180,7 +180,7 @@ public class GenericWindow
 
                GenericWindowBox.hideWidgets();
 
-               GenericWindowBox.showWidget(stuff);
+               GenericWindowBox.showWidget(stuff, sensitive);
                GenericWindowBox.generic_window.Show ();
                
                return GenericWindowBox;
@@ -300,27 +300,58 @@ public class GenericWindow
                
        }
 
-       void showWidget(Constants.GenericWindowShow stuff) {
+       void showWidget(Constants.GenericWindowShow stuff, bool sensitive)
+       {
                if(stuff == Constants.GenericWindowShow.ENTRY)
+               {
                        entry.Show();
+                       entry.Sensitive = sensitive;
+               }
                else if(stuff == Constants.GenericWindowShow.ENTRY2)
+               {
                        hbox_entry2.Show();
+                       hbox_entry2.Sensitive = sensitive;
+               }
                else if(stuff == Constants.GenericWindowShow.ENTRY3)
+               {
                        hbox_entry3.Show();
+                       hbox_entry3.Sensitive = sensitive;
+               }
                else if(stuff == Constants.GenericWindowShow.SPININT)
+               {
                        hbox_spin_int.Show();
+                       hbox_spin_int.Sensitive = sensitive;
+               }
                else if(stuff == Constants.GenericWindowShow.SPINDOUBLE)
+               {
                        spin_double.Show();
+                       spin_double.Sensitive = sensitive;
+               }
                else if(stuff == Constants.GenericWindowShow.HBOXSPINDOUBLE2)
+               {
                        hbox_spin_double2.Show();
+                       hbox_spin_double2.Sensitive = sensitive;
+               }
                else if(stuff == Constants.GenericWindowShow.HEIGHTMETRIC)
+               {
                        hbox_height_metric.Show();
+                       hbox_height_metric.Sensitive = sensitive;
+               }
                else if(stuff == Constants.GenericWindowShow.CHECK1)
+               {
                        check1.Show();
+                       check1.Sensitive = sensitive;
+               }
                else if(stuff == Constants.GenericWindowShow.SPININT2)
+               {
                        hbox_spin_int2.Show();
+                       hbox_spin_int2.Sensitive = sensitive;
+               }
                else if(stuff == Constants.GenericWindowShow.SPININT3)
+               {
                        hbox_spin_int3.Show();
+                       hbox_spin_int3.Sensitive = sensitive;
+               }
                else if(stuff == Constants.GenericWindowShow.COMBO) {
                        //do later, we need to create them first
                        /*
@@ -329,11 +360,20 @@ public class GenericWindow
                        */
                }
                else if(stuff == Constants.GenericWindowShow.BUTTONMIDDLE)
+               {
                        hbuttonbox_middle.Show();
+                       hbuttonbox_middle.Sensitive = sensitive;
+               }
                else if(stuff == Constants.GenericWindowShow.TEXTVIEW)
+               {
                        scrolled_window_textview.Show();
+                       scrolled_window_textview.Sensitive = sensitive;
+               }
                else //if(stuff == Constants.GenericWindowShow.TREEVIEW)
+               {
                        scrolled_window_treeview.Show();
+                       scrolled_window_treeview.Sensitive = sensitive;
+               }
        }
 
        private void on_entries_changed (object o, EventArgs args)
@@ -914,6 +954,9 @@ public class GenericWindow
        public void ShowButtonCancel(bool show) {
                button_cancel.Visible = show;
        }
+       public void ShowButtonAccept(bool show) {
+               button_accept.Visible = show;
+       }
 
        private void on_button_cancel_clicked (object o, EventArgs args)
        {
diff --git a/src/gui/person.cs b/src/gui/person.cs
index 29bd76d6..d7f3ee79 100644
--- a/src/gui/person.cs
+++ b/src/gui/person.cs
@@ -1482,7 +1482,7 @@ public class PersonAddModifyWindow
        
        void on_button_height_metric_clicked(object obj, EventArgs args) 
        {
-               genericWin = GenericWindow.Show(Catalog.GetString("Height"), Catalog.GetString("Select your 
height"), Constants.GenericWindowShow.HEIGHTMETRIC);
+               genericWin = GenericWindow.Show(Catalog.GetString("Height"), Catalog.GetString("Select your 
height"), Constants.GenericWindowShow.HEIGHTMETRIC, true);
                genericWin.Button_accept.Clicked += new EventHandler(on_button_height_metric_accepted);
        }
        void on_button_height_metric_accepted (object obj, EventArgs args)
@@ -1500,7 +1500,7 @@ public class PersonAddModifyWindow
        {
                genericWin = GenericWindow.Show(Catalog.GetString("Weight"),
                                Catalog.GetString("Select your weight in pounds"),
-                               Constants.GenericWindowShow.SPINDOUBLE);
+                               Constants.GenericWindowShow.SPINDOUBLE, true);
                genericWin.Button_accept.Clicked += new EventHandler(on_button_weight_metric_accepted);
        }
        void on_button_weight_metric_accepted (object obj, EventArgs args)
@@ -1648,7 +1648,7 @@ public class PersonAddModifyWindow
                LogB.Information("sport add clicked");
                genericWin = GenericWindow.Show(Catalog.GetString("Add sport"),
                                Catalog.GetString("Add new sport to database"),
-                               Constants.GenericWindowShow.ENTRY);
+                               Constants.GenericWindowShow.ENTRY, true);
                genericWin.Button_accept.Clicked += new EventHandler(on_sport_add_accepted);
        }
 
diff --git a/src/gui/report.cs b/src/gui/report.cs
index cc82c83c..3ed6cacc 100644
--- a/src/gui/report.cs
+++ b/src/gui/report.cs
@@ -352,7 +352,7 @@ public class ReportWindow {
                        
                        genericWin = GenericWindow.Show(Catalog.GetString("Add comment"),
                                        Catalog.GetString("Comment this statistic"),
-                                       Constants.GenericWindowShow.TEXTVIEW);
+                                       Constants.GenericWindowShow.TEXTVIEW, true);
                        genericWin.SetTextview(comment);
                        genericWin.Button_accept.Clicked += new EventHandler(on_comment_add_accepted);
                }
diff --git a/src/gui/run.cs b/src/gui/run.cs
index 7ea3b1dd..73fb3111 100644
--- a/src/gui/run.cs
+++ b/src/gui/run.cs
@@ -1176,7 +1176,7 @@ public partial class ChronoJumpWindow
 
        private void createGenericWinForTrackDistance(bool simpleOrInterval, string text, string labelAtLeft, 
double initialValue)
        {
-               genericWin = GenericWindow.Show(Catalog.GetString("Track distance"), text, 
Constants.GenericWindowShow.HBOXSPINDOUBLE2);
+               genericWin = GenericWindow.Show(Catalog.GetString("Track distance"), text, 
Constants.GenericWindowShow.HBOXSPINDOUBLE2, true);
 
                genericWin.LabelSpinDouble2 = labelAtLeft;
                genericWin.SetSpinDouble2Increments(0.1, 1);
diff --git a/src/gui/session.cs b/src/gui/session.cs
index 2c416b0f..cc8c68fc 100644
--- a/src/gui/session.cs
+++ b/src/gui/session.cs
@@ -548,7 +548,7 @@ public class SessionAddEditWindow {
                LogB.Information("sport add clicked");
                genericWin = GenericWindow.Show(Catalog.GetString("Add sport"),
                                Catalog.GetString("Add new sport to database"),
-                               Constants.GenericWindowShow.ENTRY);
+                               Constants.GenericWindowShow.ENTRY, true);
                genericWin.Button_accept.Clicked += new EventHandler(on_sport_add_accepted);
        }
 


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