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

#include <Widgets.h>

Inheritance diagram for Graph_lib::Button:
Collaboration diagram for Graph_lib::Button:

Public Member Functions

 Button (Point _loc, pix_amount _width, pix_amount _height, const std::string &_label, Callback _cb)
 
void attach (Window &)
 
virtual void hide ()
 
virtual void move (int dx, int dy)
 
virtual void show ()
 
Windowwindow ()
 

Protected Attributes

Callback cb
 
pix_amount height
 
std::string label
 
Point loc
 
Windowown
 Окно, которому принадлежит виджет
 
Fl_Widgetptr_wid
 Указатель на FLTK виджет
 
pix_amount width
 

Constructor & Destructor Documentation

◆ Button()

Graph_lib::Button::Button ( Point _loc,
pix_amount _width,
pix_amount _height,
const std::string & _label,
Callback _cb )
inline
77 : Widget{_loc, _width, _height, _label, _cb} {}
W & reference_to(void *ptr_wid)
Definition Widgets.h:16

Member Function Documentation

◆ attach()

void Graph_lib::Button::attach ( Window & win)
virtual

Implements Graph_lib::Widget.

20 {
21 // (FLTK работает на int'ах, так что преобразуем)
22 ptr_wid = new Fl_Button{int(loc.x), int(loc.y), int(width), int(height),
23 label.c_str()};
24 // (великий и ужасный...)
25 ptr_wid->callback(reinterpret_cast<Fl_Callback*>(cb), this);
26 own = &win;
27}
Window * own
Окно, которому принадлежит виджет
Definition Widgets.h:57
std::string label
Definition Widgets.h:66
pix_amount width
Definition Widgets.h:63
pix_amount height
Definition Widgets.h:64
Callback cb
Definition Widgets.h:67
Point loc
Definition Widgets.h:62
Fl_Widget * ptr_wid
Указатель на FLTK виджет
Definition Widgets.h:60
pix_amount y
Definition Point.h:30
pix_amount x
Definition Point.h:30

◆ hide()

virtual void Graph_lib::Widget::hide ( )
inlinevirtualinherited
41{ ptr_wid->hide(); }
Here is the caller graph for this function:

◆ move()

void Graph_lib::Widget::move ( int dx,
int dy )
virtualinherited

Reimplemented in Graphix_calc::Function_box.

9 {
10 if (dx + int(loc.x) < 0 || dy + int(loc.y) < 0)
11 throw std::invalid_argument("bad dx or dy");
12
13 hide();
14 ptr_wid->position(loc.x += dx, loc.y += dy);
15 show();
16}
virtual void hide()
Definition Widgets.h:41
virtual void show()
Definition Widgets.h:43
Here is the call graph for this function:
Here is the caller graph for this function:

◆ show()

virtual void Graph_lib::Widget::show ( )
inlinevirtualinherited
43{ ptr_wid->show(); }
Here is the caller graph for this function:

◆ window()

Window & Graph_lib::Widget::window ( )
inlineinherited
47{ return *own; }

Member Data Documentation

◆ cb

Callback Graph_lib::Widget::cb
protectedinherited

◆ height

pix_amount Graph_lib::Widget::height
protectedinherited

◆ label

std::string Graph_lib::Widget::label
protectedinherited

◆ loc

Point Graph_lib::Widget::loc
protectedinherited

◆ own

Window* Graph_lib::Widget::own
protectedinherited

Окно, которому принадлежит виджет

◆ ptr_wid

Fl_Widget* Graph_lib::Widget::ptr_wid
protectedinherited

Указатель на FLTK виджет

◆ width

pix_amount Graph_lib::Widget::width
protectedinherited

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