157 lines
5.1 KiB
Objective-C
157 lines
5.1 KiB
Objective-C
/////////////////////////////////////////////////////////////////////////////
|
|
// Name: editlbox.h
|
|
// Purpose: interface of wxEditableListBox
|
|
// Author: wxWidgets team
|
|
// Licence: wxWindows licence
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
#define wxEL_ALLOW_NEW 0x0100
|
|
#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)
|
|
|
|
/**
|
|
@class wxEditableListBox
|
|
|
|
An editable listbox is composite control that lets the user easily enter,
|
|
delete and reorder a list of strings.
|
|
|
|
@beginStyleTable
|
|
@style{wxEL_ALLOW_NEW}
|
|
Allows the user to enter new strings (implies wxEL_ALLOW_EDIT as well).
|
|
@style{wxEL_ALLOW_EDIT}
|
|
Allows the user to edit existing strings.
|
|
@style{wxEL_ALLOW_DELETE}
|
|
Allows the user to delete existing strings.
|
|
@style{wxEL_NO_REORDER}
|
|
Does not allow the user to reorder the strings.
|
|
@style{wxEL_DEFAULT_STYLE}
|
|
Default style: wxEL_ALLOW_NEW|wxEL_ALLOW_EDIT|wxEL_ALLOW_DELETE.
|
|
@endStyleTable
|
|
|
|
The control uses a wxListCtrl internally and emits its events.
|
|
|
|
@remarks
|
|
This control provides access to its internal components (e.g., GetNewButton(),
|
|
GetListCtrl()) for advanced customization.
|
|
|
|
You may bind events directly to these internal buttons (e.g., @c wxEVT_BUTTON)
|
|
to intercept or augment default behavior. To add custom validation before
|
|
an action occurs, bind to the button and call `event.Skip()` only if
|
|
validation passes. To completely override the default behavior,
|
|
omit the call to `event.Skip()`.
|
|
|
|
@library{wxcore}
|
|
@category{ctrl}
|
|
|
|
@see wxListBox, wxListCtrl
|
|
*/
|
|
class wxEditableListBox : public wxPanel
|
|
{
|
|
public:
|
|
/**
|
|
Default ctor.
|
|
*/
|
|
wxEditableListBox();
|
|
|
|
/**
|
|
Constructor, creating and showing a list box.
|
|
|
|
@param parent
|
|
Parent window. Must not be @NULL.
|
|
@param id
|
|
Window identifier. The value wxID_ANY indicates a default value.
|
|
@param label
|
|
The text shown just before the list control.
|
|
@param pos
|
|
Window position.
|
|
If ::wxDefaultPosition is specified then a default position is chosen.
|
|
@param size
|
|
Window size.
|
|
If ::wxDefaultSize is specified then the window is sized appropriately.
|
|
@param style
|
|
Window style. See wxEditableListBox.
|
|
@param name
|
|
Window name.
|
|
|
|
@see Create()
|
|
*/
|
|
wxEditableListBox(wxWindow* parent, wxWindowID id,
|
|
const wxString& label,
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
const wxSize& size = wxDefaultSize,
|
|
long style = wxEL_DEFAULT_STYLE,
|
|
const wxString& name = wxEditableListBoxNameStr);
|
|
|
|
/**
|
|
Destructor, destroying the list box.
|
|
*/
|
|
virtual ~wxEditableListBox();
|
|
|
|
/**
|
|
Creates the editable listbox for two-step construction.
|
|
See wxEditableListBox() for further details.
|
|
*/
|
|
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);
|
|
|
|
/**
|
|
Replaces current contents with given strings.
|
|
*/
|
|
void SetStrings(const wxArrayString& strings);
|
|
|
|
|
|
/**
|
|
Returns in the given array the current contents of the control
|
|
(the array will be erased before control's contents are appended).
|
|
*/
|
|
void GetStrings(wxArrayString& strings) const;
|
|
|
|
/**
|
|
Returns the internal list control used by the editable list box.
|
|
While contents should ideally be managed via SetStrings(), this
|
|
allows for cosmetic customization of the list display.
|
|
*/
|
|
wxListCtrl* GetListCtrl();
|
|
|
|
/**
|
|
Returns the button used to delete the selected item from the list.
|
|
Can be used for granular customization, such as changing the icon
|
|
via SetBitmapLabel().
|
|
*/
|
|
wxBitmapButton* GetDelButton();
|
|
|
|
/**
|
|
Returns the button used to add a new item to the list.
|
|
Can be used for granular customization, such as changing the icon
|
|
via SetBitmapLabel().
|
|
*/
|
|
wxBitmapButton* GetNewButton();
|
|
|
|
/**
|
|
Returns the button used to move the selected item up in the list.
|
|
Can be used for granular customization, such as changing the icon
|
|
via SetBitmapLabel().
|
|
*/
|
|
wxBitmapButton* GetUpButton();
|
|
|
|
/**
|
|
Returns the button used to move the selected item down in the list.
|
|
Can be used for granular customization, such as changing the icon
|
|
via SetBitmapLabel().
|
|
*/
|
|
wxBitmapButton* GetDownButton();
|
|
|
|
/**
|
|
Returns the button used to edit the label of the selected item.
|
|
Can be used for granular customization, such as changing the icon
|
|
via SetBitmapLabel().
|
|
*/
|
|
wxBitmapButton* GetEditButton();
|
|
};
|
|
|