init.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: init.h
  3. // Purpose: interface of global functions
  4. // Author: wxWidgets team
  5. // Licence: wxWindows licence
  6. /////////////////////////////////////////////////////////////////////////////
  7. /**
  8. @class wxInitializer
  9. Create an object of this class on the stack to initialize/cleanup the library
  10. automatically.
  11. @library{wxbase}
  12. @category{appmanagement}
  13. @see wxGLContext
  14. */
  15. class wxInitializer
  16. {
  17. public:
  18. /**
  19. Initializes the library.
  20. Calls wxInitialize().
  21. */
  22. wxInitializer(int argc = 0, wxChar **argv = NULL);
  23. /**
  24. Has the initialization been successful? (explicit test)
  25. */
  26. bool IsOk() const;
  27. /**
  28. This dtor only does clean up if we initialized the library properly.
  29. Calls wxUninitialize().
  30. */
  31. ~wxInitializer();
  32. };
  33. /** @addtogroup group_funcmacro_appinitterm */
  34. //@{
  35. /**
  36. This function can be used to perform the initialization of wxWidgets if you
  37. can't use the default initialization code for any reason.
  38. If the function returns true, the initialization was successful and the
  39. global wxApp object ::wxTheApp has been created. Moreover, wxEntryCleanup()
  40. must be called afterwards. If the function returns false, a catastrophic
  41. initialization error occurred and (at least the GUI part of) the library
  42. can't be used at all.
  43. Notice that parameters @c argc and @c argv may be modified by this
  44. function.
  45. @header{wx/init.h}
  46. */
  47. bool wxEntryStart(int& argc, wxChar** argv);
  48. /**
  49. See wxEntryStart(int&,wxChar**) for more info about this function.
  50. This is an additional overload of wxEntryStart() provided under MSW only.
  51. It is meant to be called with the parameters passed to WinMain().
  52. @note Under Windows CE platform, and only there, the type of @a pCmdLine is
  53. @c wchar_t *, otherwise it is @c char *, even in Unicode build.
  54. @onlyfor{wxmsw}
  55. @header{wx/init.h}
  56. */
  57. bool wxEntryStart(HINSTANCE hInstance,
  58. HINSTANCE hPrevInstance = NULL,
  59. char* pCmdLine = NULL,
  60. int nCmdShow = SW_SHOWNORMAL);
  61. /**
  62. Free resources allocated by a successful call to wxEntryStart().
  63. @header{wx/init.h}
  64. */
  65. void wxEntryCleanup();
  66. /**
  67. Initialize the library (may be called as many times as needed, but each
  68. call to wxInitialize() must be matched by wxUninitialize()).
  69. With this function you may avoid wxDECLARE_APP() and wxIMPLEMENT_APP() macros
  70. and use wxInitialize() and wxUninitialize() dynamically in the
  71. program startup and termination.
  72. @header{wx/init.h}
  73. */
  74. bool wxInitialize(int argc = 0, wxChar **argv = NULL);
  75. /**
  76. Clean up; the library can't be used any more after the last call to
  77. wxUninitialize().
  78. See wxInitialize() for more info.
  79. @header{wx/init.h}
  80. */
  81. void wxUninitialize();
  82. //@}