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