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

index 4a0c243..edf21c9 100644 (file)
@@ -5442,78 +5442,33 @@ frmContactEditorIMADT::frmContactEditorIMADT( wxWindow* parent, wxWindowID id, c
        
        nbkIM = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
        tabGeneral = new wxPanel( nbkIM, 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 );
        
        lblIMType = new wxStaticText( tabGeneral, wxID_ANY, wxT("IM Type:"), wxDefaultPosition, wxDefaultSize, 0 );
        lblIMType->Wrap( -1 );
-       fgSizer6->Add( lblIMType, 0, wxALL, 5 );
+       szrGeneral->Add( lblIMType, 0, wxALL, 5 );
        
        cmbIMType = new wxComboBox( tabGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN ); 
-       fgSizer6->Add( cmbIMType, 0, wxALL, 5 );
+       szrGeneral->Add( cmbIMType, 0, wxALL, 5 );
        
        lblUsername = new wxStaticText( tabGeneral, wxID_ANY, wxT("Username/E-mail address:"), wxDefaultPosition, wxDefaultSize, 0 );
        lblUsername->Wrap( 0 );
-       fgSizer6->Add( lblUsername, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+       szrGeneral->Add( lblUsername, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
        
        txtUsername = new wxTextCtrl( tabGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
-       fgSizer6->Add( txtUsername, 0, wxALL|wxEXPAND, 5 );
+       szrGeneral->Add( txtUsername, 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 );
        nbkIM->AddPage( tabGeneral, wxT("General"), false );
        
        bSizer251->Add( nbkIM, 1, wxEXPAND | wxALL, 5 );
@@ -5537,7 +5492,6 @@ frmContactEditorIMADT::frmContactEditorIMADT( wxWindow* parent, wxWindowID id, c
        this->Centre( wxBOTH );
        
        // Connect Events
-       chkUsePref->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( frmContactEditorIMADT::EnablePriority ), NULL, this );
        btnAction->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorIMADT::ProcessAction ), NULL, this );
        btnClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorIMADT::CloseWindow ), NULL, this );
 }
@@ -5545,7 +5499,6 @@ frmContactEditorIMADT::frmContactEditorIMADT( wxWindow* parent, wxWindowID id, c
 frmContactEditorIMADT::~frmContactEditorIMADT()
 {
        // Disconnect Events
-       chkUsePref->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( frmContactEditorIMADT::EnablePriority ), NULL, this );
        btnAction->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorIMADT::ProcessAction ), NULL, this );
        btnClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorIMADT::CloseWindow ), NULL, this );
        
index b90b41c..b816af7 100644 (file)
@@ -1524,20 +1524,16 @@ class frmContactEditorIMADT : public wxDialog
        protected:
                wxNotebook* nbkIM;
                wxPanel* tabGeneral;
+               wxFlexGridSizer* szrGeneral;
                wxStaticText* lblIMType;
                wxComboBox* cmbIMType;
                wxStaticText* lblUsername;
                wxTextCtrl* txtUsername;
                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(); }
                
index dba7cba..87b8cb8 100644 (file)
@@ -30,7 +30,8 @@ frmContactEditorIMADT( parent )
        // Setup the window.
        
        EditorMode = FALSE;
-       sliPriority->Disable();
+       priorityCtrl = new XABPriorityCtrl(tabGeneral);
+       szrGeneral->Add(priorityCtrl, 1, wxEXPAND, 5);
        
        // Add some values to the drop down box for IM types.
        
@@ -44,19 +45,6 @@ frmContactEditorIMADT( parent )
        
 }
 
-void frmContactEditorIM::EnablePriority( wxCommandEvent& event )
-{
-       
-       // Enable/disable the priority setting.
-       
-       if (chkUsePref->IsChecked()){
-               sliPriority->Enable();
-       } else {
-               sliPriority->Disable();
-       }
-       
-}
-
 void frmContactEditorIM::ProcessAction( wxCommandEvent& event )
 {
 
@@ -151,9 +139,9 @@ void frmContactEditorIM::ProcessAction( wxCommandEvent& event )
                
                // Set the priority.
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       IMListPrefPtr->insert(std::make_pair(IMListIndex, sliPriority->GetValue()));
+                       IMListPrefPtr->insert(std::make_pair(IMListIndex, priorityCtrl->GetValue()));
                
                } else {
                
@@ -172,9 +160,9 @@ void frmContactEditorIM::ProcessAction( wxCommandEvent& event )
                
                IMListCtrlPtr->SetItem(ListCtrlIndex, 1, txtUsername->GetValue());
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       IMListCtrlPtr->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), sliPriority->GetValue()));
+                       IMListCtrlPtr->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), priorityCtrl->GetValue()));
                
                }
                
@@ -231,9 +219,9 @@ void frmContactEditorIM::ProcessAction( wxCommandEvent& event )
                
                IMListPrefPtr->erase(IMListIndex);
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       IMListPrefPtr->insert(std::make_pair(IMListIndex, sliPriority->GetValue()));
+                       IMListPrefPtr->insert(std::make_pair(IMListIndex, priorityCtrl->GetValue()));
                
                } else {
                
@@ -254,9 +242,9 @@ void frmContactEditorIM::ProcessAction( wxCommandEvent& event )
                IMListCtrlPtr->SetItem(longSelected, 0, cmbIMType->GetValue());
                IMListCtrlPtr->SetItem(longSelected, 1, txtUsername->GetValue());
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       IMListCtrlPtr->SetItem(longSelected, 2, wxString::Format(wxT("%i"), sliPriority->GetValue()));
+                       IMListCtrlPtr->SetItem(longSelected, 2, wxString::Format(wxT("%i"), priorityCtrl->GetValue()));
                
                } else {
                
@@ -376,9 +364,8 @@ void frmContactEditorIM::SetEditorMode(bool EditMode, SectionType SectType)
                if (intiter->first == IMListIndex && intiter->second > 0 &&
                        intiter != IMListPrefPtr->end()){
                
-                       sliPriority->SetValue(intiter->second);
-                       sliPriority->Enable();
-                       chkUsePref->SetValue(TRUE);
+                       priorityCtrl->SetValue(intiter->second);
+                       priorityCtrl->EnablePriority(true);
                
                }
                
index d69772b..89e94ab 100644 (file)
@@ -28,6 +28,7 @@ Subclass of frmContactEditorIMADT, which is generated by wxFormBuilder.
 
 #include "../AppXestiaAddrBk.h"
 #include "../enums.h"
+#include "../widgets/XABPriorityCtrl.h"
 
 //// end generated include
 
@@ -36,7 +37,6 @@ class frmContactEditorIM : public frmContactEditorIMADT
 {
        protected:
                // Handlers for frmContactEditorIMADT events.
-               void EnablePriority( wxCommandEvent& event );
                void ProcessAction( wxCommandEvent& event );
                void CloseWindow( wxCommandEvent& event );
        public:
@@ -68,7 +68,7 @@ class frmContactEditorIM : public frmContactEditorIMADT
                wxListCtrl *IMListCtrlPtr;
                int IMListIndex = 0;
                SectionType EditSectionType;    
-       
+               XABPriorityCtrl *priorityCtrl = nullptr;
 };
 
 #endif // __frmContactEditorIM__
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