\hypertarget{classagOdalaunch_1_1ODA__EventRegister}{
\section{agOdalaunch::ODA\_\-EventRegister Class Reference}
\label{dd/d44/classagOdalaunch_1_1ODA__EventRegister}\index{agOdalaunch::ODA\_\-EventRegister@{agOdalaunch::ODA\_\-EventRegister}}
}


An Event Register.  




{\ttfamily \#include $<$event\_\-handler.h$>$}

Inheritance diagram for agOdalaunch::ODA\_\-EventRegister:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=1.037037cm]{dd/d44/classagOdalaunch_1_1ODA__EventRegister}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classagOdalaunch_1_1ODA__EventRegister_a99111dd3be8a24ebcec2bcfa2aa6cd8a}{$\sim$ODA\_\-EventRegister} ()
\begin{DoxyCompactList}\small\item\em Destructor. \end{DoxyCompactList}\item 
\hyperlink{classagOdalaunch_1_1EventHandler}{EventHandler} $\ast$ \hyperlink{classagOdalaunch_1_1ODA__EventRegister_ad00c841be45a9bd0658b6c47c84724b7}{RegisterEventHandler} (\hyperlink{namespaceagOdalaunch_a753426b748f9b22aa3d9aff2cba70b25}{EVENT\_\-FUNC\_\-PTR} funcPtr)
\begin{DoxyCompactList}\small\item\em Register a function as an \hyperlink{classagOdalaunch_1_1EventHandler}{EventHandler}. \end{DoxyCompactList}\item 
bool \hyperlink{classagOdalaunch_1_1ODA__EventRegister_af9b5a0d231049b354a24cf2761c0370d}{DeleteEventHandler} (\hyperlink{classagOdalaunch_1_1EventHandler}{EventHandler} $\ast$handler)
\begin{DoxyCompactList}\small\item\em Delete an event handler. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
An Event Register. 

Parent class for all classes that will have Agar event callback member functions.

Handling Agar events in ag-\/odalaunch:

Any Agar-\/based window/dialog that will register events with Agar needs to inherit from the \hyperlink{classagOdalaunch_1_1ODA__EventRegister}{ODA\_\-EventRegister} class.

A pointer to the EventReceiver function needs to be provided to Agar as the event callback function for any event that will call a class member function.

The Agar event must receive a pointer to an \hyperlink{classagOdalaunch_1_1EventHandler}{EventHandler} returned from the \hyperlink{classagOdalaunch_1_1ODA__EventRegister_ad00c841be45a9bd0658b6c47c84724b7}{RegisterEventHandler()} function. This function receives the class member function that should be triggered by the event. When passing the function ptr cast to EVENT\_\-FUNC\_\-PTR. Any additional desired variables can be provided to the event after the required pointer.

The reason for this is that Agar is C-\/based and C functions cannot receive a class member function pointer. It is also illegal to cast a pointer-\/to-\/member-\/function to (void $\ast$) and vice versa.

Example: AG\_\-SetEvent(win, \char`\"{}window-\/user-\/resize\char`\"{}, EventReceiver, \char`\"{}\%p\char`\"{}, RegisterEventHandler((EVENT\_\-FUNC\_\-PTR)\&OurClass::OnWindowResize)); 

\subsection{Constructor \& Destructor Documentation}
\hypertarget{classagOdalaunch_1_1ODA__EventRegister_a99111dd3be8a24ebcec2bcfa2aa6cd8a}{
\index{agOdalaunch::ODA\_\-EventRegister@{agOdalaunch::ODA\_\-EventRegister}!$\sim$ODA\_\-EventRegister@{$\sim$ODA\_\-EventRegister}}
\index{$\sim$ODA\_\-EventRegister@{$\sim$ODA\_\-EventRegister}!agOdalaunch::ODA_EventRegister@{agOdalaunch::ODA\_\-EventRegister}}
\subsubsection[{$\sim$ODA\_\-EventRegister}]{\setlength{\rightskip}{0pt plus 5cm}agOdalaunch::ODA\_\-EventRegister::$\sim$ODA\_\-EventRegister (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{dd/d44/classagOdalaunch_1_1ODA__EventRegister_a99111dd3be8a24ebcec2bcfa2aa6cd8a}


Destructor. 

At destruction all EventHandlers registered through this class instance are automatically deleted. 

\subsection{Member Function Documentation}
\hypertarget{classagOdalaunch_1_1ODA__EventRegister_af9b5a0d231049b354a24cf2761c0370d}{
\index{agOdalaunch::ODA\_\-EventRegister@{agOdalaunch::ODA\_\-EventRegister}!DeleteEventHandler@{DeleteEventHandler}}
\index{DeleteEventHandler@{DeleteEventHandler}!agOdalaunch::ODA_EventRegister@{agOdalaunch::ODA\_\-EventRegister}}
\subsubsection[{DeleteEventHandler}]{\setlength{\rightskip}{0pt plus 5cm}bool agOdalaunch::ODA\_\-EventRegister::DeleteEventHandler (
\begin{DoxyParamCaption}
\item[{{\bf EventHandler} $\ast$}]{handler}
\end{DoxyParamCaption}
)}}
\label{dd/d44/classagOdalaunch_1_1ODA__EventRegister_af9b5a0d231049b354a24cf2761c0370d}


Delete an event handler. 

This method deletes an \hyperlink{classagOdalaunch_1_1EventHandler}{EventHandler} from the list of registered handlers. You only need to call this if you want to delete an \hyperlink{classagOdalaunch_1_1EventHandler}{EventHandler} before you are finished with the object instance derived from this class. All handlers are deleted automatically when the object instance is destructed.


\begin{DoxyParams}{Parameters}
{\em handler} & An \hyperlink{classagOdalaunch_1_1EventHandler}{EventHandler}. \\
\hline
\end{DoxyParams}
\hypertarget{classagOdalaunch_1_1ODA__EventRegister_ad00c841be45a9bd0658b6c47c84724b7}{
\index{agOdalaunch::ODA\_\-EventRegister@{agOdalaunch::ODA\_\-EventRegister}!RegisterEventHandler@{RegisterEventHandler}}
\index{RegisterEventHandler@{RegisterEventHandler}!agOdalaunch::ODA_EventRegister@{agOdalaunch::ODA\_\-EventRegister}}
\subsubsection[{RegisterEventHandler}]{\setlength{\rightskip}{0pt plus 5cm}{\bf EventHandler} $\ast$ agOdalaunch::ODA\_\-EventRegister::RegisterEventHandler (
\begin{DoxyParamCaption}
\item[{{\bf EVENT\_\-FUNC\_\-PTR}}]{funcPtr}
\end{DoxyParamCaption}
)}}
\label{dd/d44/classagOdalaunch_1_1ODA__EventRegister_ad00c841be45a9bd0658b6c47c84724b7}


Register a function as an \hyperlink{classagOdalaunch_1_1EventHandler}{EventHandler}. 

This method allows member functions of \hyperlink{classagOdalaunch_1_1ODA__EventRegister}{ODA\_\-EventRegister} derived classes to be registered as an event handler. The returned \hyperlink{classagOdalaunch_1_1EventHandler}{EventHandler} instance can be passed to Agar functions or other C-\/based functions as a pointer with the EventReceiver method provided as the event callback function.


\begin{DoxyParams}{Parameters}
{\em funcPtr} & An \hyperlink{classagOdalaunch_1_1ODA__EventRegister}{ODA\_\-EventRegister} derived classes method. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
An \hyperlink{classagOdalaunch_1_1EventHandler}{EventHandler} instance. 
\end{DoxyReturn}


The documentation for this class was generated from the following files:\begin{DoxyCompactItemize}
\item 
ag-\/odalaunch/src/\hyperlink{event__handler_8h}{event\_\-handler.h}\item 
ag-\/odalaunch/src/\hyperlink{event__handler_8cpp}{event\_\-handler.cpp}\end{DoxyCompactItemize}
