Main Page Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members File Members Related Pages

# wkgl::CallBack Class Reference

Inherit from this class to use a callback function in your class. More...

`#include <Component.h>`

Inheritance diagram for wkgl::CallBack:

List of all members.

## Public Methods
virtual BOOL | callBack (Component *com, UINT message, WPARAM wParam, LPARAM lParam)=0
| Implement this method to have a callback in your class.

## Detailed Description

Inherit from this class to use a callback function in your class.

Author:
  Micheal Nooner.

To have callbacks in a class you must publicly inheirit from this class. You will need to define your the method CallBack. This is the only callback that components will be able to interface with because Component::FireEvents() calls classlisteners[i]->CallBack(). Use the parameter com to distinguish what component fired the event. I recomend switching through each of your component's addresses, then calling a seperate method. This is not strictly necessary but it will make readability and debuging easier.

Here is an example:

       BOOL MyClass::CallBack(Component* com, UINT message,
                              WPARAM wParam, LPARAM lParam)
       {
         switch ( com )
         {
           case &myButton: return OnMyButton( com, message, wParam, lParam );
           case &myButton2: return OnMyButton2( com, message, wParam, lParam );
           case &myWindow: return OnMyWindow2( com, message, wParam, lParam );
         }

         return FALSE;
       }

## Member Function Documentation

virtual BOOL wkgl::CallBack::callBack | ( | Component * | com,
|  | UINT | message,
|  | WPARAM | wParam,
|  | LPARAM | lParam
| ) | `[pure virtual]`

  | Implement this method to have a callback in your class. Parameters:
  com | A pointer to the component that generated the message.
  message | The windows integer event.
  wParam | contain information about the event, see windows docs.
  lParam | contain information about the event, see windows docs.
Returns: TRUE if the event was handled, FALSE otherwise. Implemented in wkgl::Dialog, wkgl::Menu, wkgl::MenuBar, wkgl::PopupMenu, and wkgl::Window.

The documentation for this class was generated from the following file:

- Component.h