⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 module.tex

📁 很牛的GUI源码wxWidgets-2.8.0.zip 可在多种平台下运行.
💻 TEX
字号:
\section{\class{wxModule}}\label{wxmodule}The module system is a very simple mechanism to allow applications (and partsof wxWidgets itself) to define initialization and cleanup functions that areautomatically called on wxWidgets startup and exit.To define a new kind of module, derive a class from wxModule, override the\helpref{OnInit}{wxmoduleoninit} and \helpref{OnExit}{wxmoduleonexit} functions, and add the DECLARE\_DYNAMIC\_CLASS and IMPLEMENT\_DYNAMIC\_CLASS toheader and implementation files (which can be the same file). Oninitialization, wxWidgets will find all classes derived from wxModule, createan instance of each, and call each OnInit function. On exit, wxWidgets willcall the OnExit function for each module instance.Note that your module class does not have to be in a header file.For example:\begin{verbatim}  // A module to allow DDE initialization/cleanup  // without calling these functions from app.cpp or from  // the user's application.  class wxDDEModule: public wxModule  {  public:      wxDDEModule() { }      virtual bool OnInit() { wxDDEInitialize(); return true; };      virtual void OnExit() { wxDDECleanUp(); };  private:      DECLARE_DYNAMIC_CLASS(wxDDEModule)  };  IMPLEMENT_DYNAMIC_CLASS(wxDDEModule, wxModule)  // Another module which uses DDE in its OnInit()  class MyModule: public wxModule  {  public:      wxDDEModule() { AddDependency(CLASSINFO(wxDDEModule)); }      virtual bool OnInit() { ... code using DDE ... }      virtual void OnExit() { ... }  private:      DECLARE_DYNAMIC_CLASS(wxDDEModule)  };\end{verbatim}\wxheading{Derived from}\helpref{wxObject}{wxobject}\wxheading{Include files}<wx/module.h>\latexignore{\rtfignore{\wxheading{Members}}}\membersection{wxModule::wxModule}\label{wxmodulector}\func{}{wxModule}{\void}Constructs a wxModule object.\membersection{wxModule::\destruct{wxModule}}\label{wxmoduledtor}\func{}{\destruct{wxModule}}{\void}Destructor.\membersection{wxModule::AddDependency}\label{wxmoduleoninit}\func{void}{AddDependency}{\param{wxClassInfo * }{dep}}Call this function from the constructor of the derived class. \arg{dep} must bethe \helpref{CLASSINFO}{classinfo} of a wxModule-derived class and thecorresponding module will be loaded \emph{before} and unloaded \emph{after}this module.Note that circular dependencies are detected and result in a fatal error.\wxheading{Parameters}\docparam{dep}{The class information object for the dependent module.}\membersection{wxModule::OnExit}\label{wxmoduleonexit}\func{virtual void}{OnExit}{\void}Provide this function with appropriate cleanup for your module.\membersection{wxModule::OnInit}\label{wxmoduleoninit}\func{virtual bool}{OnInit}{\void}Provide this function with appropriate initialization for your module. If the functionreturns false, wxWidgets will exit immediately.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -