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

index c67777a..e6d6ead 100644 (file)
@@ -5681,71 +5681,26 @@ frmContactEditorLanguagesADT::frmContactEditorLanguagesADT( wxWindow* parent, wx
        
        nbkLanguages = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
        tabGeneral = new wxPanel( nbkLanguages, 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 );
        
        lblLanguage = new wxStaticText( tabGeneral, wxID_ANY, wxT("Language:"), wxDefaultPosition, wxDefaultSize, 0 );
        lblLanguage->Wrap( -1 );
-       fgSizer6->Add( lblLanguage, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+       szrGeneral->Add( lblLanguage, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
        
        txtLanguage = new wxTextCtrl( tabGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
-       fgSizer6->Add( txtLanguage, 0, wxALL|wxEXPAND, 5 );
+       szrGeneral->Add( txtLanguage, 0, wxALL|wxEXPAND, 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 );
        nbkLanguages->AddPage( tabGeneral, wxT("General"), false );
        
        bSizer251->Add( nbkLanguages, 1, wxEXPAND | wxALL, 5 );
@@ -5769,7 +5724,6 @@ frmContactEditorLanguagesADT::frmContactEditorLanguagesADT( wxWindow* parent, wx
        this->Centre( wxBOTH );
        
        // Connect Events
-       chkUsePref->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( frmContactEditorLanguagesADT::EnablePriority ), NULL, this );
        btnAction->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorLanguagesADT::ProcessAction ), NULL, this );
        btnClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorLanguagesADT::CloseWindow ), NULL, this );
 }
@@ -5777,7 +5731,6 @@ frmContactEditorLanguagesADT::frmContactEditorLanguagesADT( wxWindow* parent, wx
 frmContactEditorLanguagesADT::~frmContactEditorLanguagesADT()
 {
        // Disconnect Events
-       chkUsePref->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( frmContactEditorLanguagesADT::EnablePriority ), NULL, this );
        btnAction->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorLanguagesADT::ProcessAction ), NULL, this );
        btnClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorLanguagesADT::CloseWindow ), NULL, this );
        
index d7f22b4..b679e4f 100644 (file)
@@ -1623,25 +1623,21 @@ class frmContactEditorLanguagesADT : public wxDialog
        protected:
                wxNotebook* nbkLanguages;
                wxPanel* tabGeneral;
+               wxFlexGridSizer* szrGeneral;
                wxStaticText* lblLanguage;
                wxTextCtrl* txtLanguage;
                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(); }
                
        
        public:
                
-               frmContactEditorLanguagesADT( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Language Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 369,206 ), long style = wxDEFAULT_DIALOG_STYLE ); 
+               frmContactEditorLanguagesADT( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Language Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 369,227 ), long style = wxDEFAULT_DIALOG_STYLE ); 
                ~frmContactEditorLanguagesADT();
        
 };
index 26f67b0..c40c654 100644 (file)
@@ -28,19 +28,8 @@ frmContactEditorLanguagesADT( parent )
        // Setup the window.
        
        EditorMode = FALSE;
-       sliPriority->Disable();
-}
-
-void frmContactEditorLanguages::EnablePriority( wxCommandEvent& event )
-{
-       
-       // Enable/disable the priority setting.
-       
-       if (chkUsePref->IsChecked()){
-               sliPriority->Enable();
-       } else {
-               sliPriority->Disable();
-       }
+       priorityCtrl = new XABPriorityCtrl(tabGeneral);
+       szrGeneral->Add(priorityCtrl, 1, wxEXPAND, 5);
        
 }
 
@@ -84,9 +73,8 @@ void frmContactEditorLanguages::SetEditorMode(bool EditMode, SectionType SectTyp
                if (intiter->first == LanguageListIndex && intiter->second > 0 &&
                        intiter != LanguageListPrefPtr->end()){
                
-                       sliPriority->SetValue(intiter->second);
-                       sliPriority->Enable();
-                       chkUsePref->SetValue(TRUE);
+                       priorityCtrl->SetValue(intiter->second);
+                       priorityCtrl->EnablePriority(true);
                
                }       
                
@@ -130,9 +118,9 @@ void frmContactEditorLanguages::ProcessAction( wxCommandEvent& event )
                
                // Add Language priority.
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       LanguageListPrefPtr->insert(std::make_pair(LanguageListIndex, sliPriority->GetValue()));
+                       LanguageListPrefPtr->insert(std::make_pair(LanguageListIndex, priorityCtrl->GetValue()));
                
                } else {
                
@@ -149,9 +137,9 @@ void frmContactEditorLanguages::ProcessAction( wxCommandEvent& event )
                coldata.SetText(txtLanguage->GetValue());
                ListCtrlIndex = LanguageListCtrlPtr->InsertItem(coldata);
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       LanguageListCtrlPtr->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), sliPriority->GetValue()));
+                       LanguageListCtrlPtr->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), priorityCtrl->GetValue()));
                
                }
                
@@ -170,9 +158,9 @@ void frmContactEditorLanguages::ProcessAction( wxCommandEvent& event )
                
                LanguageListPrefPtr->erase(LanguageListIndex);
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       LanguageListPrefPtr->insert(std::make_pair(LanguageListIndex, sliPriority->GetValue()));
+                       LanguageListPrefPtr->insert(std::make_pair(LanguageListIndex, priorityCtrl->GetValue()));
                
                } else {
                
@@ -190,9 +178,9 @@ void frmContactEditorLanguages::ProcessAction( wxCommandEvent& event )
                
                LanguageListCtrlPtr->SetItem(longSelected, 0, txtLanguage->GetValue());         
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       LanguageListCtrlPtr->SetItem(longSelected, 1, wxString::Format(wxT("%i"), sliPriority->GetValue()));
+                       LanguageListCtrlPtr->SetItem(longSelected, 1, wxString::Format(wxT("%i"), priorityCtrl->GetValue()));
                
                } else {
                
index 71477d3..0f8c280 100644 (file)
@@ -30,6 +30,7 @@ Subclass of frmContactEditorLanguagesADT, which is generated by wxFormBuilder.
 //// end generated include
 
 #include "../enums.h"
+#include "../widgets/XABPriorityCtrl.h"
 
 /** Implementing frmContactEditorLanguagesADT */
 class frmContactEditorLanguages : public frmContactEditorLanguagesADT
@@ -63,7 +64,7 @@ class frmContactEditorLanguages : public frmContactEditorLanguagesADT
                wxListCtrl *LanguageListCtrlPtr;
                int LanguageListIndex;
                SectionType EditSectionType;    
-
+               XABPriorityCtrl *priorityCtrl = nullptr;
 };
 
 #endif // __frmContactEditorLanguages__
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