GUI - #ifndef GUI_GUARD # #define GUI_GUARD #include...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#ifndef GUI_GUARD #define GUI_GUARD # #include "Point.h" #include "fltk.h" #include "Window.h" #include<vector> # namespace Graph_lib { n typedef void* Address; typedef void (*Callback)(Address,Address); // FLTK's required function type for all callbacks f // treat an address as a reference to a W { return *static_cast<W*>(pw); } class Widget { // Widget is a handle to a Fl_widget - it is *not* a Fl_widget // We try to keep our interface classes at arm's length from FLTK public: :loc(xy), width(w), height(h), label(s), do_it(cb) { } { virtual void move(int dx,int dy) { hide(); pw->position(loc.x+=dx, loc.y+=dy); show(); } virtual void hide() { pw->hide(); } virtual void show() { pw->show(); } virtual void attach(Window&) = 0; // each Widgit define at least one action for a window f Point loc; int width; int height; string label; Callback do_it; C virtual ~Widget() { } v /* Widget(const Widget& a) :loc(a.loc) { error("attempt to copy Widget by
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

GUI - #ifndef GUI_GUARD # #define GUI_GUARD #include...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online