Wt::SDLTimer Class Reference

#include <sdltimer.h>

Collaboration diagram for Wt::SDLTimer:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SDLTimer (Object *receiver, int id, int interval)
 ~SDLTimer ()
void scheduleNext ()
int interval () const

Static Public Member Functions

static void init ()
static void quit ()

Static Private Member Functions

static void handleTimerEvent (const SDL_Event *event)

Private Attributes

Event sdl_timer_event
SDL_TimerID timerid_
int interval_

Classes

class  Event

Detailed Description

Definition at line 33 of file sdltimer.h.


Constructor & Destructor Documentation

Wt::SDLTimer::SDLTimer ( Object receiver,
int  id,
int  interval 
)

Definition at line 51 of file sdltimer.cpp.

References scheduleNext().

00051                                                          :
00052         sdl_timer_event(Event(receiver, id)),
00053         timerid_(interval ? SDL_AddTimer(interval,
00054                                          timer_callback, &sdl_timer_event) :
00055                  0),
00056 interval_(interval) {
00057     scheduleNext();
00058 }

Here is the call graph for this function:

Wt::SDLTimer::~SDLTimer (  ) 

Definition at line 60 of file sdltimer.cpp.

References timerid_.

00060                     {
00061     if (timerid_)
00062         SDL_RemoveTimer(timerid_);
00063 }


Member Function Documentation

void Wt::SDLTimer::handleTimerEvent ( const SDL_Event *  event  )  [static, private]

Definition at line 77 of file sdltimer.cpp.

References Wt::SDLTimer::Event::id(), Wt::Application::postEvent(), Wt::SDLTimer::Event::receiver(), and sdl_timer_event.

Referenced by init().

00077                                                       {
00078     Event *sdl_timer_event = static_cast<Event *>(event->user.data1);
00079     Application::postEvent(sdl_timer_event->receiver(),
00080                            new TimerEvent(sdl_timer_event->id()));
00081     delete sdl_timer_event;
00082 }

Here is the call graph for this function:

void Wt::SDLTimer::init (  )  [static]

Definition at line 70 of file sdltimer.cpp.

References handleTimerEvent(), Wt::Singleton< DERIVED >::instance(), and Wt::SDLEvent::Time.

Referenced by Wt::Application::Application().

00070                     {
00071     SDLEvent& sdlevent = *SDLEvent::instance();
00072     sdlevent[SDLEvent::Time] = &handleTimerEvent;
00073 }

Here is the call graph for this function:

int Wt::SDLTimer::interval (  )  const [inline]

Definition at line 38 of file sdltimer.h.

References interval_.

00038                          {
00039         return interval_;
00040     }

void Wt::SDLTimer::quit (  )  [static]

Definition at line 75 of file sdltimer.cpp.

Referenced by Wt::Application::~Application().

00075 {}

void Wt::SDLTimer::scheduleNext (  ) 

Definition at line 65 of file sdltimer.cpp.

References interval_, sdl_timer_event, and Wt::timer_callback().

Referenced by Wt::Object::event(), and SDLTimer().

00065                             {
00066     if (!interval_)
00067         timer_callback(interval_, &sdl_timer_event);
00068 }

Here is the call graph for this function:


Member Data Documentation

int Wt::SDLTimer::interval_ [private]

Definition at line 67 of file sdltimer.h.

Referenced by interval(), and scheduleNext().

Event Wt::SDLTimer::sdl_timer_event [private]

Definition at line 65 of file sdltimer.h.

Referenced by handleTimerEvent(), and scheduleNext().

SDL_TimerID Wt::SDLTimer::timerid_ [private]

Definition at line 66 of file sdltimer.h.

Referenced by ~SDLTimer().


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

Generated Fri Jul 28 19:33:00 2006.
Copyright © 1998-2003 by the respective authors.

This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.