Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmContactEditorEmail: Implemented priority control
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sat, 2 Sep 2017 19:57:05 +0000 (20:57 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sat, 2 Sep 2017 19:57:05 +0000 (20:57 +0100)
source/AppXestiaAddrBk.cpp
source/AppXestiaAddrBk.h
source/contacteditor/frmContactEditorEmail.cpp
source/contacteditor/frmContactEditorEmail.h

index 2203e39..4a0c243 100644 (file)
@@ -5378,71 +5378,26 @@ frmContactEditorEmailADT::frmContactEditorEmailADT( wxWindow* parent, wxWindowID
        
        nbkEmail = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
        tabGeneral = new wxPanel( nbkEmail, 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 );
        
        lblEmailAddress = new wxStaticText( tabGeneral, wxID_ANY, wxT("E-mail Address:"), wxDefaultPosition, wxDefaultSize, 0 );
        lblEmailAddress->Wrap( -1 );
-       fgSizer6->Add( lblEmailAddress, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+       szrGeneral->Add( lblEmailAddress, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
        
        txtEmail = new wxTextCtrl( tabGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
-       fgSizer6->Add( txtEmail, 0, wxALL|wxEXPAND, 5 );
+       szrGeneral->Add( txtEmail, 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 );
        nbkEmail->AddPage( tabGeneral, wxT("General"), false );
        
        bSizer251->Add( nbkEmail, 1, wxEXPAND | wxALL, 5 );
@@ -5466,7 +5421,6 @@ frmContactEditorEmailADT::frmContactEditorEmailADT( wxWindow* parent, wxWindowID
        this->Centre( wxBOTH );
        
        // Connect Events
-       chkUsePref->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( frmContactEditorEmailADT::EnablePriority ), NULL, this );
        btnAction->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorEmailADT::ProcessData ), NULL, this );
        btnClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorEmailADT::CloseWindow ), NULL, this );
 }
@@ -5474,7 +5428,6 @@ frmContactEditorEmailADT::frmContactEditorEmailADT( wxWindow* parent, wxWindowID
 frmContactEditorEmailADT::~frmContactEditorEmailADT()
 {
        // Disconnect Events
-       chkUsePref->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( frmContactEditorEmailADT::EnablePriority ), NULL, this );
        btnAction->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorEmailADT::ProcessData ), NULL, this );
        btnClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorEmailADT::CloseWindow ), NULL, this );
        
index 8ee17be..b90b41c 100644 (file)
@@ -1495,18 +1495,14 @@ class frmContactEditorEmailADT : public wxDialog
        protected:
                wxNotebook* nbkEmail;
                wxPanel* tabGeneral;
+               wxFlexGridSizer* szrGeneral;
                wxStaticText* lblEmailAddress;
                wxTextCtrl* txtEmail;
                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 ProcessData( wxCommandEvent& event ) { event.Skip(); }
                virtual void CloseWindow( wxCommandEvent& event ) { event.Skip(); }
                
index aaaab18..6ee0219 100644 (file)
@@ -28,20 +28,8 @@ frmContactEditorEmailADT( parent )
        // Setup the window.
        
        EditorMode = FALSE;
-       sliPriority->Disable();
-       
-}
-
-void frmContactEditorEmail::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);
        
 }
 
@@ -81,9 +69,9 @@ void frmContactEditorEmail::ProcessData( wxCommandEvent& event )
                
                // Add Email priority.
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       EmailListPrefPtr->insert(std::make_pair(EmailListIndex, sliPriority->GetValue()));
+                       EmailListPrefPtr->insert(std::make_pair(EmailListIndex, priorityCtrl->GetValue()));
                
                } else {
                
@@ -100,9 +88,9 @@ void frmContactEditorEmail::ProcessData( wxCommandEvent& event )
                coldata.SetText(txtEmail->GetValue());
                ListCtrlIndex = EmailListCtrlPtr->InsertItem(coldata);
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       EmailListCtrlPtr->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), sliPriority->GetValue()));
+                       EmailListCtrlPtr->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), priorityCtrl->GetValue()));
                
                }
                
@@ -121,9 +109,9 @@ void frmContactEditorEmail::ProcessData( wxCommandEvent& event )
                
                EmailListPrefPtr->erase(EmailListIndex);
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       EmailListPrefPtr->insert(std::make_pair(EmailListIndex, sliPriority->GetValue()));
+                       EmailListPrefPtr->insert(std::make_pair(EmailListIndex, priorityCtrl->GetValue()));
                
                } else {
                
@@ -141,9 +129,9 @@ void frmContactEditorEmail::ProcessData( wxCommandEvent& event )
                
                EmailListCtrlPtr->SetItem(longSelected, 0, txtEmail->GetValue());               
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       EmailListCtrlPtr->SetItem(longSelected, 1, wxString::Format(wxT("%i"), sliPriority->GetValue()));
+                       EmailListCtrlPtr->SetItem(longSelected, 1, wxString::Format(wxT("%i"), priorityCtrl->GetValue()));
                
                } else {
                
@@ -208,9 +196,8 @@ void frmContactEditorEmail::SetEditorMode(bool EditMode, SectionType SectType)
                if (intiter->first == EmailListIndex && intiter->second > 0 &&
                        intiter != EmailListPrefPtr->end()){
                
-                       sliPriority->SetValue(intiter->second);
-                       sliPriority->Enable();
-                       chkUsePref->SetValue(TRUE);
+                       priorityCtrl->SetValue(intiter->second);
+                       priorityCtrl->EnablePriority(true);
                
                }
                
index 3f34e40..89dd456 100644 (file)
@@ -31,13 +31,13 @@ Subclass of frmContactEditorEmailADT, which is generated by wxFormBuilder.
 //// end generated include
 
 #include "../enums.h"
+#include "../widgets/XABPriorityCtrl.h"
 
 /** Implementing frmContactEditorEmailADT */
 class frmContactEditorEmail : public frmContactEditorEmailADT
 {
        protected:
                // Handlers for frmContactEditorEmailADT events.
-               void EnablePriority( wxCommandEvent& event );
                void ProcessData( wxCommandEvent& event );
                void CloseWindow( wxCommandEvent& event );
        public:
@@ -64,6 +64,7 @@ class frmContactEditorEmail : public frmContactEditorEmailADT
                wxListCtrl *EmailListCtrlPtr;
                int EmailListIndex;
                SectionType EditSectionType;            
+               XABPriorityCtrl *priorityCtrl = nullptr;
                
        //// end generated class members
        
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