]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/stockitem.h | |
3 | // Purpose: stock items helpers (privateh header) | |
4 | // Author: Vaclav Slavik | |
5 | // Modified by: | |
6 | // Created: 2004-08-15 | |
7 | // Copyright: (c) Vaclav Slavik, 2004 | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_STOCKITEM_H_ | |
12 | #define _WX_STOCKITEM_H_ | |
13 | ||
14 | #include "wx/defs.h" | |
15 | #include "wx/chartype.h" | |
16 | #include "wx/string.h" | |
17 | #include "wx/accel.h" | |
18 | ||
19 | // ---------------------------------------------------------------------------- | |
20 | // Helper functions for stock items handling: | |
21 | // ---------------------------------------------------------------------------- | |
22 | ||
23 | // Returns true if the ID is in the list of recognized stock actions | |
24 | WXDLLIMPEXP_CORE bool wxIsStockID(wxWindowID id); | |
25 | ||
26 | // Returns true of the label is empty or label of a stock button with | |
27 | // given ID | |
28 | WXDLLIMPEXP_CORE bool wxIsStockLabel(wxWindowID id, const wxString& label); | |
29 | ||
30 | enum wxStockLabelQueryFlag | |
31 | { | |
32 | wxSTOCK_NOFLAGS = 0, | |
33 | ||
34 | wxSTOCK_WITH_MNEMONIC = 1, | |
35 | wxSTOCK_WITH_ACCELERATOR = 2, | |
36 | ||
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 | |
44 | }; | |
45 | ||
46 | // Returns label that should be used for given stock UI element (e.g. "&OK" | |
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 | |
50 | WXDLLIMPEXP_CORE wxString wxGetStockLabel(wxWindowID id, | |
51 | long flags = wxSTOCK_WITH_MNEMONIC); | |
52 | ||
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) | |
57 | WXDLLIMPEXP_CORE wxAcceleratorEntry wxGetStockAccelerator(wxWindowID id); | |
58 | ||
59 | #endif | |
60 | ||
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". | |
69 | WXDLLIMPEXP_CORE wxString wxGetStockHelpString(wxWindowID id, | |
70 | wxStockHelpStringClient client = wxSTOCK_MENU); | |
71 | ||
72 | ||
73 | #ifdef __WXGTK20__ | |
74 | ||
75 | // Translates stock ID to GTK+'s stock item string identifier: | |
76 | WXDLLIMPEXP_CORE const char *wxGetStockGtkID(wxWindowID id); | |
77 | ||
78 | #endif | |
79 | ||
80 | #endif // _WX_STOCKITEM_H_ |