Graphic Calculator: FIDocalcus
Проект трёх первокурсников (по инженерному практикуму в первом семестре) по созданию графического калькулятора на FLTK C++
Loading...
Searching...
No Matches
Graph_lib::Window Class Reference

#include <Window.h>

Inheritance diagram for Graph_lib::Window:
Collaboration diagram for Graph_lib::Window:

Public Member Functions

 Window (pix_amount _width, pix_amount _height, const std::string &title)
 
 Window (Point top_left_corner, pix_amount _width, pix_amount _height, const std::string &title)
 
virtual ~Window ()=default
 
void attach (Shape &)
 
void attach (Widget &)
 
void detach (Shape &)
 Удаляет фигуру из соотв. списка
 
void detach (Widget &)
 Отвязывает виджет от окна, деактивируя коллбэки
 
pix_amount h () const
 
void put_on_top (Shape &)
 
void put_on_top (Widget &)
 
void resize (pix_amount _width, pix_amount _height)
 
void set_label (const std::string &s)
 
pix_amount w () const
 

Protected Member Functions

void draw ()
 

Private Member Functions

virtual void init ()
 

Private Attributes

pix_amount height
 
std::vector< Shape * > shapes
 
pix_amount width
 

Constructor & Destructor Documentation

◆ Window() [1/2]

Graph_lib::Window::Window ( pix_amount _width,
pix_amount _height,
const std::string & title )
6 : Fl_Window{int(_width), int(_height), title.c_str()},
7 width{_width},
8 height{_height} {
9 init();
10}
pix_amount height
Definition Window.h:56
pix_amount width
Definition Window.h:55
virtual void init()
Definition Window.cpp:21
W & reference_to(void *ptr_wid)
Definition Widgets.h:16
Here is the call graph for this function:

◆ Window() [2/2]

Graph_lib::Window::Window ( Point top_left_corner,
pix_amount _width,
pix_amount _height,
const std::string & title )
14 : Fl_Window{int(top_left_corner.x), int(top_left_corner.y), int(_width),
15 int(_height), title.c_str()},
16 width{_width},
17 height{_height} {
18 init();
19}
Here is the call graph for this function:

◆ ~Window()

virtual Graph_lib::Window::~Window ( )
virtualdefault

Member Function Documentation

◆ attach() [1/2]

void Graph_lib::Window::attach ( Shape & shape)
41{ shapes.push_back(&shape); }
std::vector< Shape * > shapes
Definition Window.h:54
Here is the caller graph for this function:

◆ attach() [2/2]

void Graph_lib::Window::attach ( Widget & widget)
31 {
32 Fl_Group::begin(); // FTLK: начинаем прикреплять к этому окну новые
33 // Fl_Widgets
34 widget.attach(*this); // позволяем виджету создать свои Fl_Widgets
35 Fl_Group::end(); // FTLK: прекращаем прикреплять новые
36 // Fl_Widgets к этому окну
37}

◆ detach() [1/2]

void Graph_lib::Window::detach ( Shape & shape)

Удаляет фигуру из соотв. списка

43 {
44 // последнее прикрепленное будет выпущено первым
45 for (unsigned int i = shapes.size(); 0 < i; --i)
46 if (shapes[i - 1] == &shape) shapes.erase(shapes.begin() + (i - 1));
47}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ detach() [2/2]

void Graph_lib::Window::detach ( Widget & widget)

Отвязывает виджет от окна, деактивируя коллбэки

39{ widget.hide(); }

◆ draw()

void Graph_lib::Window::draw ( )
protected
26 {
27 Fl_Window::draw();
28 for (unsigned int i = 0; i < shapes.size(); ++i) shapes[i]->draw();
29}
void draw()
Definition Window.cpp:26
Here is the call graph for this function:
Here is the caller graph for this function:

◆ h()

pix_amount Graph_lib::Window::h ( ) const
inline
28{ return height; }
Here is the caller graph for this function:

◆ init()

void Graph_lib::Window::init ( )
privatevirtual

Reimplemented in Graphix_window.

21 {
22 Fl_Group::resizable(this);
23 Fl_Window::show();
24}
Here is the caller graph for this function:

◆ put_on_top() [1/2]

void Graph_lib::Window::put_on_top ( Shape & shape)
49 {
50 detach(shape);
51 attach(shape);
52}
void attach(Shape &)
Definition Window.cpp:41
void detach(Shape &)
Удаляет фигуру из соотв. списка
Definition Window.cpp:43
Here is the call graph for this function:

◆ put_on_top() [2/2]

void Graph_lib::Window::put_on_top ( Widget & widget)
54 {
55 detach(widget);
56 attach(widget);
57}
Here is the call graph for this function:

◆ resize()

void Graph_lib::Window::resize ( pix_amount _width,
pix_amount _height )
inline
30 {
31 width = _width;
33 size(_width, _height);
34 }
Here is the call graph for this function:

◆ set_label()

void Graph_lib::Window::set_label ( const std::string & s)
inline
36{ label(s.c_str()); }

◆ w()

pix_amount Graph_lib::Window::w ( ) const
inline
26{ return width; }
Here is the caller graph for this function:

Member Data Documentation

◆ height

pix_amount Graph_lib::Window::height
private

◆ shapes

std::vector<Shape*> Graph_lib::Window::shapes
private

◆ width

pix_amount Graph_lib::Window::width
private

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