Contents Up Previous Next

wxArrayString

wxArrayString is an efficient container for storing wxString objects. It has the same features as all wxArray classes, i.e. it dynamically expands when new items are added to it (so it is as easy to use as a linked list), but the access time to the elements is constant, instead of being linear in number of elements as in the case of linked lists. It is also very size efficient and doesn't take more space than a C array wxString[] type (wxArrayString uses its knowledge of internals of wxString class to achieve this).

This class is used in the same way as other dynamic arrays, except that no WX_DEFINE_ARRAY declaration is needed for it. When a string is added or inserted in the array, a copy of the string is created, so the original string may be safely deleted (e.g. if it was a char * pointer the memory it was using can be freed immediately after this). In general, there is no need to worry about string memory deallocation when using this class - it will always free the memory it uses itself.

The references returned by Item, Last or operator[] are not constant, so the array elements may be modified in place like this

    array.Last().MakeUpper();
There is also a variant of wxArrayString called wxSortedArrayString which has exactly the same methods as wxArrayString, but which always keeps the string in it in (alphabetical) order. wxSortedArrayString uses binary search in its Index function (instead of linear search for wxArrayString::Index) which makes it much more efficient if you add strings to the array rarely (because, of course, you have to pay for Index() efficiency by having Add() be slower) but search for them often. Several methods should not be used with sorted array (basically, all which break the order of items) which is mentioned in their description.

Final word: none of the mearamet menuString

itemString

Return value

The menu item identifier, or wxNOT_FOUND if none was found.

Remarks

Any special menu codes are stripped out of source and target strings before matching.


wxMenuBar::FindItem

wxMenuItem * FindItem(int id, wxMenu **menu = NULL) const

Finds the menu item object associated with the given menu item identifier.

Parameters

id

menu

Return value

The found menu item object, or NULL if one was not found.


wxMenuBar::GetHelpString

wxString GetHelpString(int id) const

Gets the help string associated with the menu item identifier.

Parameters

id

Return value

The help string, or the empty string if there was no help string or the menu item was not found.

See also

wxMenuBar::SetHelpString


wxMenuBar::GetLabel

wxString GetLabel(int id) const

Gets the label associated with a menu item.

Parameters

id

Return value

The menu item label, or the empty string if the item was not found.

Remarks

Use only after the menubar has been associated with a frame.


wxMenuBar::GetLabelTop

wxString GetLabelTop(int pos) const

Returns the label of a top-level menu. Note that the returned string does not include the accelerator characters which could have been specified in the menu title string during its construction.

Parameters

pos

Return value

The menu label, or the empty string if the menu was not found.

Remarks

Use only after the menubar has been associated with a frame.

See also

wxMenuBar::SetLabelTop


wxMenuBar::GetMenu

wxMenu* GetMenu(int menuIndex) const

Returns the menu at menuIndex (zero-based).


wxMenuBar::GetMenuCount

int GetMenuCount() const

Returns the number of menus in this menubar.


wxMenuBar::Insert

bool Insert(size_t pos, wxMenu *menu, const wxString& title)

Inserts the menu at the given position into the menu bar. Inserting menu at position 0 will insert it in the very beginning of it, inserting at position GetMenuCount() is the same as calling Append().

Parameters

pos

menu

title

Return value

true on success, false if an error occurred.

See also

wxMenuBar::Append


wxMenuBar::IsChecked

bool IsChecked(int id) const

Determines whether an item is checked.

Parameters

id

Return value

true if the item was found and is checked, false otherwise.


wxMenuBar::IsEnabled

bool IsEnabled(int id) const

Determines whether an item is enabled.

Parameters

id

Return value

true if the item was found and is enabled, false otherwise.


wxMenuBar::Refresh

void Refresh()

Redraw the menu bar


wxMenuBar::Remove

wxMenu * Remove(size_t pos)

Removes the menu from the menu bar and returns the menu object - the caller is responsible for deleting it. This function may be used together with wxMenuBar::Insert to change the menubar dynamically.

See also

wxMenuBar::Replace


wxMenuBar::Replace

wxMenu * Replace(size_t pos, wxMenu *menu, const wxString& title)

Replaces the menu at the given position with another one.

Parameters

pos

menu

title

Return value

The menu which was previously at position pos. The caller is responsible for deleting it.

See also

wxMenuBar::Insert, wxMenuBar::Remove


wxMenuBar::SetHelpString

void SetHelpString(int id, const wxString& helpString)

Sets the help string associated with a menu item.

Parameters

id

helpString

See also

wxMenuBar::GetHelpString


wxMenuBar::SetLabel

void SetLabel(int id, const wxString& label)

Sets the label of a menu item.

Parameters

id

label

Remarks

Use only after the menubar has been associated with a frame.

See also

wxMenuBar::GetLabel


wxMenuBar::SetLabelTop

void SetLabelTop(int pos, const wxString& label)

Sets the label of a top-level menu.

Parameters

pos

label

Remarks

Use only after the menubar has been associated with a frame.

See also

wxMenuBar::GetLabelTop

./usr/share/doc/wx2.6-doc/wx-manual.html/wx2.6-manual_wxbusyinfo.html0000644000000000000000000000527211254670524024232 0ustar rootroot wxBusyInfo

Contents Up Previous Next

wxBusyInfo

This class makes it easy to tell your user that the program is temporarily busy. Just create a wxBusyInfo object on the stack, and within the current scope, a message window will be shown.

For example:

    wxBusyInfo wait("Please wait, working...");

    for (int i = 0; i < 100000; i++)
    {
        DoACalculation();
    }
It works by creating a window in the constructor, and deleting it in the destructor.

You may also want to call wxTheApp->Yield() to refresh the window periodically (in case it had been obscured by other windows, for example) like this:

    wxWindowDisabler disableAll;

    wxBusyInfo wait("Please wait, working...");

    for (int i = 0; i < 100000; i++)
    {
        DoACalculation();

        if ( !(i % 1000) )
            wxTheApp->Yield();
    }
but take care to not cause undesirable reentrancies when doing it (see wxApp::Yield() for more details). The simplest way to do it is to use wxWindowDisabler class as illustrated in the above example.

Derived from

None

Include files

<wx/busyinfo.h>

Members

wxBusyInfo::wxBusyInfo
wxBusyInfo::~wxBusyInfo


wxBusyInfo::wxBusyInfo

wxBusyInfo(const wxString& msg, wxWindow* parent = NULL)

Constructs a busy info window as child of parent and displays msg in it.

NB: If parent is not NULL you must ensure that it is not closed while the busy info is shown.


wxBusyInfo::~wxBusyInfo