Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmContactEditorTimezones: Implemented priority control
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 3 Sep 2017 09:44:08 +0000 (10:44 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 3 Sep 2017 09:44:08 +0000 (10:44 +0100)
source/AppXestiaAddrBk.cpp
source/AppXestiaAddrBk.h
source/contacteditor/frmContactEditorTimezones.cpp
source/contacteditor/frmContactEditorTimezones.h

index e6d6ead..77ae21d 100644 (file)
@@ -5745,71 +5745,26 @@ frmContactEditorTimezonesADT::frmContactEditorTimezonesADT( wxWindow* parent, wx
        
        nbkTimezone = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
        tabGeneral = new wxPanel( nbkTimezone, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
-       wxFlexGridSizer* fgSizer6;
-       fgSizer6 = new wxFlexGridSizer( 0, 2, 0, 0 );
-       fgSizer6->AddGrowableCol( 1 );
-       fgSizer6->SetFlexibleDirection( wxVERTICAL );
-       fgSizer6->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
+       szrGeneral = new wxFlexGridSizer( 2, 2, 0, 0 );
+       szrGeneral->AddGrowableCol( 1 );
+       szrGeneral->SetFlexibleDirection( wxBOTH );
+       szrGeneral->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
        
        lblTimezone = new wxStaticText( tabGeneral, wxID_ANY, wxT("Timezone:"), wxDefaultPosition, wxDefaultSize, 0 );
        lblTimezone->Wrap( -1 );
-       fgSizer6->Add( lblTimezone, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+       szrGeneral->Add( lblTimezone, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
        
        cmbTimezone = new wxComboBox( tabGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); 
-       fgSizer6->Add( cmbTimezone, 0, wxALL, 5 );
+       szrGeneral->Add( cmbTimezone, 0, wxALL, 5 );
        
        lblPriority = new wxStaticText( tabGeneral, wxID_ANY, wxT("Priority:"), wxDefaultPosition, wxDefaultSize, 0 );
        lblPriority->Wrap( -1 );
-       fgSizer6->Add( lblPriority, 0, wxALL, 5 );
-       
-       wxBoxSizer* bSizer260;
-       bSizer260 = new wxBoxSizer( wxHORIZONTAL );
-       
-       chkUsePref = new wxCheckBox( tabGeneral, wxID_ANY, wxT("Use"), wxDefaultPosition, wxDefaultSize, 0 );
-       bSizer260->Add( chkUsePref, 0, wxALL, 5 );
-       
-       wxBoxSizer* bSizer254;
-       bSizer254 = new wxBoxSizer( wxVERTICAL );
-       
-       wxBoxSizer* bSizer256;
-       bSizer256 = new wxBoxSizer( wxHORIZONTAL );
-       
-       sliPriority = new wxSlider( tabGeneral, wxID_ANY, 0, 1, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS );
-       bSizer256->Add( sliPriority, 1, wxALL|wxEXPAND, 5 );
-       
-       
-       bSizer254->Add( bSizer256, 1, wxEXPAND, 5 );
-       
-       wxBoxSizer* bSizer255;
-       bSizer255 = new wxBoxSizer( wxHORIZONTAL );
-       
-       lblHigh = new wxStaticText( tabGeneral, wxID_ANY, wxT("High"), wxDefaultPosition, wxDefaultSize, 0 );
-       lblHigh->Wrap( -1 );
-       bSizer255->Add( lblHigh, 0, wxALIGN_LEFT|wxALL, 5 );
-       
-       
-       bSizer255->Add( 0, 0, 1, wxEXPAND, 5 );
-       
-       lblLow = new wxStaticText( tabGeneral, wxID_ANY, wxT("Low"), wxDefaultPosition, wxDefaultSize, 0 );
-       lblLow->Wrap( -1 );
-       bSizer255->Add( lblLow, 0, wxALIGN_RIGHT|wxALL, 5 );
-       
-       
-       bSizer254->Add( bSizer255, 1, wxEXPAND, 0 );
-       
-       
-       bSizer260->Add( bSizer254, 1, wxEXPAND, 5 );
-       
-       
-       fgSizer6->Add( bSizer260, 1, wxEXPAND, 5 );
-       
-       
-       fgSizer6->Add( 0, 0, 1, wxEXPAND, 5 );
+       szrGeneral->Add( lblPriority, 0, wxALL, 5 );
        
        
-       tabGeneral->SetSizer( fgSizer6 );
+       tabGeneral->SetSizer( szrGeneral );
        tabGeneral->Layout();
-       fgSizer6->Fit( tabGeneral );
+       szrGeneral->Fit( tabGeneral );
        nbkTimezone->AddPage( tabGeneral, wxT("General"), false );
        
        bSizer251->Add( nbkTimezone, 1, wxEXPAND | wxALL, 5 );
@@ -5833,7 +5788,6 @@ frmContactEditorTimezonesADT::frmContactEditorTimezonesADT( wxWindow* parent, wx
        this->Centre( wxBOTH );
        
        // Connect Events
-       chkUsePref->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( frmContactEditorTimezonesADT::EnablePriority ), NULL, this );
        btnAction->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorTimezonesADT::ProcessAction ), NULL, this );
        btnClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorTimezonesADT::CloseWindow ), NULL, this );
 }
@@ -5841,7 +5795,6 @@ frmContactEditorTimezonesADT::frmContactEditorTimezonesADT( wxWindow* parent, wx
 frmContactEditorTimezonesADT::~frmContactEditorTimezonesADT()
 {
        // Disconnect Events
-       chkUsePref->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( frmContactEditorTimezonesADT::EnablePriority ), NULL, this );
        btnAction->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorTimezonesADT::ProcessAction ), NULL, this );
        btnClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorTimezonesADT::CloseWindow ), NULL, this );
        
index b679e4f..edc02d7 100644 (file)
@@ -1652,18 +1652,14 @@ class frmContactEditorTimezonesADT : public wxDialog
        protected:
                wxNotebook* nbkTimezone;
                wxPanel* tabGeneral;
+               wxFlexGridSizer* szrGeneral;
                wxStaticText* lblTimezone;
                wxComboBox* cmbTimezone;
                wxStaticText* lblPriority;
-               wxCheckBox* chkUsePref;
-               wxSlider* sliPriority;
-               wxStaticText* lblHigh;
-               wxStaticText* lblLow;
                wxButton* btnAction;
                wxButton* btnClose;
                
                // Virtual event handlers, overide them in your derived class
-               virtual void EnablePriority( wxCommandEvent& event ) { event.Skip(); }
                virtual void ProcessAction( wxCommandEvent& event ) { event.Skip(); }
                virtual void CloseWindow( wxCommandEvent& event ) { event.Skip(); }
                
index 398d0e1..7de1e7e 100644 (file)
@@ -19,6 +19,7 @@
 #include "frmContactEditorTimezones.h"
 #include <map>
 #include "../common/textprocessing.h"
+#include "../widgets/XABPriorityCtrl.h"
 
 frmContactEditorTimezones::frmContactEditorTimezones( wxWindow* parent )
 :
@@ -28,22 +29,11 @@ frmContactEditorTimezonesADT( parent )
        // Setup the window.
        
        EditorMode = FALSE;
-       sliPriority->Disable();
+       priorityCtrl = new XABPriorityCtrl(tabGeneral);
+       szrGeneral->Add(priorityCtrl, 1, wxEXPAND, 5);
        
 }
 
-void frmContactEditorTimezones::EnablePriority( wxCommandEvent& event )
-{
-       
-       // Enable/disable the priority setting.
-       
-       if (chkUsePref->IsChecked()){
-               sliPriority->Enable();
-       } else {
-               sliPriority->Disable();
-       }
-}
-
 void frmContactEditorTimezones::SetEditorMode(bool EditMode, SectionType SectType)
 {
 
@@ -83,9 +73,8 @@ void frmContactEditorTimezones::SetEditorMode(bool EditMode, SectionType SectTyp
                
                if (intiter->first == TZListIndex && intiter->second > 0){
                
-                       sliPriority->SetValue(intiter->second);
-                       sliPriority->Enable();
-                       chkUsePref->SetValue(TRUE);
+                       priorityCtrl->SetValue(intiter->second);
+                       priorityCtrl->EnablePriority(true);
                
                }       
                
@@ -130,9 +119,9 @@ void frmContactEditorTimezones::ProcessAction( wxCommandEvent& event )
                
                // Add Language priority.
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       TZListPrefPtr->insert(std::make_pair(TZListIndex, sliPriority->GetValue()));
+                       TZListPrefPtr->insert(std::make_pair(TZListIndex, priorityCtrl->GetValue()));
                
                } else {
                
@@ -149,9 +138,9 @@ void frmContactEditorTimezones::ProcessAction( wxCommandEvent& event )
                coldata.SetText(cmbTimezone->GetValue());
                ListCtrlIndex = TZListCtrlPtr->InsertItem(coldata);
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       TZListCtrlPtr->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), sliPriority->GetValue()));
+                       TZListCtrlPtr->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), priorityCtrl->GetValue()));
                
                }
                
@@ -170,9 +159,9 @@ void frmContactEditorTimezones::ProcessAction( wxCommandEvent& event )
                
                TZListPrefPtr->erase(TZListIndex);
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       TZListPrefPtr->insert(std::make_pair(TZListIndex, sliPriority->GetValue()));
+                       TZListPrefPtr->insert(std::make_pair(TZListIndex, priorityCtrl->GetValue()));
                
                } else {
                
@@ -190,9 +179,9 @@ void frmContactEditorTimezones::ProcessAction( wxCommandEvent& event )
                
                TZListCtrlPtr->SetItem(longSelected, 0, cmbTimezone->GetValue());               
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       TZListCtrlPtr->SetItem(longSelected, 1, wxString::Format(wxT("%i"), sliPriority->GetValue()));
+                       TZListCtrlPtr->SetItem(longSelected, 1, wxString::Format(wxT("%i"), priorityCtrl->GetValue()));
                
                } else {
                
index fe5d153..a71fc1a 100644 (file)
@@ -29,6 +29,7 @@ Subclass of frmContactEditorTimezonesADT, which is generated by wxFormBuilder.
 #include "../AppXestiaAddrBk.h"
 
 #include "../enums.h"
+#include "../widgets/XABPriorityCtrl.h"
 
 //// end generated include
 
@@ -37,7 +38,6 @@ class frmContactEditorTimezones : public frmContactEditorTimezonesADT
 {
        protected:
                // Handlers for frmContactEditorTimezonesADT events.
-               void EnablePriority( wxCommandEvent& event );
                void ProcessAction( wxCommandEvent& event );
                void CloseWindow( wxCommandEvent& event );
        public:
@@ -66,8 +66,7 @@ class frmContactEditorTimezones : public frmContactEditorTimezonesADT
                wxListCtrl *TZListCtrlPtr;
                int TZListIndex;
                SectionType EditSectionType;    
-
-       
+               XABPriorityCtrl *priorityCtrl = nullptr;
 };
 
 #endif // __frmContactEditorTimezones__
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy