stockitem.h 2.7 KB

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