]>
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 | // 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 | ||
15 | #include "wx/defs.h" | |
16 | #include "wx/chartype.h" | |
17 | #include "wx/string.h" | |
18 | #include "wx/accel.h" | |
19 | ||
20 | // ---------------------------------------------------------------------------- | |
21 | // Helper functions for stock items handling: | |
22 | // ---------------------------------------------------------------------------- | |
23 | ||
24 | // Returns true if the ID is in the list of recognized stock actions | |
25 | WXDLLIMPEXP_CORE bool wxIsStockID(wxWindowID id); | |
26 | ||
27 | // Returns true of the label is empty or label of a stock button with | |
28 | // given ID | |
29 | WXDLLIMPEXP_CORE bool wxIsStockLabel(wxWindowID id, const wxString& label); | |
30 | ||
31 | enum wxStockLabelQueryFlag | |
32 | { | |
33 | wxSTOCK_NOFLAGS = 0, | |
34 | ||
35 | wxSTOCK_WITH_MNEMONIC = 1, | |
36 | wxSTOCK_WITH_ACCELERATOR = 2, | |
37 | ||
38 | // return label for button, not menu item: notice that this always included | |
39 | // wxSTOCK_WITH_MNEMONIC as buttons should use mnemonics | |
40 | wxSTOCK_FOR_BUTTON = 5 | |
41 | }; | |
42 | ||
43 | // Returns label that should be used for given stock UI element (e.g. "&OK" | |
44 | // for wxSTOCK_OK); if wxSTOCK_WITH_MNEMONIC is given, the & character | |
45 | // is included; if wxSTOCK_WITH_ACCELERATOR is given, the stock accelerator | |
46 | // for given ID is concatenated to the label using \t as separator | |
47 | WXDLLIMPEXP_CORE wxString wxGetStockLabel(wxWindowID id, | |
48 | long flags = wxSTOCK_WITH_MNEMONIC); | |
49 | ||
50 | #if wxUSE_ACCEL | |
51 | ||
52 | // Returns the accelerator that should be used for given stock UI element | |
53 | // (e.g. "Ctrl+x" for wxSTOCK_EXIT) | |
54 | WXDLLIMPEXP_CORE wxAcceleratorEntry wxGetStockAccelerator(wxWindowID id); | |
55 | ||
56 | #endif | |
57 | ||
58 | // wxStockHelpStringClient conceptually works like wxArtClient: it gives a hint to | |
59 | // wxGetStockHelpString() about the context where the help string is to be used | |
60 | enum wxStockHelpStringClient | |
61 | { | |
62 | wxSTOCK_MENU // help string to use for menu items | |
63 | }; | |
64 | ||
65 | // Returns an help string for the given stock UI element and for the given "context". | |
66 | WXDLLIMPEXP_CORE wxString wxGetStockHelpString(wxWindowID id, | |
67 | wxStockHelpStringClient client = wxSTOCK_MENU); | |
68 | ||
69 | ||
70 | #ifdef __WXGTK20__ | |
71 | ||
72 | // Translates stock ID to GTK+'s stock item string indentifier: | |
73 | WXDLLIMPEXP_CORE const char *wxGetStockGtkID(wxWindowID id); | |
74 | ||
75 | #endif | |
76 | ||
77 | #endif // _WX_STOCKITEM_H_ |