Commited FRM's stockitem patch (empty stock items).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40978 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -100,6 +100,26 @@ public:
|
||||
bool MatchesEvent(const wxKeyEvent& event) const;
|
||||
#endif
|
||||
|
||||
bool IsOk() const
|
||||
{
|
||||
return m_flags != 0 &&
|
||||
m_keyCode != 0;
|
||||
}
|
||||
|
||||
|
||||
// string <-> wxAcceleratorEntry conversion
|
||||
// ----------------------------------------
|
||||
|
||||
// returns a wxString for the this accelerator.
|
||||
// this function formats it using the <flags>-<keycode> format
|
||||
// where <flags> maybe a hyphen-separed list of "shift|alt|ctrl"
|
||||
wxString ToString() const;
|
||||
|
||||
// returns true if the given string correctly initialized this object
|
||||
// (i.e. if IsOk() returns true after this call)
|
||||
bool FromString(const wxString &str);
|
||||
|
||||
|
||||
private:
|
||||
int m_flags; // combination of wxACCEL_XXX constants
|
||||
int m_keyCode; // ASCII or virtual keycode
|
||||
|
||||
@@ -1759,7 +1759,8 @@ enum
|
||||
wxID_CLOSE_ALL,
|
||||
wxID_PREFERENCES,
|
||||
|
||||
wxID_CUT = 5030,
|
||||
wxID_EDIT = 5030,
|
||||
wxID_CUT,
|
||||
wxID_COPY,
|
||||
wxID_PASTE,
|
||||
wxID_CLEAR,
|
||||
@@ -1780,7 +1781,8 @@ enum
|
||||
wxID_VIEW_SORTSIZE,
|
||||
wxID_VIEW_SORTTYPE,
|
||||
|
||||
wxID_FILE1 = 5050,
|
||||
wxID_FILE = 5050,
|
||||
wxID_FILE1,
|
||||
wxID_FILE2,
|
||||
wxID_FILE3,
|
||||
wxID_FILE4,
|
||||
|
||||
@@ -48,6 +48,10 @@ public:
|
||||
|
||||
wxString GetHotKey() const { return m_hotKey; }
|
||||
|
||||
// splits given string in the label, doing & => _ translation, which is returned,
|
||||
// and in the hotkey which is used to set given pointer
|
||||
static wxString GTKProcessMenuItemLabel(const wxString& str, wxString *hotKey);
|
||||
|
||||
// compatibility only, don't use in new code
|
||||
wxMenuItem(wxMenu *parentMenu,
|
||||
int id,
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
|
||||
// append any kind of item (normal/check/radio/separator)
|
||||
wxMenuItem* Append(int itemid,
|
||||
const wxString& text,
|
||||
const wxString& text = wxEmptyString,
|
||||
const wxString& help = wxEmptyString,
|
||||
wxItemKind kind = wxITEM_NORMAL)
|
||||
{
|
||||
@@ -108,7 +108,7 @@ public:
|
||||
// insert an item before given position
|
||||
wxMenuItem* Insert(size_t pos,
|
||||
int itemid,
|
||||
const wxString& text,
|
||||
const wxString& text = wxEmptyString,
|
||||
const wxString& help = wxEmptyString,
|
||||
wxItemKind kind = wxITEM_NORMAL)
|
||||
{
|
||||
@@ -158,7 +158,7 @@ public:
|
||||
|
||||
// prepend any item to the menu
|
||||
wxMenuItem* Prepend(int itemid,
|
||||
const wxString& text,
|
||||
const wxString& text = wxEmptyString,
|
||||
const wxString& help = wxEmptyString,
|
||||
wxItemKind kind = wxITEM_NORMAL)
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "wx/defs.h"
|
||||
#include "wx/wxchar.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/accel.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Helper functions for stock items handling:
|
||||
@@ -27,15 +28,34 @@ WXDLLEXPORT bool wxIsStockID(wxWindowID id);
|
||||
// given ID
|
||||
WXDLLEXPORT bool wxIsStockLabel(wxWindowID id, const wxString& label);
|
||||
|
||||
enum wxStockLabelQueryFlag
|
||||
{
|
||||
wxSTOCK_NOFLAGS = 0,
|
||||
|
||||
wxSTOCK_WITH_MNEMONIC = 1,
|
||||
wxSTOCK_WITH_ACCELERATOR = 2
|
||||
};
|
||||
|
||||
// Returns label that should be used for given stock UI element (e.g. "&OK"
|
||||
// for wxSTOCK_OK):
|
||||
// for wxSTOCK_OK); if wxSTOCK_WITH_MNEMONIC is given, the & character
|
||||
// is included; if wxSTOCK_WITH_ACCELERATOR is given, the stock accelerator
|
||||
// for given ID is concatenated to the label using \t as separator
|
||||
WXDLLEXPORT wxString wxGetStockLabel(wxWindowID id,
|
||||
bool withCodes = true,
|
||||
const wxString& accelerator = wxEmptyString);
|
||||
long flags = wxSTOCK_WITH_MNEMONIC);
|
||||
|
||||
// Returns the accelerator that should be used for given stock UI element
|
||||
// (e.g. "Ctrl+x" for wxSTOCK_EXIT)
|
||||
WXDLLEXPORT wxAcceleratorEntry wxGetStockAccelerator(wxWindowID id);
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
|
||||
#include <gdk/gdktypes.h>
|
||||
|
||||
// Translates stock ID to GTK+'s stock item string indentifier:
|
||||
WXDLLEXPORT const char *wxGetStockGtkID(wxWindowID id);
|
||||
|
||||
// Returns stock accelerator modifier and key code for the given ID
|
||||
WXDLLEXPORT bool wxGetStockGtkAccelerator(const char *id, GdkModifierType *mod, guint *key);
|
||||
#endif
|
||||
|
||||
#endif // _WX_STOCKITEM_H_
|
||||
|
||||
@@ -567,7 +567,9 @@ wxDEPRECATED(
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
class WXDLLEXPORT wxAcceleratorEntry;
|
||||
WXDLLEXPORT wxAcceleratorEntry *wxGetAccelFromString(const wxString& label);
|
||||
wxDEPRECATED(
|
||||
WXDLLEXPORT wxAcceleratorEntry *wxGetAccelFromString(const wxString& label)
|
||||
);
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user