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

# wkgl::Component Class Reference

This is the base class for all components in the MigLib. This class defines how events are fired, and how components are shown. More...

`#include <Component.h>`

Inheritance diagram for wkgl::Component:

List of all members.

## Public Methods
| Component ()
| Defualt Constructor.
virtual void | registerComponent (HWND *hwnd, Component *com)
| Allows this component to recieve top level events.
virtual void | registerChild (HWND *hwnd, Component *com)
| Allows this component to propagate an event to the given child.
virtual LRESULT | fireChildEvents (UINT message, WPARAM wParam, LPARAM lParam)
| Propagates the events to the appropriate child/children.
virtual Component * | getParent ()
| Returns a pointer to the parent component.
virtual void | setParent (Component *p)
| Sets the components parent.
virtual HINSTANCE | getInstance ()
| Returns the instance of the application.
virtual HWND | getHwnd ()
| Returns the window handle.
virtual void | setHwnd (HWND h)
| Sets the window handle.
virtual void | addCallBack (COMCALLBACK callback)
| Adds a callback function.
virtual void | addCallBack (CallBack *callback)
| Adds a callback method.
virtual LRESULT | fireEvents (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
| Propagates events to all the callback functions.
## Static Public Methods
UINT | getWndProc ()
| Returns the the address of GlobalProc().
## Protected Attributes
Component * | parent
| The parent of the component.
HINSTANCE | hInstance
| The instance of this application.
HWND | hwnd
| The handle to the component.
std::vector< CHILDCOMPONENT > | clisteners
| A list of the child components that events are to be passed to.
std::vector< COMCALLBACK > | comlisteners
| Stores the callbacks for this component that use functions. Stores the functions given to AddCallBack(). It is used by FireEvents() to notify the callbacks.
std::vector< CallBack * > | classlisteners
| Stores the callbacks for this component that come from classes. Stores the functions given to AddCallBack(). It is used by FireEvents() to notify the callbacks.
## Friends
LRESULT CALLBACK | globalProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
| Is used to process all the callback functions.

## Detailed Description

This is the base class for all components in the MigLib. This class defines how events are fired, and how components are shown.

Author:
  Micheal Nooner

## Constructor & Destructor Documentation

Component::Component | ( |  | ) |

| Defualt Constructor.

## Member Function Documentation

void Component::addCallBack | ( | CallBack * | callback | ) | `[virtual]`

  | Adds a callback method. The callback must be a method from a class that inheirits from CallBack. Parameters:
  callback | the function to call when an event occurs
See also: FireEvents(), classlisteners

void Component::addCallBack | ( | COMCALLBACK | callback | ) | `[virtual]`

  | Adds a callback function. Parameters:
  callback | the function to call when an event occurs
See also: FireEvents(), comlisteners

LRESULT Component::fireChildEvents | ( | UINT | message,
|  | WPARAM | wParam,
|  | LPARAM | lParam
| ) | `[virtual]`

  | Propagates the events to the appropriate child/children. Parameters:
  message | the windows message to pass to the callback
  wParam | the submessage (see windows docs).
  lParam | the subparameter (see windows docs).
Returns: 0 if the event was handled otherwise what DefWindowProc returns. See also: RegisterChild(), clisteners Reimplemented in wkgl::Dialog.

LRESULT Component::fireEvents | ( | HWND | hwnd,
|  | UINT | message,
|  | WPARAM | wParam,
|  | LPARAM | lParam
| ) | `[virtual]`

  | Propagates events to all the callback functions. Parameters:
  hwnd | the window handle to the window the events go to.
  message | the windows message to pass to the callback.
  wParam | the submessage (see windows docs).
  lParam | the subparameter (see windows docs).
Returns: 0 if the event was handled otherwise what DefWindowProc returns. See also: AddCallBack(), comlisteners Reimplemented in wkgl::Dialog.

HWND Component::getHwnd | ( |  | ) | `[virtual]`

| Returns the window handle. Returns: the window handle.

HINSTANCE Component::getInstance | ( |  | ) | `[virtual]`

| Returns the instance of the application. Returns: the instance of the application.

Component * Component::getParent | ( |  | ) | `[virtual]`

| Returns a pointer to the parent component. Returns: A pointer to the parent component.

UINT Component::getWndProc | ( |  | ) | `[static]`

| Returns the the address of GlobalProc(). Returns: the the address of GlobalProc().

void Component::registerChild | ( | HWND * | hwnd,
|  | Component * | com
| ) | `[virtual]`

  | Allows this component to propagate an event to the given child. Parameters:
  hwnd | the window handle of the control to register.
  com | the control to register.
See also: CHILDCOMPONENT, clisteners

void Component::registerComponent | ( | HWND * | hwnd,
|  | Component * | com
| ) | `[virtual]`

  | Allows this component to recieve top level events. Parameters:
  hwnd | the window handle of the control to register.
  com | the control to register.
See also: AddCallBack(), FireEvents(), GlobalProc()

void Component::setHwnd | ( | HWND | h | ) | `[virtual]`

  | Sets the window handle. Parameters:
  h | The new window handle.

void Component::setParent | ( | Component * | p | ) | `[virtual]`

  | Sets the components parent. Parameters:
  p | The new parent of this component.

## Friends And Related Function Documentation

LRESULT CALLBACK globalProc | ( | HWND | hwnd,
|  | UINT | message,
|  | WPARAM | wParam,
|  | LPARAM | lParam
| ) | `[friend]`

  | Is used to process all the callback functions. Parameters:
  hwnd | the window handle to the window the events go to
  message | the windows message to pass to the callback
  wParam | the submessage (see windows docs).
  lParam | the subparameter (see windows docs).
Returns: what the appropriate component's FireEvent() method returns otherwise if returns what DefWindowProc() returns. See also: Component::FireEvents

## Member Data Documentation

std::vector< CallBack* > wkgl::Component::classlisteners`[protected]`

| Stores the callbacks for this component that come from classes. Stores the functions given to AddCallBack(). It is used by FireEvents() to notify the callbacks. See also: AddCallBack(), FireEvents()

std::vector< CHILDCOMPONENT > wkgl::Component::clisteners`[protected]`

| A list of the child components that events are to be passed to. Stores the children who wish to recieve events. See also: FireChildEvents(), CHILDCOMPONENT

std::vector< COMCALLBACK > wkgl::Component::comlisteners`[protected]`

| Stores the callbacks for this component that use functions. Stores the functions given to AddCallBack(). It is used by FireEvents() to notify the callbacks. See also: AddCallBack(), FireEvents()

HINSTANCE wkgl::Component::hInstance`[protected]`

| The instance of this application.

HWND wkgl::Component::hwnd`[protected]`

| The handle to the component.

Component* wkgl::Component::parent`[protected]`

| The parent of the component. Reimplemented in wkgl::Control.

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

- Component.h
- Component.cpp