#include </home/zeitlin/src/wx/github/interface/wx/rearrangectrl.h>
A dialog allowing the user to rearrange the specified items.
This dialog can be used to allow the user to modify the order of the items and to enable or disable them individually. 以下に例を示します:
wxArrayString items; items.push_back("meat"); items.push_back("fish"); items.push_back("fruits"); items.push_back("beer"); wxArrayInt order; order.push_back(3); order.push_back(0); order.push_back(1); order.push_back(2); wxRearrangeDialog dlg(NULL, "You can also uncheck the items you don't like " "at all.", "Sort the items in order of preference", order, items); if ( dlg.ShowModal() == wxID_OK ) { order = dlg.GetOrder(); for ( size_t n = 0; n < order.size(); n++ ) { if ( order[n] >= 0 ) { wxLogMessage("Your most preferred item is \"%s\"", items[order[n]]); break; } } }
Public Member Functions | |
wxRearrangeDialog () | |
Default constructor. | |
wxRearrangeDialog (wxWindow *parent, const wxString &message, const wxString &title, const wxArrayInt &order, const wxArrayString &items, const wxPoint &pos=wxDefaultPosition, const wxString &name=wxRearrangeDialogNameStr) | |
Constructor creating the dialog. | |
bool | Create (wxWindow *parent, const wxString &message, const wxString &title, const wxArrayInt &order, const wxArrayString &items, const wxPoint &pos=wxDefaultPosition, const wxString &name=wxRearrangeDialogNameStr) |
Effectively creates the dialog for an object created using the default constructor. | |
void | AddExtraControls (wxWindow *win) |
Customize the dialog by adding extra controls to it. | |
wxRearrangeList * | GetList () const |
Return the list control used by the dialog. | |
wxArrayInt | GetOrder () const |
Return the array describing the order of items after it was modified by the user. |
wxRearrangeDialog::wxRearrangeDialog | ( | ) |
Default constructor.
Create() must be called later to effectively create the control.
wxRearrangeDialog::wxRearrangeDialog | ( | wxWindow * | parent, |
const wxString & | message, | ||
const wxString & | title, | ||
const wxArrayInt & | order, | ||
const wxArrayString & | items, | ||
const wxPoint & | pos = wxDefaultPosition , |
||
const wxString & | name = wxRearrangeDialogNameStr |
||
) |
Constructor creating the dialog.
Please see Create() for the parameters description.
void wxRearrangeDialog::AddExtraControls | ( | wxWindow * | win | ) |
Customize the dialog by adding extra controls to it.
This function adds the given win to the dialog, putting it just below the part occupied by wxRearrangeCtrl. It must be called after creating the dialog and you will typically need to process the events generated by the extra controls for them to do something useful.
以下に例を示します:
class MyRearrangeDialog : public wxRearrangeDialog { public: MyRearrangeDialog(wxWindow *parent, ...) : wxRearrangeDialog(parent, ...) { wxPanel *panel = new wxPanel(this); wxSizer *sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(new wxStaticText(panel, wxID_ANY, "Column width in pixels:")); sizer->Add(new wxTextCtrl(panel, wxID_ANY, "")); panel->SetSizer(sizer); AddExtraControls(panel); } ... code to update the text control with the currently selected item width and to react to its changes omitted ... };
See also the complete example of a custom rearrange dialog in the dialogs sample.
win | The window containing the extra controls. It must have this dialog as its parent. |
bool wxRearrangeDialog::Create | ( | wxWindow * | parent, |
const wxString & | message, | ||
const wxString & | title, | ||
const wxArrayInt & | order, | ||
const wxArrayString & | items, | ||
const wxPoint & | pos = wxDefaultPosition , |
||
const wxString & | name = wxRearrangeDialogNameStr |
||
) |
Effectively creates the dialog for an object created using the default constructor.
parent | The dialog parent, possibly NULL. |
message | The message shown inside the dialog itself, above the items list. |
title | The title of the dialog. |
order | The initial order of the items in the convention used by wxRearrangeList. |
items | The items to show in the dialog. |
pos | Optional dialog position. |
name | Optional dialog name. |
wxRearrangeList* wxRearrangeDialog::GetList | ( | ) | const |
Return the list control used by the dialog.
wxArrayInt wxRearrangeDialog::GetOrder | ( | ) | const |
Return the array describing the order of items after it was modified by the user.
Please notice that the array will contain negative items if any items were unchecked. See wxRearrangeList for more information about the convention used for this array.