summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-02-07 22:49:27 +0000
committerCarl Hetherington <cth@carlh.net>2015-02-07 22:49:27 +0000
commit740c1003590d4af8112939a775f2a0b20b2f5ae7 (patch)
tree07e4e1c984c95d0b879800a87796d51842bfa308 /src
parent1355b2068548aa14a054d7dac31cb6589ab5430f (diff)
Update sensitivity of Set File button correctly.
Diffstat (limited to 'src')
-rw-r--r--src/wx/fonts_dialog.cc18
-rw-r--r--src/wx/fonts_dialog.h4
2 files changed, 20 insertions, 2 deletions
diff --git a/src/wx/fonts_dialog.cc b/src/wx/fonts_dialog.cc
index 99d570263..a4a3d26c4 100644
--- a/src/wx/fonts_dialog.cc
+++ b/src/wx/fonts_dialog.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -70,8 +70,11 @@ FontsDialog::FontsDialog (wxWindow* parent, shared_ptr<SubtitleContent> content)
SetSizerAndFit (overall_sizer);
_set_file->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FontsDialog::set_file_clicked, this));
+ _fonts->Bind (wxEVT_COMMAND_LIST_ITEM_SELECTED, boost::bind (&FontsDialog::selection_changed, this));
+ _fonts->Bind (wxEVT_COMMAND_LIST_ITEM_DESELECTED, boost::bind (&FontsDialog::selection_changed, this));
setup ();
+ update_sensitivity ();
}
void
@@ -134,3 +137,16 @@ FontsDialog::set_file_clicked ()
setup ();
}
+
+void
+FontsDialog::selection_changed ()
+{
+ update_sensitivity ();
+}
+
+void
+FontsDialog::update_sensitivity ()
+{
+ int const item = _fonts->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ _set_file->Enable (item != -1);
+}
diff --git a/src/wx/fonts_dialog.h b/src/wx/fonts_dialog.h
index c7ca789b8..76eae3ec2 100644
--- a/src/wx/fonts_dialog.h
+++ b/src/wx/fonts_dialog.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -31,6 +31,8 @@ public:
private:
void setup ();
void set_file_clicked ();
+ void update_sensitivity ();
+ void selection_changed ();
boost::weak_ptr<SubtitleContent> _content;
wxListCtrl* _fonts;