Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmContactEditorRelated: Implemented priority control
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Thu, 31 Aug 2017 20:05:58 +0000 (21:05 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Thu, 31 Aug 2017 20:05:58 +0000 (21:05 +0100)
source/AppXestiaAddrBk.cpp
source/AppXestiaAddrBk.h
source/contacteditor/frmContactEditorRelated.cpp
source/contacteditor/frmContactEditorRelated.h

index c9ea1cb..8003920 100644 (file)
@@ -4680,78 +4680,33 @@ frmContactEditorRelatedADT::frmContactEditorRelatedADT( wxWindow* parent, wxWind
        
        nbkRelated = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
        tabGeneral = new wxPanel( nbkRelated, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
-       wxFlexGridSizer* fgSizer6;
-       fgSizer6 = new wxFlexGridSizer( 0, 2, 0, 0 );
-       fgSizer6->AddGrowableCol( 0 );
-       fgSizer6->SetFlexibleDirection( wxBOTH );
-       fgSizer6->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
+       szrGeneral = new wxFlexGridSizer( 3, 2, 0, 0 );
+       szrGeneral->AddGrowableCol( 1 );
+       szrGeneral->SetFlexibleDirection( wxBOTH );
+       szrGeneral->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
        
        lblRelation = new wxStaticText( tabGeneral, wxID_ANY, wxT("Relation Name:"), wxDefaultPosition, wxDefaultSize, 0 );
        lblRelation->Wrap( -1 );
-       fgSizer6->Add( lblRelation, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+       szrGeneral->Add( lblRelation, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
        
        txtRelated = new wxTextCtrl( tabGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
-       fgSizer6->Add( txtRelated, 0, wxALL|wxEXPAND, 5 );
+       szrGeneral->Add( txtRelated, 0, wxALL|wxEXPAND, 5 );
        
        lblType = new wxStaticText( tabGeneral, wxID_ANY, wxT("Type:"), wxDefaultPosition, wxDefaultSize, 0 );
        lblType->Wrap( -1 );
-       fgSizer6->Add( lblType, 0, wxALL, 5 );
+       szrGeneral->Add( lblType, 0, wxALL, 5 );
        
        cmbType = new wxComboBox( tabGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); 
-       fgSizer6->Add( cmbType, 0, wxALL, 5 );
+       szrGeneral->Add( cmbType, 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 );
        nbkRelated->AddPage( tabGeneral, wxT("General"), false );
        
        bSizer251->Add( nbkRelated, 1, wxEXPAND | wxALL, 5 );
@@ -4775,7 +4730,6 @@ frmContactEditorRelatedADT::frmContactEditorRelatedADT( wxWindow* parent, wxWind
        this->Centre( wxBOTH );
        
        // Connect Events
-       chkUsePref->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( frmContactEditorRelatedADT::EnablePriority ), NULL, this );
        btnAction->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorRelatedADT::ProcessData ), NULL, this );
        btnClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorRelatedADT::CloseWindow ), NULL, this );
 }
@@ -4783,7 +4737,6 @@ frmContactEditorRelatedADT::frmContactEditorRelatedADT( wxWindow* parent, wxWind
 frmContactEditorRelatedADT::~frmContactEditorRelatedADT()
 {
        // Disconnect Events
-       chkUsePref->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( frmContactEditorRelatedADT::EnablePriority ), NULL, this );
        btnAction->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorRelatedADT::ProcessData ), NULL, this );
        btnClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorRelatedADT::CloseWindow ), NULL, this );
        
index bb1a42d..888a624 100644 (file)
@@ -1209,27 +1209,23 @@ class frmContactEditorRelatedADT : public wxDialog
        protected:
                wxNotebook* nbkRelated;
                wxPanel* tabGeneral;
+               wxFlexGridSizer* szrGeneral;
                wxStaticText* lblRelation;
                wxTextCtrl* txtRelated;
                wxStaticText* lblType;
                wxComboBox* cmbType;
                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(); }
                
        
        public:
                
-               frmContactEditorRelatedADT( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Related Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 350,236 ), long style = wxDEFAULT_DIALOG_STYLE ); 
+               frmContactEditorRelatedADT( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Related Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 350,270 ), long style = wxDEFAULT_DIALOG_STYLE ); 
                ~frmContactEditorRelatedADT();
        
 };
index 6d94ef5..03a2e0b 100644 (file)
@@ -29,7 +29,8 @@ frmContactEditorRelatedADT( parent )
        // Setup the window.
        
        EditorMode = FALSE;
-       sliPriority->Disable();
+       priorityCtrl = new XABPriorityCtrl(tabGeneral);
+       szrGeneral->Add(priorityCtrl, 1, wxEXPAND, 5);
        
        // Setup the list of types for the related drop down box.
        
@@ -56,19 +57,6 @@ frmContactEditorRelatedADT( parent )
        
 }
 
-void frmContactEditorRelated::EnablePriority( wxCommandEvent& event )
-{
-       
-       // Enable/disable the priority setting.
-       
-       if (chkUsePref->IsChecked()){
-               sliPriority->Enable();
-       } else {
-               sliPriority->Disable();
-       }
-       
-}
-
 void frmContactEditorRelated::SetEditorMode(bool EditMode, SectionType SectType)
 {
        
@@ -208,9 +196,8 @@ void frmContactEditorRelated::SetEditorMode(bool EditMode, SectionType SectType)
                if (intiter->first == RelatedListIndex && intiter->second > 0 &&
                        intiter != RelatedListPrefPtr->end()){
                
-                       sliPriority->SetValue(intiter->second);
-                       sliPriority->Enable();
-                       chkUsePref->SetValue(TRUE);
+                       priorityCtrl->SetValue(intiter->second);
+                       priorityCtrl->EnablePriority(true);
                
                }
                
@@ -341,9 +328,9 @@ void frmContactEditorRelated::ProcessData( wxCommandEvent& event )
                
                // Add Related Priority.
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       RelatedListPrefPtr->insert(std::make_pair(RelatedListIndex, sliPriority->GetValue()));
+                       RelatedListPrefPtr->insert(std::make_pair(RelatedListIndex, priorityCtrl->GetValue()));
                
                } else {
                
@@ -362,9 +349,9 @@ void frmContactEditorRelated::ProcessData( wxCommandEvent& event )
                
                RelatedListCtrlPtr->SetItem(ListCtrlIndex, 1, txtRelated->GetValue());
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       RelatedListCtrlPtr->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), sliPriority->GetValue()));
+                       RelatedListCtrlPtr->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), priorityCtrl->GetValue()));
                
                }               
        
@@ -469,9 +456,9 @@ void frmContactEditorRelated::ProcessData( wxCommandEvent& event )
                
                RelatedListPrefPtr->erase(RelatedListIndex);
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       RelatedListPrefPtr->insert(std::make_pair(RelatedListIndex, sliPriority->GetValue()));
+                       RelatedListPrefPtr->insert(std::make_pair(RelatedListIndex, priorityCtrl->GetValue()));
                
                } else {
                
@@ -497,9 +484,9 @@ void frmContactEditorRelated::ProcessData( wxCommandEvent& event )
                RelatedListCtrlPtr->SetItem(longSelected, 0, cmbType->GetValue());
                RelatedListCtrlPtr->SetItem(longSelected, 1, txtRelated->GetValue());
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       RelatedListCtrlPtr->SetItem(longSelected, 2, wxString::Format(wxT("%i"), sliPriority->GetValue()));
+                       RelatedListCtrlPtr->SetItem(longSelected, 2, wxString::Format(wxT("%i"), priorityCtrl->GetValue()));
                
                } else {
                
index 30d5b69..349c3f7 100644 (file)
@@ -27,6 +27,7 @@ Subclass of frmContactEditorRelatedADT, which is generated by wxFormBuilder.
 #include "../AppXestiaAddrBk.h"
 #include "../enums.h"
 #include <map>
+#include "../widgets/XABPriorityCtrl.h"
 
 //// end generated include
 
@@ -35,7 +36,6 @@ class frmContactEditorRelated : public frmContactEditorRelatedADT
 {
        protected:
                // Handlers for frmContactEditorRelatedADT events.
-               void EnablePriority( wxCommandEvent& event );
                void ProcessData( wxCommandEvent& event );
                void CloseWindow( wxCommandEvent& event );
        public:
@@ -66,7 +66,7 @@ class frmContactEditorRelated : public frmContactEditorRelatedADT
                wxListCtrl *RelatedListCtrlPtr;
                int RelatedListIndex;
                SectionType EditSectionType;
-       
+               XABPriorityCtrl *priorityCtrl = nullptr;
 };
 
 #endif // __frmContactEditorRelated__
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