Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmContactEditorAddress: Implemented priority control
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Wed, 6 Sep 2017 21:39:10 +0000 (22:39 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Wed, 6 Sep 2017 21:39:10 +0000 (22:39 +0100)
source/AppXestiaAddrBk.cpp
source/AppXestiaAddrBk.h
source/contacteditor/frmContactEditorAddress.cpp
source/contacteditor/frmContactEditorAddress.h

index 77ae21d..ebd57c5 100644 (file)
@@ -3831,99 +3831,54 @@ frmContactEditorAddressADT::frmContactEditorAddressADT( wxWindow* parent, wxWind
        
        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( 6, 2, 0, 0 );
+       szrGeneral->AddGrowableCol( 1 );
+       szrGeneral->SetFlexibleDirection( wxBOTH );
+       szrGeneral->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
        
        lblAddress = new wxStaticText( tabGeneral, wxID_ANY, wxT("Address:"), wxDefaultPosition, wxDefaultSize, 0 );
        lblAddress->Wrap( -1 );
-       fgSizer6->Add( lblAddress, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+       szrGeneral->Add( lblAddress, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
        
        txtAddress = new wxTextCtrl( tabGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
-       fgSizer6->Add( txtAddress, 0, wxALL|wxEXPAND, 5 );
+       szrGeneral->Add( txtAddress, 0, wxALL|wxEXPAND, 5 );
        
        m_staticText61 = new wxStaticText( tabGeneral, wxID_ANY, wxT("Town/City:"), wxDefaultPosition, wxDefaultSize, 0 );
        m_staticText61->Wrap( -1 );
-       fgSizer6->Add( m_staticText61, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+       szrGeneral->Add( m_staticText61, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
        
        txtTownCity = new wxTextCtrl( tabGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
-       fgSizer6->Add( txtTownCity, 0, wxALL|wxEXPAND, 5 );
+       szrGeneral->Add( txtTownCity, 0, wxALL|wxEXPAND, 5 );
        
        lblCountyState = new wxStaticText( tabGeneral, wxID_ANY, wxT("County:"), wxDefaultPosition, wxDefaultSize, 0 );
        lblCountyState->Wrap( -1 );
-       fgSizer6->Add( lblCountyState, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+       szrGeneral->Add( lblCountyState, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
        
        txtCounty = new wxTextCtrl( tabGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
-       fgSizer6->Add( txtCounty, 0, wxALL|wxEXPAND, 5 );
+       szrGeneral->Add( txtCounty, 0, wxALL|wxEXPAND, 5 );
        
        lblPostCode = new wxStaticText( tabGeneral, wxID_ANY, wxT("Post Code:"), wxDefaultPosition, wxDefaultSize, 0 );
        lblPostCode->Wrap( -1 );
-       fgSizer6->Add( lblPostCode, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+       szrGeneral->Add( lblPostCode, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
        
        txtPostCode = new wxTextCtrl( tabGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
-       fgSizer6->Add( txtPostCode, 0, wxALL, 5 );
+       szrGeneral->Add( txtPostCode, 0, wxALL, 5 );
        
        lblCountry = new wxStaticText( tabGeneral, wxID_ANY, wxT("Country:"), wxDefaultPosition, wxDefaultSize, 0 );
        lblCountry->Wrap( -1 );
-       fgSizer6->Add( lblCountry, 0, wxALL, 5 );
+       szrGeneral->Add( lblCountry, 0, wxALL, 5 );
        
        txtCountry = new wxTextCtrl( tabGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
-       fgSizer6->Add( txtCountry, 0, wxALL|wxEXPAND, 5 );
+       szrGeneral->Add( txtCountry, 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 );
        nbkAddress->AddPage( tabGeneral, wxT("General"), true );
        tabLabel = new wxPanel( nbkAddress, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
        wxBoxSizer* bSizer253;
@@ -3996,7 +3951,6 @@ frmContactEditorAddressADT::frmContactEditorAddressADT( wxWindow* parent, wxWind
        
        // Connect Events
        this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( frmContactEditorAddressADT::InitAddressEditor ) );
-       chkUsePref->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( frmContactEditorAddressADT::EnablePriority ), NULL, this );
        btnCopyMailing->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorAddressADT::CopyAddress ), NULL, this );
        btnAction->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorAddressADT::ProcessData ), NULL, this );
        btnClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorAddressADT::CloseWindow ), NULL, this );
@@ -4006,7 +3960,6 @@ frmContactEditorAddressADT::~frmContactEditorAddressADT()
 {
        // Disconnect Events
        this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( frmContactEditorAddressADT::InitAddressEditor ) );
-       chkUsePref->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( frmContactEditorAddressADT::EnablePriority ), NULL, this );
        btnCopyMailing->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorAddressADT::CopyAddress ), NULL, this );
        btnAction->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorAddressADT::ProcessData ), NULL, this );
        btnClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorAddressADT::CloseWindow ), NULL, this );
index edc02d7..835663e 100644 (file)
@@ -901,6 +901,7 @@ class frmContactEditorAddressADT : public wxDialog
        protected:
                wxNotebook* nbkAddress;
                wxPanel* tabGeneral;
+               wxFlexGridSizer* szrGeneral;
                wxStaticText* lblAddress;
                wxTextCtrl* txtAddress;
                wxStaticText* m_staticText61;
@@ -912,10 +913,6 @@ class frmContactEditorAddressADT : public wxDialog
                wxStaticText* lblCountry;
                wxTextCtrl* txtCountry;
                wxStaticText* lblPriority;
-               wxCheckBox* chkUsePref;
-               wxSlider* sliPriority;
-               wxStaticText* lblHigh;
-               wxStaticText* lblLow;
                wxPanel* tabLabel;
                wxButton* btnCopyMailing;
                wxTextCtrl* txtLabel;
@@ -931,7 +928,6 @@ class frmContactEditorAddressADT : public wxDialog
                
                // Virtual event handlers, overide them in your derived class
                virtual void InitAddressEditor( wxInitDialogEvent& event ) { event.Skip(); }
-               virtual void EnablePriority( wxCommandEvent& event ) { event.Skip(); }
                virtual void CopyAddress( wxCommandEvent& event ) { event.Skip(); }
                virtual void ProcessData( wxCommandEvent& event ) { event.Skip(); }
                virtual void CloseWindow( wxCommandEvent& event ) { event.Skip(); }
@@ -939,7 +935,7 @@ class frmContactEditorAddressADT : public wxDialog
        
        public:
                
-               frmContactEditorAddressADT( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Address Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 426,362 ), long style = wxDEFAULT_DIALOG_STYLE ); 
+               frmContactEditorAddressADT( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Address Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 438,401 ), long style = wxDEFAULT_DIALOG_STYLE ); 
                ~frmContactEditorAddressADT();
        
 };
index 6c68117..a653d27 100644 (file)
@@ -30,7 +30,9 @@ frmContactEditorAddressADT( parent )
        // Setup the window.
        
        EditorMode = FALSE;
-       sliPriority->Disable();
+       priorityCtrl = new XABPriorityCtrl(tabGeneral);
+       szrGeneral->Add(priorityCtrl, 1, wxEXPAND, 5);
+       szrGeneral->Layout();
        
 }
 
@@ -39,19 +41,6 @@ void frmContactEditorAddress::InitAddressEditor( wxInitDialogEvent& event )
        // Do nothing with this subroutine at this time.
 }
 
-void frmContactEditorAddress::EnablePriority( wxCommandEvent& event )
-{
-       
-       // Enable/disable the priority setting.
-       
-       if (chkUsePref->IsChecked()){
-               sliPriority->Enable();
-       } else {
-               sliPriority->Disable();
-       }
-       
-}
-
 void frmContactEditorAddress::ProcessData( wxCommandEvent& event )
 {
 
@@ -124,9 +113,9 @@ void frmContactEditorAddress::ProcessData( wxCommandEvent& event )
                
                AddressListMediatypePtr->insert(std::make_pair(AddressListIndex, wxT("text/plain")));
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       AddressListPrefPtr->insert(std::make_pair(AddressListIndex, sliPriority->GetValue()));
+                       AddressListPrefPtr->insert(std::make_pair(AddressListIndex, priorityCtrl->GetValue()));
                
                } else {
                
@@ -147,9 +136,9 @@ void frmContactEditorAddress::ProcessData( wxCommandEvent& event )
                AddressListCtrlPtr->SetItem(ListCtrlIndex, 2, txtCounty->GetValue());
                AddressListCtrlPtr->SetItem(ListCtrlIndex, 3, txtPostCode->GetValue());
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       AddressListCtrlPtr->SetItem(ListCtrlIndex, 4, wxString::Format(wxT("%i"), sliPriority->GetValue()));
+                       AddressListCtrlPtr->SetItem(ListCtrlIndex, 4, wxString::Format(wxT("%i"), priorityCtrl->GetValue()));
                
                }
                
@@ -218,9 +207,9 @@ void frmContactEditorAddress::ProcessData( wxCommandEvent& event )
                
                AddressListPrefPtr->erase(AddressListIndex);
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       AddressListPrefPtr->insert(std::make_pair(AddressListIndex, sliPriority->GetValue()));
+                       AddressListPrefPtr->insert(std::make_pair(AddressListIndex, priorityCtrl->GetValue()));
                
                } else {
                
@@ -243,9 +232,9 @@ void frmContactEditorAddress::ProcessData( wxCommandEvent& event )
                AddressListCtrlPtr->SetItem(longSelected, 2, txtCounty->GetValue());
                AddressListCtrlPtr->SetItem(longSelected, 3, txtPostCode->GetValue());
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       AddressListCtrlPtr->SetItem(longSelected, 4, wxString::Format(wxT("%i"), sliPriority->GetValue()));
+                       AddressListCtrlPtr->SetItem(longSelected, 4, wxString::Format(wxT("%i"), priorityCtrl->GetValue()));
                
                } else {
                
@@ -423,9 +412,8 @@ void frmContactEditorAddress::SetEditorMode( bool EditMode, SectionType SectType
                if (intiter->first == AddressListIndex && intiter->second > 0 && intiter != AddressListPrefPtr->end() &&
                  intiter != AddressListPrefPtr->end()){
                
-                       sliPriority->SetValue(intiter->second);
-                       sliPriority->Enable();
-                       chkUsePref->SetValue(TRUE);
+                       priorityCtrl->SetValue(intiter->second);
+                       priorityCtrl->EnablePriority(true);
                
                }
                
index b8f47e9..f0f0592 100644 (file)
@@ -31,6 +31,7 @@ Subclass of frmContactEditorAddressADT, which is generated by wxFormBuilder.
 //// end generated include
 
 #include "../enums.h"
+#include "../widgets/XABPriorityCtrl.h"
 
 /** Implementing frmContactEditorAddressADT */
 class frmContactEditorAddress : public frmContactEditorAddressADT
@@ -38,7 +39,6 @@ class frmContactEditorAddress : public frmContactEditorAddressADT
        protected:
                // Handlers for frmContactEditorAddressADT events.
                void InitAddressEditor( wxInitDialogEvent& event );
-               void EnablePriority( wxCommandEvent& event );
                void ProcessData( wxCommandEvent& event );
                void CopyAddress( wxCommandEvent& event );              
                void CloseWindow( wxCommandEvent& event );
@@ -84,6 +84,7 @@ class frmContactEditorAddress : public frmContactEditorAddressADT
                wxListCtrl *AddressListCtrlPtr;
                int AddressListIndex;
                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