Update of /cvsroot/mahogany/M/src/adb
In directory usw-pr-cvs1:/tmp/cvs-serv2481/src/adb

Modified Files:
        AdbDialogs.cpp 
Log Message:
added 'more' button to the ADB expansion dialog

Index: AdbDialogs.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/adb/AdbDialogs.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -b -u -2 -r1.16 -r1.17
--- AdbDialogs.cpp      17 Apr 2002 11:39:32 -0000      1.16
+++ AdbDialogs.cpp      18 Apr 2002 00:12:24 -0000      1.17
@@ -124,7 +124,13 @@
    int GetSelection() const { return m_listbox->GetSelection(); }
 
+   enum
+   {
+      Btn_More = 100
+   };
+
 protected:
    // event handlers
    void OnLboxDblClick(wxCommandEvent& /* event */) { EndModal(wxID_OK); }
+   void OnBtnMore(wxCommandEvent& event);
 
 private:
@@ -132,4 +138,10 @@
    wxListBox *m_listbox;
 
+   // the button to show more entries (may be NULL)
+   wxButton *m_btnMore;
+
+   // the entries array
+   ArrayAdbEntries& m_aMoreEntries;
+
    DECLARE_EVENT_TABLE()
 };
@@ -146,4 +158,5 @@
 BEGIN_EVENT_TABLE(wxAdbExpandDialog, wxManuallyLaidOutDialog)
    EVT_LISTBOX_DCLICK(-1, wxAdbExpandDialog::OnLboxDblClick)
+   EVT_BUTTON(wxAdbExpandDialog::Btn_More, wxAdbExpandDialog::OnBtnMore)
 END_EVENT_TABLE()
 
@@ -368,5 +381,6 @@
                  : wxManuallyLaidOutDialog(parent,
                                            _("Expansion options"),
-                                           "AdrListSelect")
+                                           "AdrListSelect"),
+                   m_aMoreEntries(aMoreEntries)
 {
    /*
@@ -385,4 +399,9 @@
    m_listbox = new wxListBox(this, -1);
 
+   // don't show the "More" button if there are no more matches
+   m_btnMore = aMoreEntries.IsEmpty()
+                  ? NULL
+                  : new wxButton(this, Btn_More, _("&More matches"));
+
    // we have to fill the listbox here or it won't have the correct size
    size_t nEntryCount = aEverything.GetCount();
@@ -393,6 +412,22 @@
 
    wxLayoutConstraints *c;
+
+   if ( m_btnMore )
+   {
+      m_btnMore->SetToolTip(_("Show more matching entries"));
+
+      c = new wxLayoutConstraints;
+      c->right.SameAs(box, wxRight, 2*LAYOUT_X_MARGIN);
+      c->width.AsIs();
+      c->centreY.SameAs(box, wxCentreY);
+      c->height.AsIs();
+      m_btnMore->SetConstraints(c);
+   }
+
    c = new wxLayoutConstraints;
    c->left.SameAs(box, wxLeft, 2*LAYOUT_X_MARGIN);
+   if ( m_btnMore )
+      c->right.LeftOf(m_btnMore, LAYOUT_X_MARGIN);
+   else
    c->right.SameAs(box, wxRight, 2*LAYOUT_X_MARGIN);
    c->top.SameAs(box, wxTop, 3*LAYOUT_Y_MARGIN);
@@ -401,4 +436,16 @@
 
    SetDefaultSize(5*wBtn, 10*hBtn);
+}
+
+void wxAdbExpandDialog::OnBtnMore(wxCommandEvent& event)
+{
+   size_t nEntryCount = m_aMoreEntries.GetCount();
+   for( size_t nEntry = 0; nEntry < nEntryCount; nEntry++ )
+   {
+      m_listbox->Append(m_aMoreEntries[nEntry]->GetDescription());
+   }
+
+   // nothing more to add
+   m_btnMore->Disable();
 }
 


_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to