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

Drawing::Canvas Class Reference

A specialized version of the window class that knows about this drawing. More...

Inheritance diagram for Drawing::Canvas:

SimpleWindow List of all members.

Public Methods

 Canvas (std::string title, float width, float height, Drawing *)
virtual int MouseClickEvent (const Position &)
 Calls the function associated with mouse clicks.

virtual int RefreshEvent ()
 Calls the function assoicated with the window being exposed.

virtual int TimerEvent ()
 Calls the function associated with the timer expiring.


Private Attributes

Drawing *const drawing

Detailed Description

A specialized version of the window class that knows about this drawing.


Constructor & Destructor Documentation

Drawing::Canvas::Canvas std::string    title,
float    width,
float    height,
Drawing  
 

00200   : SimpleWindow(title,width,height), drawing(d)
00201 {
00202   Open();
00203   // the callback is unused, but if we don't set it
00204   // we don't get any events:
00205   SetMouseClickCallback(bogus1);
00206   SetRefreshCallback(bogus2);
00207   SetTimerCallback(bogus2);
00208 
00209   RefreshEvent();
00210 }


Member Function Documentation

int Drawing::Canvas::MouseClickEvent const Position &    p [virtual]
 

Calls the function associated with mouse clicks.

Reimplemented from SimpleWindow.

00213 {
00214   Tool* tool = drawing->tool_window->current_tool();
00215   int result = 0;
00216   if (tool) {
00217     result = tool->mouseClick(p);
00218   }
00219   drawing->refresh_if_needed();
00220   return result;
00221 }

int Drawing::Canvas::RefreshEvent   [virtual]
 

Calls the function assoicated with the window being exposed.

Reimplemented from SimpleWindow.

00224 {
00225   drawing->needs_refreshing = false;
00226   Erase(Position(0,0),GetWidth(),GetHeight());
00227   drawing->contents->render(this);
00228   return 1;
00229 }

int Drawing::Canvas::TimerEvent   [virtual]
 

Calls the function associated with the timer expiring.

Reimplemented from SimpleWindow.

00232 {
00233   if (drawing->canned_input == 0) return 0;
00234   if (!drawing->canned_input->execute_one_event(drawing)) {
00235     drawing->canned_input = 0;
00236     StopTimer();
00237   }
00238   return 1;
00239 }


Member Data Documentation

Drawing* const Drawing::Canvas::drawing [private]
 


The documentation for this class was generated from the following files:
Generated on Fri Nov 8 10:52:29 2002 for Draw by doxygen1.2.17