Window - FTLK stop attaching new Fl_Wigets to this window void Window:detach(Widget& b b.hide void Window:attach(Shape& s

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

View Full Document Right Arrow Icon
#include "Window.h" #include "Graph.h" #include "GUI.h" # namespace Graph_lib { n :Fl_Window(ww,hh,title.c_str()),w(ww),h(hh) { init(); } :Fl_Window(xy.x,xy.y,ww,hh,title.c_str()),w(ww),h(hh) { init(); } void Window::init() { resizable(this); show(); } } //---------------------------------------------------- / void Window::draw() { Fl_Window::draw(); for (unsigned int i=0; i<shapes.size(); ++i) shapes[i]->draw(); } { begin(); // FTLK: begin attaching new Fl_Wigets to this window w.attach(*this); // let the Widget create its Fl_Wigits end();
Background image of page 1

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

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

Unformatted text preview: // FTLK: stop attaching new Fl_Wigets to this window } void Window::detach(Widget& b) { b.hide(); } void Window::attach(Shape& s) { shapes.push_back(&s); // s.attached = this; } void Window::detach(Shape& s) { for (unsigned int i = shapes.size(); 0<i; --i) // guess last attached will be first released if (shapes[i-1]==&s) shapes.erase(shapes.begin()+(i-1));//&shapes[i-1]); } void Window::put_on_top(Shape& p) { for (int i=0; i<shapes.size(); ++i) { if (&p==shapes[i]) { for (++i; i<shapes.size(); ++i) shapes[i-1] = shapes[i]; shapes[shapes.size()-1] = &p; return; } } } int gui_main() { return Fl::run(); } i } // Graph...
View Full Document

This note was uploaded on 02/26/2011 for the course ECE 112 taught by Professor Doraty during the Spring '11 term at Texas A&M.

Page1 / 2

Window - FTLK stop attaching new Fl_Wigets to this window void Window:detach(Widget& b b.hide void Window:attach(Shape& s

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