]> git.saurik.com Git - wxWidgets.git/commitdiff
[ 1713933 ] docs for wxEditableListBox
authorRobert Roebling <robert@roebling.de>
Mon, 7 May 2007 07:51:28 +0000 (07:51 +0000)
committerRobert Roebling <robert@roebling.de>
Mon, 7 May 2007 07:51:28 +0000 (07:51 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45865 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/classes.tex
docs/latex/wx/editlistbox.tex [new file with mode: 0644]
include/wx/editlbox.h
src/generic/editlbox.cpp

index 2a3c3c74c792e3f9f24bffda893bb6a06645a8d0..f1643f06ae367b74e6e392cd112ddef5cd80347b 100644 (file)
 \input dropsrc.tex
 \input droptrgt.tex
 \input dynlib.tex
+\input editlistbox.tex
 \input encconv.tex
 \input eraseevt.tex
 \input event.tex
diff --git a/docs/latex/wx/editlistbox.tex b/docs/latex/wx/editlistbox.tex
new file mode 100644 (file)
index 0000000..c548e3b
--- /dev/null
@@ -0,0 +1,97 @@
+\section{\class{wxEditableListBox}}\label{wxeditablelistbox}
+
+An editable listbox is composite control that lets the
+user easily enter, delete and reorder a list of strings.
+
+\wxheading{Derived from}
+
+\helpref{wxPanel}{wxpanel}\\
+\helpref{wxWindow}{wxwindow}\\
+\helpref{wxEvtHandler}{wxevthandler}\\
+\helpref{wxObject}{wxobject}
+
+\wxheading{Include files}
+
+<wx/editlbox.h>
+
+\wxheading{Window styles}
+
+\twocolwidtha{5cm}%
+\begin{twocollist}\itemsep=0pt
+\twocolitem{\windowstyle{wxEL\_ALLOW\_NEW}}{Allows the user to enter new strings.}
+\twocolitem{\windowstyle{wxEL\_ALLOW\_EDIT}}{Allows the user to edit existing strings.}
+\twocolitem{\windowstyle{wxEL\_ALLOW\_DELETE}}{Allows the user to delete existing strings.}
+\twocolitem{\windowstyle{wxEL\_NO\_REORDER}}{Does not allow the user to reorder the strings.}
+\twocolitem{\windowstyle{wxEL\_DEFAULT\_STYLE}}{wxEL\_ALLOW\_NEW|wxEL\_ALLOW\_EDIT|wxEL\_ALLOW\_DELETE}
+\end{twocollist}
+
+See also \helpref{window styles overview}{windowstyles}.
+
+\wxheading{See also}
+
+\helpref{wxListBox}{wxlistbox}
+
+\latexignore{\rtfignore{\wxheading{Members}}}
+
+\membersection{wxEditableListBox::wxEditableListBox}\label{wxeditablelistboxctor}
+
+\func{}{wxEditableListBox}{\void}
+
+Default constructor.
+
+\func{}{wxEditableListBox}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp
+\param{const wxString\&}{ label},\param{const wxPoint\&}{ pos = wxDefaultPosition},\rtfsp
+\param{const wxSize\&}{ size = wxDefaultSize},\rtfsp
+\param{long}{ style = wxEL\_DEFAULT\_STYLE}, \param{const wxString\& }{name = ``editableListBox"}}
+
+Constructor, creating and showing a list box.
+
+\wxheading{Parameters}
+
+\docparam{parent}{Parent window. Must not be NULL.}
+
+\docparam{id}{Window identifier. A value of -1 indicates a default value.}
+
+\docparam{label}{The text shown just before the list control.}
+
+\docparam{pos}{Window position.}
+
+\docparam{size}{Window size. If the default size (-1, -1) is specified then the window is sized
+appropriately.}
+
+\docparam{style}{Window style. See \helpref{wxEditableListBox}{wxeditablelistbox}.}
+
+\docparam{name}{Window name.}
+
+\wxheading{See also}
+
+\helpref{wxEditableListBox::Create}{wxeditablelistboxcreate}
+
+\membersection{wxEditableListBox::\destruct{wxEditableListBox}}\label{wxeditablelistboxdtor}
+
+\func{void}{\destruct{wxEditableListBox}}{\void}
+
+Destructor, destroying the list box.
+
+\membersection{wxEditableListBox::Create}\label{wxeditablelistboxcreate}
+
+\func{bool}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp
+\param{const wxString\&}{ label},\param{const wxPoint\&}{ pos = wxDefaultPosition},\rtfsp
+\param{const wxSize\&}{ size = wxDefaultSize},\rtfsp
+\param{long}{ style = wxEL\_DEFAULT\_STYLE}, \param{const wxString\& }{name = ``editableListBox"}}
+
+Creates the editable listbox for two-step construction. See \helpref{wxEditableListBox::wxEditableListBox}{wxeditablelistboxctor}\rtfsp
+for further details.
+
+\membersection{wxEditableListBox::SetStrings}\label{wxeditablelistboxsetstrings}
+
+\func{void}{SetStrings}{\param{const wxArrayString\&}{ strings}}
+
+Replaces current contents with given strings.
+
+\membersection{wxEditableListBox::GetStrings}\label{wxeditablelistboxgetstrings}
+
+\constfunc{void}{GetSelections}{\param{wxArrayString\& }{strings}}
+
+Returns in the given array the current contents of the control
+(the array will be erased before control's contents are appended).
index 1e8a2e61ab99b8aa38388ecd1b7bd081d9f34923..ad946eee7d75595dfafb60714058ae19d215c01a 100644 (file)
@@ -25,6 +25,9 @@ class WXDLLEXPORT wxListEvent;
 #define wxEL_ALLOW_EDIT         0x0200
 #define wxEL_ALLOW_DELETE       0x0400
 #define wxEL_NO_REORDER         0x0800
+#define wxEL_DEFAULT_STYLE      (wxEL_ALLOW_NEW | wxEL_ALLOW_EDIT | wxEL_ALLOW_DELETE)
+
+extern WXDLLEXPORT_DATA(const wxChar) wxEditableListBoxNameStr[];
 
 // This class provides a composite control that lets the
 // user easily enter list of strings
@@ -32,12 +35,25 @@ class WXDLLEXPORT wxListEvent;
 class WXDLLIMPEXP_ADV wxEditableListBox : public wxPanel
 {
 public:
+    wxEditableListBox() { Init(); }
+
     wxEditableListBox(wxWindow *parent, wxWindowID id,
                       const wxString& label,
                       const wxPoint& pos = wxDefaultPosition,
                       const wxSize& size = wxDefaultSize,
-                      long style = wxEL_ALLOW_NEW | wxEL_ALLOW_EDIT | wxEL_ALLOW_DELETE,
-                      const wxString& name = wxT("editableListBox"));
+                      long style = wxEL_DEFAULT_STYLE,
+                      const wxString& name = wxEditableListBoxNameStr)
+    {
+        Init();
+        Create(parent, id, label, pos, size, style, name);
+    }
+
+    bool Create(wxWindow *parent, wxWindowID id,
+                const wxString& label,
+                const wxPoint& pos = wxDefaultPosition,
+                const wxSize& size = wxDefaultSize,
+                long style = wxEL_DEFAULT_STYLE,
+                const wxString& name = wxEditableListBoxNameStr);
 
     void SetStrings(const wxArrayString& strings);
     void GetStrings(wxArrayString& strings) const;
@@ -55,6 +71,14 @@ protected:
     int m_selection;
     long m_style;
 
+    void Init()
+    {
+        m_style = 0;
+        m_selection = 0;
+        m_bEdit = m_bNew = m_bDel = m_bUp = m_bDown = NULL;
+        m_listCtrl = NULL;
+    }
+
     void OnItemSelected(wxListEvent& event);
     void OnEndLabelEdit(wxListEvent& event);
     void OnNewItem(wxCommandEvent& event);
index 76a2d5360ff8f9436adfa35026a7516f569c30b9..7817992687b43c711f027ab47fa768523ed866d5 100644 (file)
 #include "wx/sizer.h"
 #include "wx/listctrl.h"
 
+// ============================================================================
+// implementation
+// ============================================================================
+
+const wxChar wxEditableListBoxNameStr[] = wxT("editableListBox");
+
 static char * eledit_xpm[] = {
 "16 16 3 1",
 "   c None",
@@ -182,6 +188,11 @@ BEGIN_EVENT_TABLE(CleverListCtrl, wxListCtrl)
    EVT_SIZE(CleverListCtrl::OnSize)
 END_EVENT_TABLE()
 
+
+// ----------------------------------------------------------------------------
+// wxEditableListBox
+// ----------------------------------------------------------------------------
+
 IMPLEMENT_CLASS(wxEditableListBox, wxPanel)
 
 // NB: generate the IDs at runtime to avoid conflict with XRCID values,
@@ -203,15 +214,16 @@ BEGIN_EVENT_TABLE(wxEditableListBox, wxPanel)
     EVT_BUTTON(wxID_ELB_DELETE, wxEditableListBox::OnDelItem)
 END_EVENT_TABLE()
 
-wxEditableListBox::wxEditableListBox(wxWindow *parent, wxWindowID id,
+bool wxEditableListBox::Create(wxWindow *parent, wxWindowID id,
                           const wxString& label,
                           const wxPoint& pos, const wxSize& size,
                           long style,
                           const wxString& name)
-   : wxPanel(parent, id, pos, size, wxTAB_TRAVERSAL, name)
 {
+    if (!wxPanel::Create(parent, id, pos, size, wxTAB_TRAVERSAL, name))
+        return false;
+
     m_style = style;
-    m_bEdit = m_bNew = m_bDel = m_bUp = m_bDown = NULL;
 
     wxSizer *sizer = new wxBoxSizer(wxVERTICAL);