summaryrefslogtreecommitdiff
path: root/src/wx/timecode.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-01-11 21:02:11 +0100
committerCarl Hetherington <cth@carlh.net>2024-01-11 21:02:11 +0100
commit1900aff395ecace8bfa8bd367a2e0327f4d2736d (patch)
tree7963af756ae157c401313abf691b8b2a900a7a93 /src/wx/timecode.cc
parent054fa39c2c9c4adf3219669e16e6fe6f44838694 (diff)
Fix timecode order in RTL languages (part of #2696).
Diffstat (limited to 'src/wx/timecode.cc')
-rw-r--r--src/wx/timecode.cc29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/wx/timecode.cc b/src/wx/timecode.cc
index f4f0af07a..1e6a1930d 100644
--- a/src/wx/timecode.cc
+++ b/src/wx/timecode.cc
@@ -46,23 +46,30 @@ TimecodeBase::TimecodeBase (wxWindow* parent, bool set_button)
_sizer = new wxBoxSizer (wxHORIZONTAL);
+ std::vector<wxTextCtrl*> controls;
+
_editable = new wxPanel (this);
auto editable_sizer = new wxBoxSizer (wxHORIZONTAL);
_hours = new wxTextCtrl (_editable, wxID_ANY, wxT(""), wxDefaultPosition, s, 0, validator);
- _hours->SetMaxLength (2);
- editable_sizer->Add (_hours);
- add_label_to_sizer (editable_sizer, _editable, wxT(":"), false, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL);
+ controls.push_back(_hours);
_minutes = new wxTextCtrl (_editable, wxID_ANY, wxT(""), wxDefaultPosition, s, 0, validator);
- _minutes->SetMaxLength (2);
- editable_sizer->Add (_minutes);
- add_label_to_sizer (editable_sizer, _editable, wxT (":"), false, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL);
+ controls.push_back(_minutes);
_seconds = new wxTextCtrl (_editable, wxID_ANY, wxT(""), wxDefaultPosition, s, 0, validator);
- _seconds->SetMaxLength (2);
- editable_sizer->Add (_seconds);
- add_label_to_sizer (editable_sizer, _editable, wxT (":"), false, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL);
+ controls.push_back(_seconds);
_frames = new wxTextCtrl (_editable, wxID_ANY, wxT(""), wxDefaultPosition, s, 0, validator);
- _frames->SetMaxLength (2);
- editable_sizer->Add (_frames);
+ controls.push_back(_frames);
+
+ if (parent->GetLayoutDirection() == wxLayout_RightToLeft) {
+ std::reverse(controls.begin(), controls.end());
+ }
+
+ for (auto i = controls.begin(); i != controls.end(); ++i) {
+ (*i)->SetMaxLength(2);
+ editable_sizer->Add(*i);
+ if (std::next(i) != controls.end()) {
+ add_label_to_sizer(editable_sizer, _editable, wxT (":"), false, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL);
+ }
+ }
if (set_button) {
_set_button = new Button (_editable, _("Set"), wxDefaultPosition, small_button_size(parent, _("Set")));