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

index fcb9c4c..c67777a 100644 (file)
@@ -5586,67 +5586,21 @@ frmContactEditorTelephoneADT::frmContactEditorTelephoneADT( wxWindow* parent, wx
        
        nbkAddress = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
        tabGeneral = new wxPanel( nbkAddress, 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( 3, 2, 0, 0 );
+       szrGeneral->AddGrowableCol( 1 );
+       szrGeneral->SetFlexibleDirection( wxBOTH );
+       szrGeneral->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
        
        lblTelephone = new wxStaticText( tabGeneral, wxID_ANY, wxT("Telephone:"), wxDefaultPosition, wxDefaultSize, 0 );
        lblTelephone->Wrap( -1 );
-       fgSizer6->Add( lblTelephone, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+       szrGeneral->Add( lblTelephone, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
        
        txtTelephone = new wxTextCtrl( tabGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
-       fgSizer6->Add( txtTelephone, 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, 0, wxEXPAND, 0 );
-       
-       
-       bSizer260->Add( bSizer254, 1, wxEXPAND, 5 );
-       
-       
-       fgSizer6->Add( bSizer260, 1, wxEXPAND, 5 );
+       szrGeneral->Add( txtTelephone, 0, wxALL|wxEXPAND, 5 );
        
        lblTelephoneType = new wxStaticText( tabGeneral, wxID_ANY, wxT("Type:"), wxDefaultPosition, wxDefaultSize, 0 );
        lblTelephoneType->Wrap( 0 );
-       fgSizer6->Add( lblTelephoneType, 0, wxALIGN_TOP|wxALL, 5 );
+       szrGeneral->Add( lblTelephoneType, 0, wxALIGN_TOP|wxALL, 5 );
        
        wxGridSizer* gSizer5;
        gSizer5 = new wxGridSizer( 0, 2, 0, 0 );
@@ -5673,12 +5627,16 @@ frmContactEditorTelephoneADT::frmContactEditorTelephoneADT( wxWindow* parent, wx
        gSizer5->Add( chkPager, 0, wxALL, 2 );
        
        
-       fgSizer6->Add( gSizer5, 1, 0, 5 );
+       szrGeneral->Add( gSizer5, 1, 0, 5 );
        
+       lblPriority = new wxStaticText( tabGeneral, wxID_ANY, wxT("Priority:"), wxDefaultPosition, wxDefaultSize, 0 );
+       lblPriority->Wrap( -1 );
+       szrGeneral->Add( lblPriority, 0, wxALL, 5 );
        
-       tabGeneral->SetSizer( fgSizer6 );
+       
+       tabGeneral->SetSizer( szrGeneral );
        tabGeneral->Layout();
-       fgSizer6->Fit( tabGeneral );
+       szrGeneral->Fit( tabGeneral );
        nbkAddress->AddPage( tabGeneral, wxT("General"), false );
        
        bSizer251->Add( nbkAddress, 1, wxEXPAND | wxALL, 5 );
@@ -5702,7 +5660,6 @@ frmContactEditorTelephoneADT::frmContactEditorTelephoneADT( wxWindow* parent, wx
        this->Centre( wxBOTH );
        
        // Connect Events
-       chkUsePref->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( frmContactEditorTelephoneADT::EnablePriority ), NULL, this );
        btnAction->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorTelephoneADT::ProcessAction ), NULL, this );
        btnClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorTelephoneADT::CloseWindow ), NULL, this );
 }
@@ -5710,7 +5667,6 @@ frmContactEditorTelephoneADT::frmContactEditorTelephoneADT( wxWindow* parent, wx
 frmContactEditorTelephoneADT::~frmContactEditorTelephoneADT()
 {
        // Disconnect Events
-       chkUsePref->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( frmContactEditorTelephoneADT::EnablePriority ), NULL, this );
        btnAction->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorTelephoneADT::ProcessAction ), NULL, this );
        btnClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorTelephoneADT::CloseWindow ), NULL, this );
        
index 038aca4..d7f22b4 100644 (file)
@@ -1586,13 +1586,9 @@ class frmContactEditorTelephoneADT : public wxDialog
        protected:
                wxNotebook* nbkAddress;
                wxPanel* tabGeneral;
+               wxFlexGridSizer* szrGeneral;
                wxStaticText* lblTelephone;
                wxTextCtrl* txtTelephone;
-               wxStaticText* lblPriority;
-               wxCheckBox* chkUsePref;
-               wxSlider* sliPriority;
-               wxStaticText* lblHigh;
-               wxStaticText* lblLow;
                wxStaticText* lblTelephoneType;
                wxCheckBox* chkVoice;
                wxCheckBox* chkText;
@@ -1601,18 +1597,18 @@ class frmContactEditorTelephoneADT : public wxDialog
                wxCheckBox* chkVideo;
                wxCheckBox* chkTextphone;
                wxCheckBox* chkPager;
+               wxStaticText* lblPriority;
                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:
                
-               frmContactEditorTelephoneADT( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Telephone Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 402,331 ), long style = wxDEFAULT_DIALOG_STYLE ); 
+               frmContactEditorTelephoneADT( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Telephone Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 402,358 ), long style = wxDEFAULT_DIALOG_STYLE ); 
                ~frmContactEditorTelephoneADT();
        
 };
index 0df8d2b..0b609b2 100644 (file)
@@ -28,20 +28,8 @@ frmContactEditorTelephoneADT( parent )
        // Setup the window.
        
        EditorMode = FALSE;
-       sliPriority->Disable(); 
-       
-}
-
-void frmContactEditorTelephone::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);
        
 }
 
@@ -192,9 +180,9 @@ void frmContactEditorTelephone::ProcessAction( wxCommandEvent& event )
                
                // Add Telephone Priority.
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       TelephoneListPrefPtr->insert(std::make_pair(TelephoneListIndex, sliPriority->GetValue()));
+                       TelephoneListPrefPtr->insert(std::make_pair(TelephoneListIndex, priorityCtrl->GetValue()));
                
                } else {
                
@@ -215,9 +203,9 @@ void frmContactEditorTelephone::ProcessAction( wxCommandEvent& event )
                
                TelephoneListCtrlPtr->SetItem(ListCtrlIndex, 1, strTelTypesLCtrl);
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       TelephoneListCtrlPtr->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), sliPriority->GetValue()));
+                       TelephoneListCtrlPtr->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), priorityCtrl->GetValue()));
                
                }               
        
@@ -371,9 +359,9 @@ void frmContactEditorTelephone::ProcessAction( wxCommandEvent& event )
                
                TelephoneListPrefPtr->erase(TelephoneListIndex);
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       TelephoneListPrefPtr->insert(std::make_pair(TelephoneListIndex, sliPriority->GetValue()));
+                       TelephoneListPrefPtr->insert(std::make_pair(TelephoneListIndex, priorityCtrl->GetValue()));
                
                } else {
                
@@ -394,9 +382,9 @@ void frmContactEditorTelephone::ProcessAction( wxCommandEvent& event )
                TelephoneListCtrlPtr->SetItem(longSelected, 0, txtTelephone->GetValue());
                TelephoneListCtrlPtr->SetItem(longSelected, 1, strTelTypesLCtrl);
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       TelephoneListCtrlPtr->SetItem(longSelected, 2, wxString::Format(wxT("%i"), sliPriority->GetValue()));
+                       TelephoneListCtrlPtr->SetItem(longSelected, 2, wxString::Format(wxT("%i"), priorityCtrl->GetValue()));
                
                } else {
                
@@ -541,9 +529,8 @@ void frmContactEditorTelephone::SetEditorMode(bool EditMode, SectionType SectTyp
                if (intiter->first == TelephoneListIndex && intiter->second > 0 &&
                        intiter != TelephoneListPrefPtr->end()){
                
-                       sliPriority->SetValue(intiter->second);
-                       sliPriority->Enable();
-                       chkUsePref->SetValue(TRUE);
+                       priorityCtrl->SetValue(intiter->second);
+                       priorityCtrl->EnablePriority(true);
                
                }               
                
index 4ec5d83..1bda35e 100644 (file)
@@ -27,6 +27,7 @@ Subclass of frmContactEditorTelephoneADT, which is generated by wxFormBuilder.
 #include <map>
 #include "../AppXestiaAddrBk.h"
 #include "../enums.h"
+#include "../widgets/XABPriorityCtrl.h"
 
 //// end generated include
 
@@ -35,7 +36,6 @@ class frmContactEditorTelephone : public frmContactEditorTelephoneADT
 {
        protected:
                // Handlers for frmContactEditorTelephoneADT events.
-               void EnablePriority( wxCommandEvent& event );
                void ProcessAction( wxCommandEvent& event );
                void CloseWindow( wxCommandEvent& event );
        public:
@@ -66,7 +66,7 @@ class frmContactEditorTelephone : public frmContactEditorTelephoneADT
                wxListCtrl *TelephoneListCtrlPtr;
                int TelephoneListIndex;
                SectionType EditSectionType;    
-       
+               XABPriorityCtrl *priorityCtrl = nullptr;
 };
 
 #endif // __frmContactEditorTelephone__
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