]>
Commit | Line | Data |
---|---|---|
401e3b6e VS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/stockitem.h | |
5f7bcb48 | 3 | // Purpose: stock items helpers (privateh header) |
401e3b6e VS |
4 | // Author: Vaclav Slavik |
5 | // Modified by: | |
6 | // Created: 2004-08-15 | |
401e3b6e VS |
7 | // Copyright: (c) Vaclav Slavik, 2004 |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_STOCKITEM_H_ | |
12 | #define _WX_STOCKITEM_H_ | |
13 | ||
401e3b6e | 14 | #include "wx/defs.h" |
e3f6cbd9 | 15 | #include "wx/chartype.h" |
401e3b6e | 16 | #include "wx/string.h" |
ee0a94cf | 17 | #include "wx/accel.h" |
401e3b6e VS |
18 | |
19 | // ---------------------------------------------------------------------------- | |
5f7bcb48 | 20 | // Helper functions for stock items handling: |
401e3b6e VS |
21 | // ---------------------------------------------------------------------------- |
22 | ||
5f7bcb48 | 23 | // Returns true if the ID is in the list of recognized stock actions |
53a2db12 | 24 | WXDLLIMPEXP_CORE bool wxIsStockID(wxWindowID id); |
401e3b6e | 25 | |
5f7bcb48 VS |
26 | // Returns true of the label is empty or label of a stock button with |
27 | // given ID | |
53a2db12 | 28 | WXDLLIMPEXP_CORE bool wxIsStockLabel(wxWindowID id, const wxString& label); |
401e3b6e | 29 | |
ee0a94cf RR |
30 | enum wxStockLabelQueryFlag |
31 | { | |
32 | wxSTOCK_NOFLAGS = 0, | |
33 | ||
34 | wxSTOCK_WITH_MNEMONIC = 1, | |
e94ee791 VZ |
35 | wxSTOCK_WITH_ACCELERATOR = 2, |
36 | ||
95ad763a VZ |
37 | // by default, stock items text is returned with ellipsis, if appropriate, |
38 | // this flag allows to avoid having it | |
39 | wxSTOCK_WITHOUT_ELLIPSIS = 4, | |
40 | ||
41 | // return label for button, not menu item: buttons should always use | |
42 | // mnemonics and never use ellipsis | |
43 | wxSTOCK_FOR_BUTTON = wxSTOCK_WITHOUT_ELLIPSIS | wxSTOCK_WITH_MNEMONIC | |
ee0a94cf RR |
44 | }; |
45 | ||
401e3b6e | 46 | // Returns label that should be used for given stock UI element (e.g. "&OK" |
ee0a94cf RR |
47 | // for wxSTOCK_OK); if wxSTOCK_WITH_MNEMONIC is given, the & character |
48 | // is included; if wxSTOCK_WITH_ACCELERATOR is given, the stock accelerator | |
49 | // for given ID is concatenated to the label using \t as separator | |
53a2db12 | 50 | WXDLLIMPEXP_CORE wxString wxGetStockLabel(wxWindowID id, |
ee0a94cf RR |
51 | long flags = wxSTOCK_WITH_MNEMONIC); |
52 | ||
b137e493 WS |
53 | #if wxUSE_ACCEL |
54 | ||
55 | // Returns the accelerator that should be used for given stock UI element | |
56 | // (e.g. "Ctrl+x" for wxSTOCK_EXIT) | |
53a2db12 | 57 | WXDLLIMPEXP_CORE wxAcceleratorEntry wxGetStockAccelerator(wxWindowID id); |
b137e493 WS |
58 | |
59 | #endif | |
401e3b6e | 60 | |
345319d6 VZ |
61 | // wxStockHelpStringClient conceptually works like wxArtClient: it gives a hint to |
62 | // wxGetStockHelpString() about the context where the help string is to be used | |
63 | enum wxStockHelpStringClient | |
64 | { | |
65 | wxSTOCK_MENU // help string to use for menu items | |
66 | }; | |
67 | ||
68 | // Returns an help string for the given stock UI element and for the given "context". | |
53a2db12 | 69 | WXDLLIMPEXP_CORE wxString wxGetStockHelpString(wxWindowID id, |
345319d6 VZ |
70 | wxStockHelpStringClient client = wxSTOCK_MENU); |
71 | ||
72 | ||
401e3b6e | 73 | #ifdef __WXGTK20__ |
ee0a94cf | 74 | |
05e66a70 | 75 | // Translates stock ID to GTK+'s stock item string identifier: |
53a2db12 | 76 | WXDLLIMPEXP_CORE const char *wxGetStockGtkID(wxWindowID id); |
ee0a94cf | 77 | |
401e3b6e VS |
78 | #endif |
79 | ||
80 | #endif // _WX_STOCKITEM_H_ |