SlideShare a Scribd company logo
1 of 3
Download to read offline
1 #include <iostream>
2 #include <FL/Fl.H>
3 #include <FL/Fl_Window.H>
4 #include <FL/Fl_Button.H>
5
6 /*Declaração de namespace para uso das funções de iostream*/
7 using namespace std;
8
9 /**
10 * Classe para verificação de eventos em um botão ...
11 **/
12 class MyButton : public Fl_Button
13 {
14 /*Variável estática para contagem de eventos*/
15 static int count;
16
17 public:
18
19 /*Construtor*/
20 MyButton(int x,int y,int w,int h,const char*l=0):Fl_Button(x,y,w,h,l){};
21
22 /*Sobreposição do método manipulador de eventos*/
23 int handle(int event)
24 {
25 int retorno = Fl_Button::handle(event);
26 cout << endl << count++ << " ******** button " << this->label() << " receives ";
27
28 switch(event)
29 {
30 case FL_PUSH:
31 cout << "push" << " event and returns:" << retorno << endl;
32 break;
33
34 case FL_RELEASE:
35 cout << "release" << " event and returns:" << retorno << endl;
36 break;
37
38 case FL_ENTER:
39 color(FL_CYAN);
40 cout << "enter" << " event and returns:" << retorno << endl;
41 redraw();
42 break;
43
44 case FL_LEAVE:
45 color(FL_BACKGROUND_COLOR);
46 cout << "leave" << " event and returns:" << retorno << endl;
47 redraw();
48 break;
49
50 case FL_DRAG:
51 cout << "drag" << " event and returns:" << retorno << endl;
52 break;
53
54 case FL_FOCUS:
55 cout << "focus" << " event and returns:" << retorno << endl;
56 break;
57
58 case FL_UNFOCUS:
59 cout << "unfocus" << " event and returns:" << retorno << endl;
60 break;
61
62 case FL_KEYDOWN:
63 cout << "keydown" << " event and returns:" << retorno << endl;
64 break;
65
66 case FL_KEYUP:
67 if ( Fl::event_key() == shortcut() )
68 {
69 box(FL_UP_BOX);
70 redraw();
71 retorno = 1; //return handled so keyup event stops
72 } //being sent to ALL other buttons unecessarily
73
74 cout << "keyup" << " event and returns:" << retorno << endl;
75 break;
76
77 case FL_CLOSE:
78 cout << "close" << " event and returns:" << retorno << endl;
79 break;
80
81 case FL_MOVE:
82 cout << "move" << " event and returns:" << retorno << endl;
83 break;
84
85 case FL_SHORTCUT:
86 if ( Fl::event_key() == shortcut() )
87 {
88 box(FL_DOWN_BOX);
89 redraw();
90 }
91 cout << "shortcut" << " event and returns:" << retorno << endl;
92 break;
93
94 case FL_DEACTIVATE:
95 cout << "deactivate" << " event and returns:" << retorno << endl;
96 break;
97
98 case FL_ACTIVATE:
99 cout << "activate" << " event and returns:" << retorno << endl;
100 break;
101
102 case FL_HIDE:
103 cout << "hide" << " event and returns:" << retorno << endl;
104 break;
105
106 case FL_SHOW:
107 cout << "show" << " event and returns:" << retorno << endl;
108 break;
109
110 case FL_PASTE:
111 cout << "paste" << " event and returns:" << retorno << endl;
112 break;
113
114 case FL_SELECTIONCLEAR:
115 cout << "selectionclear" << " event and returns:" << retorno << endl;
116 break;
117
118 case FL_MOUSEWHEEL:
119 cout << "mousewheel" << " event and returns:" << retorno << endl;
120 break;
121
122 case FL_NO_EVENT:
123 cout << "no event" << " and returns:" << retorno << endl;
124 break;
125 }
126
127 /*Retorno do método ...*/
128 return(retorno);
129 }
130 };
131
132 /**
133 * Atribuição inicial da variável estática ...
134 */
135 int MyButton::count=0;
136
137 /**
138 * Funções que respondem aos callbacks
139 */
140 void but_a_cb(Fl_Widget* w, void* v)
141 {
142 cout << endl << "Button A callback!" << endl;
143 }
144
145 void but_b_cb(Fl_Widget* w, void* v)
146 {
147 cout << endl << "Button B callback!" << endl;
148 }
149
150 void but_c_cb(Fl_Widget* w, void* v)
151 {
152 cout << endl << "Button C callback!" << endl;
153 }
154
155 /**
156 * Função principal do programa.
157 */
158 int main(int argc, char* argv[])
159 {
160 Fl_Window win(120,150);
161 win.begin();
162 MyButton but_a(10,10,100,25,"A");
163 but_a.shortcut('a');
164 but_a.callback(but_a_cb);
165 MyButton but_b(10,50,100,25,"B");
166 but_b.shortcut('b');
167 but_b.callback(but_b_cb);
168 MyButton but_c(10,90,100,25,"C");
169 but_c.shortcut('c');
170 but_c.callback(but_c_cb);
171 win.end();
172 win.show();
173 return(Fl::run());
174 }
175

More Related Content

What's hot

The Ring programming language version 1.9 book - Part 14 of 210
The Ring programming language version 1.9 book - Part 14 of 210The Ring programming language version 1.9 book - Part 14 of 210
The Ring programming language version 1.9 book - Part 14 of 210Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 64 of 202
The Ring programming language version 1.8 book - Part 64 of 202The Ring programming language version 1.8 book - Part 64 of 202
The Ring programming language version 1.8 book - Part 64 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 61 of 196
The Ring programming language version 1.7 book - Part 61 of 196The Ring programming language version 1.7 book - Part 61 of 196
The Ring programming language version 1.7 book - Part 61 of 196Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 59 of 196
The Ring programming language version 1.7 book - Part 59 of 196The Ring programming language version 1.7 book - Part 59 of 196
The Ring programming language version 1.7 book - Part 59 of 196Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 60 of 196
The Ring programming language version 1.7 book - Part 60 of 196The Ring programming language version 1.7 book - Part 60 of 196
The Ring programming language version 1.7 book - Part 60 of 196Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 55 of 181
The Ring programming language version 1.5.2 book - Part 55 of 181The Ring programming language version 1.5.2 book - Part 55 of 181
The Ring programming language version 1.5.2 book - Part 55 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 58 of 189
The Ring programming language version 1.6 book - Part 58 of 189The Ring programming language version 1.6 book - Part 58 of 189
The Ring programming language version 1.6 book - Part 58 of 189Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 55 of 180
The Ring programming language version 1.5.1 book - Part 55 of 180The Ring programming language version 1.5.1 book - Part 55 of 180
The Ring programming language version 1.5.1 book - Part 55 of 180Mahmoud Samir Fayed
 
Sumsem2014 15 cp0399-13-jun-2015_rm01_programs
Sumsem2014 15 cp0399-13-jun-2015_rm01_programsSumsem2014 15 cp0399-13-jun-2015_rm01_programs
Sumsem2014 15 cp0399-13-jun-2015_rm01_programsAbhijit Borah
 
The Ring programming language version 1.5.2 book - Part 54 of 181
The Ring programming language version 1.5.2 book - Part 54 of 181The Ring programming language version 1.5.2 book - Part 54 of 181
The Ring programming language version 1.5.2 book - Part 54 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 63 of 202
The Ring programming language version 1.8 book - Part 63 of 202The Ring programming language version 1.8 book - Part 63 of 202
The Ring programming language version 1.8 book - Part 63 of 202Mahmoud Samir Fayed
 
Diagrama de flujo de simulacion de variables
Diagrama de flujo de simulacion de variablesDiagrama de flujo de simulacion de variables
Diagrama de flujo de simulacion de variablesErickPea26
 
Project fast food automaton
Project fast food automatonProject fast food automaton
Project fast food automatonvarun arora
 
The Ring programming language version 1.9 book - Part 67 of 210
The Ring programming language version 1.9 book - Part 67 of 210The Ring programming language version 1.9 book - Part 67 of 210
The Ring programming language version 1.9 book - Part 67 of 210Mahmoud Samir Fayed
 
Building powerful desktop and MR applications with new windowing apis
Building powerful desktop and MR applications with new windowing apisBuilding powerful desktop and MR applications with new windowing apis
Building powerful desktop and MR applications with new windowing apisWindows Developer
 
The Ring programming language version 1.5.3 book - Part 67 of 184
The Ring programming language version 1.5.3 book - Part 67 of 184The Ring programming language version 1.5.3 book - Part 67 of 184
The Ring programming language version 1.5.3 book - Part 67 of 184Mahmoud Samir Fayed
 
Electricitybillsystemreport
ElectricitybillsystemreportElectricitybillsystemreport
Electricitybillsystemreportvikram mahendra
 
The Ring programming language version 1.5 book - Part 10 of 31
The Ring programming language version 1.5 book - Part 10 of 31The Ring programming language version 1.5 book - Part 10 of 31
The Ring programming language version 1.5 book - Part 10 of 31Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 57 of 189
The Ring programming language version 1.6 book - Part 57 of 189The Ring programming language version 1.6 book - Part 57 of 189
The Ring programming language version 1.6 book - Part 57 of 189Mahmoud Samir Fayed
 

What's hot (20)

The Ring programming language version 1.9 book - Part 14 of 210
The Ring programming language version 1.9 book - Part 14 of 210The Ring programming language version 1.9 book - Part 14 of 210
The Ring programming language version 1.9 book - Part 14 of 210
 
The Ring programming language version 1.8 book - Part 64 of 202
The Ring programming language version 1.8 book - Part 64 of 202The Ring programming language version 1.8 book - Part 64 of 202
The Ring programming language version 1.8 book - Part 64 of 202
 
The Ring programming language version 1.7 book - Part 61 of 196
The Ring programming language version 1.7 book - Part 61 of 196The Ring programming language version 1.7 book - Part 61 of 196
The Ring programming language version 1.7 book - Part 61 of 196
 
The Ring programming language version 1.7 book - Part 59 of 196
The Ring programming language version 1.7 book - Part 59 of 196The Ring programming language version 1.7 book - Part 59 of 196
The Ring programming language version 1.7 book - Part 59 of 196
 
The Ring programming language version 1.7 book - Part 60 of 196
The Ring programming language version 1.7 book - Part 60 of 196The Ring programming language version 1.7 book - Part 60 of 196
The Ring programming language version 1.7 book - Part 60 of 196
 
The Ring programming language version 1.5.2 book - Part 55 of 181
The Ring programming language version 1.5.2 book - Part 55 of 181The Ring programming language version 1.5.2 book - Part 55 of 181
The Ring programming language version 1.5.2 book - Part 55 of 181
 
Open GL Tutorial07
Open GL  Tutorial07Open GL  Tutorial07
Open GL Tutorial07
 
The Ring programming language version 1.6 book - Part 58 of 189
The Ring programming language version 1.6 book - Part 58 of 189The Ring programming language version 1.6 book - Part 58 of 189
The Ring programming language version 1.6 book - Part 58 of 189
 
The Ring programming language version 1.5.1 book - Part 55 of 180
The Ring programming language version 1.5.1 book - Part 55 of 180The Ring programming language version 1.5.1 book - Part 55 of 180
The Ring programming language version 1.5.1 book - Part 55 of 180
 
Sumsem2014 15 cp0399-13-jun-2015_rm01_programs
Sumsem2014 15 cp0399-13-jun-2015_rm01_programsSumsem2014 15 cp0399-13-jun-2015_rm01_programs
Sumsem2014 15 cp0399-13-jun-2015_rm01_programs
 
The Ring programming language version 1.5.2 book - Part 54 of 181
The Ring programming language version 1.5.2 book - Part 54 of 181The Ring programming language version 1.5.2 book - Part 54 of 181
The Ring programming language version 1.5.2 book - Part 54 of 181
 
The Ring programming language version 1.8 book - Part 63 of 202
The Ring programming language version 1.8 book - Part 63 of 202The Ring programming language version 1.8 book - Part 63 of 202
The Ring programming language version 1.8 book - Part 63 of 202
 
Diagrama de flujo de simulacion de variables
Diagrama de flujo de simulacion de variablesDiagrama de flujo de simulacion de variables
Diagrama de flujo de simulacion de variables
 
Project fast food automaton
Project fast food automatonProject fast food automaton
Project fast food automaton
 
The Ring programming language version 1.9 book - Part 67 of 210
The Ring programming language version 1.9 book - Part 67 of 210The Ring programming language version 1.9 book - Part 67 of 210
The Ring programming language version 1.9 book - Part 67 of 210
 
Building powerful desktop and MR applications with new windowing apis
Building powerful desktop and MR applications with new windowing apisBuilding powerful desktop and MR applications with new windowing apis
Building powerful desktop and MR applications with new windowing apis
 
The Ring programming language version 1.5.3 book - Part 67 of 184
The Ring programming language version 1.5.3 book - Part 67 of 184The Ring programming language version 1.5.3 book - Part 67 of 184
The Ring programming language version 1.5.3 book - Part 67 of 184
 
Electricitybillsystemreport
ElectricitybillsystemreportElectricitybillsystemreport
Electricitybillsystemreport
 
The Ring programming language version 1.5 book - Part 10 of 31
The Ring programming language version 1.5 book - Part 10 of 31The Ring programming language version 1.5 book - Part 10 of 31
The Ring programming language version 1.5 book - Part 10 of 31
 
The Ring programming language version 1.6 book - Part 57 of 189
The Ring programming language version 1.6 book - Part 57 of 189The Ring programming language version 1.6 book - Part 57 of 189
The Ring programming language version 1.6 book - Part 57 of 189
 

Viewers also liked

Servicios web con Python
Servicios web con PythonServicios web con Python
Servicios web con PythonManuel Pérez
 
FLTK Summer Course - Part II - Second Impact - Exercises
FLTK Summer Course - Part II - Second Impact - Exercises FLTK Summer Course - Part II - Second Impact - Exercises
FLTK Summer Course - Part II - Second Impact - Exercises Michel Alves
 
Git hooks For PHP Developers
Git hooks For PHP DevelopersGit hooks For PHP Developers
Git hooks For PHP DevelopersUmut IŞIK
 
Using Git on the Command Line
Using Git on the Command LineUsing Git on the Command Line
Using Git on the Command LineBrian Richards
 
Introduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsIntroduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsCarl Brown
 
"Git Hooked!" Using Git hooks to improve your software development process
"Git Hooked!" Using Git hooks to improve your software development process"Git Hooked!" Using Git hooks to improve your software development process
"Git Hooked!" Using Git hooks to improve your software development processPolished Geek LLC
 
EuroPython 2013 - FAST, DOCUMENTED AND RELIABLE JSON BASED WEBSERVICES WITH P...
EuroPython 2013 - FAST, DOCUMENTED AND RELIABLE JSON BASED WEBSERVICES WITH P...EuroPython 2013 - FAST, DOCUMENTED AND RELIABLE JSON BASED WEBSERVICES WITH P...
EuroPython 2013 - FAST, DOCUMENTED AND RELIABLE JSON BASED WEBSERVICES WITH P...Alessandro Molina
 
FLTK Summer Course - Part VIII - Eighth Impact
FLTK Summer Course - Part VIII - Eighth ImpactFLTK Summer Course - Part VIII - Eighth Impact
FLTK Summer Course - Part VIII - Eighth ImpactMichel Alves
 
FLTK Summer Course - Part VII - Seventh Impact
FLTK Summer Course - Part VII  - Seventh ImpactFLTK Summer Course - Part VII  - Seventh Impact
FLTK Summer Course - Part VII - Seventh ImpactMichel Alves
 
FLTK Summer Course - Part I - First Impact - Exercises
FLTK Summer Course - Part I - First Impact - ExercisesFLTK Summer Course - Part I - First Impact - Exercises
FLTK Summer Course - Part I - First Impact - ExercisesMichel Alves
 
FLTK Summer Course - Part II - Second Impact
FLTK Summer Course - Part II - Second ImpactFLTK Summer Course - Part II - Second Impact
FLTK Summer Course - Part II - Second ImpactMichel Alves
 
Manipulating file in Python
Manipulating file in PythonManipulating file in Python
Manipulating file in Pythonshoukatali500
 
Blisstering drupal module development ppt v1.2
Blisstering drupal module development ppt v1.2Blisstering drupal module development ppt v1.2
Blisstering drupal module development ppt v1.2Anil Sagar
 
Code Refactoring - Live Coding Demo (JavaDay 2014)
Code Refactoring - Live Coding Demo (JavaDay 2014)Code Refactoring - Live Coding Demo (JavaDay 2014)
Code Refactoring - Live Coding Demo (JavaDay 2014)Peter Kofler
 
FLTK Summer Course - Part III - Third Impact
FLTK Summer Course - Part III - Third ImpactFLTK Summer Course - Part III - Third Impact
FLTK Summer Course - Part III - Third ImpactMichel Alves
 
Creating Custom Drupal Modules
Creating Custom Drupal ModulesCreating Custom Drupal Modules
Creating Custom Drupal Modulestanoshimi
 
TMS - Schedule of Presentations and Reports
TMS - Schedule of Presentations and ReportsTMS - Schedule of Presentations and Reports
TMS - Schedule of Presentations and ReportsMichel Alves
 
13 Graph Classes
13 Graph Classes13 Graph Classes
13 Graph Classespoffdeluxe
 
Internal Anatomy of an Update
Internal Anatomy of an UpdateInternal Anatomy of an Update
Internal Anatomy of an UpdateMongoDB
 

Viewers also liked (20)

Servicios web con Python
Servicios web con PythonServicios web con Python
Servicios web con Python
 
FLTK Summer Course - Part II - Second Impact - Exercises
FLTK Summer Course - Part II - Second Impact - Exercises FLTK Summer Course - Part II - Second Impact - Exercises
FLTK Summer Course - Part II - Second Impact - Exercises
 
Git hooks For PHP Developers
Git hooks For PHP DevelopersGit hooks For PHP Developers
Git hooks For PHP Developers
 
Using Git on the Command Line
Using Git on the Command LineUsing Git on the Command Line
Using Git on the Command Line
 
Introduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsIntroduction to Git Commands and Concepts
Introduction to Git Commands and Concepts
 
Advanced Git
Advanced GitAdvanced Git
Advanced Git
 
"Git Hooked!" Using Git hooks to improve your software development process
"Git Hooked!" Using Git hooks to improve your software development process"Git Hooked!" Using Git hooks to improve your software development process
"Git Hooked!" Using Git hooks to improve your software development process
 
EuroPython 2013 - FAST, DOCUMENTED AND RELIABLE JSON BASED WEBSERVICES WITH P...
EuroPython 2013 - FAST, DOCUMENTED AND RELIABLE JSON BASED WEBSERVICES WITH P...EuroPython 2013 - FAST, DOCUMENTED AND RELIABLE JSON BASED WEBSERVICES WITH P...
EuroPython 2013 - FAST, DOCUMENTED AND RELIABLE JSON BASED WEBSERVICES WITH P...
 
FLTK Summer Course - Part VIII - Eighth Impact
FLTK Summer Course - Part VIII - Eighth ImpactFLTK Summer Course - Part VIII - Eighth Impact
FLTK Summer Course - Part VIII - Eighth Impact
 
FLTK Summer Course - Part VII - Seventh Impact
FLTK Summer Course - Part VII  - Seventh ImpactFLTK Summer Course - Part VII  - Seventh Impact
FLTK Summer Course - Part VII - Seventh Impact
 
FLTK Summer Course - Part I - First Impact - Exercises
FLTK Summer Course - Part I - First Impact - ExercisesFLTK Summer Course - Part I - First Impact - Exercises
FLTK Summer Course - Part I - First Impact - Exercises
 
FLTK Summer Course - Part II - Second Impact
FLTK Summer Course - Part II - Second ImpactFLTK Summer Course - Part II - Second Impact
FLTK Summer Course - Part II - Second Impact
 
Manipulating file in Python
Manipulating file in PythonManipulating file in Python
Manipulating file in Python
 
Blisstering drupal module development ppt v1.2
Blisstering drupal module development ppt v1.2Blisstering drupal module development ppt v1.2
Blisstering drupal module development ppt v1.2
 
Code Refactoring - Live Coding Demo (JavaDay 2014)
Code Refactoring - Live Coding Demo (JavaDay 2014)Code Refactoring - Live Coding Demo (JavaDay 2014)
Code Refactoring - Live Coding Demo (JavaDay 2014)
 
FLTK Summer Course - Part III - Third Impact
FLTK Summer Course - Part III - Third ImpactFLTK Summer Course - Part III - Third Impact
FLTK Summer Course - Part III - Third Impact
 
Creating Custom Drupal Modules
Creating Custom Drupal ModulesCreating Custom Drupal Modules
Creating Custom Drupal Modules
 
TMS - Schedule of Presentations and Reports
TMS - Schedule of Presentations and ReportsTMS - Schedule of Presentations and Reports
TMS - Schedule of Presentations and Reports
 
13 Graph Classes
13 Graph Classes13 Graph Classes
13 Graph Classes
 
Internal Anatomy of an Update
Internal Anatomy of an UpdateInternal Anatomy of an Update
Internal Anatomy of an Update
 

Similar to FLTK Summer Course - Part VI - Sixth Impact - Exercises

MVI - Managing State The Kotlin Way
MVI - Managing State The Kotlin WayMVI - Managing State The Kotlin Way
MVI - Managing State The Kotlin WayZeyad Gasser
 
The Ring programming language version 1.10 book - Part 68 of 212
The Ring programming language version 1.10 book - Part 68 of 212The Ring programming language version 1.10 book - Part 68 of 212
The Ring programming language version 1.10 book - Part 68 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 16 of 212
The Ring programming language version 1.10 book - Part 16 of 212The Ring programming language version 1.10 book - Part 16 of 212
The Ring programming language version 1.10 book - Part 16 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 66 of 184
The Ring programming language version 1.5.3 book - Part 66 of 184The Ring programming language version 1.5.3 book - Part 66 of 184
The Ring programming language version 1.5.3 book - Part 66 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 57 of 185
The Ring programming language version 1.5.4 book - Part 57 of 185The Ring programming language version 1.5.4 book - Part 57 of 185
The Ring programming language version 1.5.4 book - Part 57 of 185Mahmoud Samir Fayed
 
Lecture#5 Operators in C++
Lecture#5 Operators in C++Lecture#5 Operators in C++
Lecture#5 Operators in C++NUST Stuff
 
Please respond only if you can answer the whole question ~~~~~.pdf
Please respond only if you can answer the whole question ~~~~~.pdfPlease respond only if you can answer the whole question ~~~~~.pdf
Please respond only if you can answer the whole question ~~~~~.pdfhadpadrrajeshh
 
I hope the below code is helpful to you, please give me rewards.im.pdf
I hope the below code is helpful to you, please give me rewards.im.pdfI hope the below code is helpful to you, please give me rewards.im.pdf
I hope the below code is helpful to you, please give me rewards.im.pdfapexelectronices01
 
The Ring programming language version 1.9 book - Part 66 of 210
The Ring programming language version 1.9 book - Part 66 of 210The Ring programming language version 1.9 book - Part 66 of 210
The Ring programming language version 1.9 book - Part 66 of 210Mahmoud Samir Fayed
 
Yahoo presentation: JavaScript Events
Yahoo presentation: JavaScript EventsYahoo presentation: JavaScript Events
Yahoo presentation: JavaScript EventsPeter-Paul Koch
 
Does testability imply good design - Andrzej Jóźwiak - TomTom Dev Day 2022
Does testability imply good design - Andrzej Jóźwiak - TomTom Dev Day 2022Does testability imply good design - Andrzej Jóźwiak - TomTom Dev Day 2022
Does testability imply good design - Andrzej Jóźwiak - TomTom Dev Day 2022Andrzej Jóźwiak
 
Matteo Antony Mistretta - Refactoring into React hooks - Codemotion Rome 2019
Matteo Antony Mistretta - Refactoring into React hooks - Codemotion Rome 2019Matteo Antony Mistretta - Refactoring into React hooks - Codemotion Rome 2019
Matteo Antony Mistretta - Refactoring into React hooks - Codemotion Rome 2019Codemotion
 
551 pd fsam_fayed_ring_doc_1.5.2
551 pd fsam_fayed_ring_doc_1.5.2551 pd fsam_fayed_ring_doc_1.5.2
551 pd fsam_fayed_ring_doc_1.5.2Mahmoud Samir Fayed
 
19BCS2605_Krishna_Kumar_Computer_Graphics_Exp_3.2.pdf
19BCS2605_Krishna_Kumar_Computer_Graphics_Exp_3.2.pdf19BCS2605_Krishna_Kumar_Computer_Graphics_Exp_3.2.pdf
19BCS2605_Krishna_Kumar_Computer_Graphics_Exp_3.2.pdfKrishnaKumar2309
 
Powerpoint loop examples a
Powerpoint loop examples aPowerpoint loop examples a
Powerpoint loop examples ajaypeebala
 
The Ring programming language version 1.5.4 book - Part 56 of 185
The Ring programming language version 1.5.4 book - Part 56 of 185The Ring programming language version 1.5.4 book - Part 56 of 185
The Ring programming language version 1.5.4 book - Part 56 of 185Mahmoud Samir Fayed
 

Similar to FLTK Summer Course - Part VI - Sixth Impact - Exercises (20)

Advanced pointer
Advanced pointerAdvanced pointer
Advanced pointer
 
MVI - Managing State The Kotlin Way
MVI - Managing State The Kotlin WayMVI - Managing State The Kotlin Way
MVI - Managing State The Kotlin Way
 
The Ring programming language version 1.10 book - Part 68 of 212
The Ring programming language version 1.10 book - Part 68 of 212The Ring programming language version 1.10 book - Part 68 of 212
The Ring programming language version 1.10 book - Part 68 of 212
 
The Ring programming language version 1.10 book - Part 16 of 212
The Ring programming language version 1.10 book - Part 16 of 212The Ring programming language version 1.10 book - Part 16 of 212
The Ring programming language version 1.10 book - Part 16 of 212
 
Penjualan swalayan
Penjualan swalayanPenjualan swalayan
Penjualan swalayan
 
The Ring programming language version 1.5.3 book - Part 66 of 184
The Ring programming language version 1.5.3 book - Part 66 of 184The Ring programming language version 1.5.3 book - Part 66 of 184
The Ring programming language version 1.5.3 book - Part 66 of 184
 
Pro.docx
Pro.docxPro.docx
Pro.docx
 
The Ring programming language version 1.5.4 book - Part 57 of 185
The Ring programming language version 1.5.4 book - Part 57 of 185The Ring programming language version 1.5.4 book - Part 57 of 185
The Ring programming language version 1.5.4 book - Part 57 of 185
 
Lecture#5 Operators in C++
Lecture#5 Operators in C++Lecture#5 Operators in C++
Lecture#5 Operators in C++
 
Please respond only if you can answer the whole question ~~~~~.pdf
Please respond only if you can answer the whole question ~~~~~.pdfPlease respond only if you can answer the whole question ~~~~~.pdf
Please respond only if you can answer the whole question ~~~~~.pdf
 
I hope the below code is helpful to you, please give me rewards.im.pdf
I hope the below code is helpful to you, please give me rewards.im.pdfI hope the below code is helpful to you, please give me rewards.im.pdf
I hope the below code is helpful to you, please give me rewards.im.pdf
 
The Ring programming language version 1.9 book - Part 66 of 210
The Ring programming language version 1.9 book - Part 66 of 210The Ring programming language version 1.9 book - Part 66 of 210
The Ring programming language version 1.9 book - Part 66 of 210
 
Yahoo presentation: JavaScript Events
Yahoo presentation: JavaScript EventsYahoo presentation: JavaScript Events
Yahoo presentation: JavaScript Events
 
Does testability imply good design - Andrzej Jóźwiak - TomTom Dev Day 2022
Does testability imply good design - Andrzej Jóźwiak - TomTom Dev Day 2022Does testability imply good design - Andrzej Jóźwiak - TomTom Dev Day 2022
Does testability imply good design - Andrzej Jóźwiak - TomTom Dev Day 2022
 
Matteo Antony Mistretta - Refactoring into React hooks - Codemotion Rome 2019
Matteo Antony Mistretta - Refactoring into React hooks - Codemotion Rome 2019Matteo Antony Mistretta - Refactoring into React hooks - Codemotion Rome 2019
Matteo Antony Mistretta - Refactoring into React hooks - Codemotion Rome 2019
 
551 pd fsam_fayed_ring_doc_1.5.2
551 pd fsam_fayed_ring_doc_1.5.2551 pd fsam_fayed_ring_doc_1.5.2
551 pd fsam_fayed_ring_doc_1.5.2
 
Ch4
Ch4Ch4
Ch4
 
19BCS2605_Krishna_Kumar_Computer_Graphics_Exp_3.2.pdf
19BCS2605_Krishna_Kumar_Computer_Graphics_Exp_3.2.pdf19BCS2605_Krishna_Kumar_Computer_Graphics_Exp_3.2.pdf
19BCS2605_Krishna_Kumar_Computer_Graphics_Exp_3.2.pdf
 
Powerpoint loop examples a
Powerpoint loop examples aPowerpoint loop examples a
Powerpoint loop examples a
 
The Ring programming language version 1.5.4 book - Part 56 of 185
The Ring programming language version 1.5.4 book - Part 56 of 185The Ring programming language version 1.5.4 book - Part 56 of 185
The Ring programming language version 1.5.4 book - Part 56 of 185
 

More from Michel Alves

Texture Synthesis: An Approach Based on GPU Use
Texture Synthesis: An Approach Based on GPU UseTexture Synthesis: An Approach Based on GPU Use
Texture Synthesis: An Approach Based on GPU UseMichel Alves
 
Intelligent Transfer of Thematic Harmonic Color Palettes
Intelligent Transfer of Thematic Harmonic Color PalettesIntelligent Transfer of Thematic Harmonic Color Palettes
Intelligent Transfer of Thematic Harmonic Color PalettesMichel Alves
 
A Framework for Harmonic Color Measures
A Framework for Harmonic Color MeasuresA Framework for Harmonic Color Measures
A Framework for Harmonic Color MeasuresMichel Alves
 
Effectiveness of Image Quality Assessment Indexes
Effectiveness of Image Quality Assessment IndexesEffectiveness of Image Quality Assessment Indexes
Effectiveness of Image Quality Assessment IndexesMichel Alves
 
Introduction to Kernel Functions
Introduction to Kernel FunctionsIntroduction to Kernel Functions
Introduction to Kernel FunctionsMichel Alves
 
About Perception and Hue Histograms in HSV Space
About Perception and Hue Histograms in HSV SpaceAbout Perception and Hue Histograms in HSV Space
About Perception and Hue Histograms in HSV SpaceMichel Alves
 
Color Harmonization - Results
Color Harmonization - ResultsColor Harmonization - Results
Color Harmonization - ResultsMichel Alves
 
Wave Simulation Using Perlin Noise
Wave Simulation Using Perlin NoiseWave Simulation Using Perlin Noise
Wave Simulation Using Perlin NoiseMichel Alves
 
Similarity Maps Using SSIM Index
Similarity Maps Using SSIM IndexSimilarity Maps Using SSIM Index
Similarity Maps Using SSIM IndexMichel Alves
 
Qualifying Exam - Image-Based Reconstruction With Color Harmonization
Qualifying Exam - Image-Based Reconstruction With Color HarmonizationQualifying Exam - Image-Based Reconstruction With Color Harmonization
Qualifying Exam - Image-Based Reconstruction With Color HarmonizationMichel Alves
 
Month Presentations Schedule - March/2015 - LCG/UFRJ
Month Presentations Schedule - March/2015 - LCG/UFRJMonth Presentations Schedule - March/2015 - LCG/UFRJ
Month Presentations Schedule - March/2015 - LCG/UFRJMichel Alves
 
Color Palettes in R
Color Palettes in RColor Palettes in R
Color Palettes in RMichel Alves
 
Hue Wheel Prototype
Hue Wheel PrototypeHue Wheel Prototype
Hue Wheel PrototypeMichel Alves
 
Triangle Mesh Plot
Triangle Mesh PlotTriangle Mesh Plot
Triangle Mesh PlotMichel Alves
 
Capacity-Constrained Point Distributions :: Video Slides
Capacity-Constrained Point Distributions :: Video SlidesCapacity-Constrained Point Distributions :: Video Slides
Capacity-Constrained Point Distributions :: Video SlidesMichel Alves
 
Capacity-Constrained Point Distributions :: Density Function Catalog
Capacity-Constrained Point Distributions :: Density Function CatalogCapacity-Constrained Point Distributions :: Density Function Catalog
Capacity-Constrained Point Distributions :: Density Function CatalogMichel Alves
 
Capacity-Constrained Point Distributions :: Complementary Results
Capacity-Constrained Point Distributions :: Complementary ResultsCapacity-Constrained Point Distributions :: Complementary Results
Capacity-Constrained Point Distributions :: Complementary ResultsMichel Alves
 

More from Michel Alves (20)

Texture Synthesis: An Approach Based on GPU Use
Texture Synthesis: An Approach Based on GPU UseTexture Synthesis: An Approach Based on GPU Use
Texture Synthesis: An Approach Based on GPU Use
 
Intelligent Transfer of Thematic Harmonic Color Palettes
Intelligent Transfer of Thematic Harmonic Color PalettesIntelligent Transfer of Thematic Harmonic Color Palettes
Intelligent Transfer of Thematic Harmonic Color Palettes
 
A Framework for Harmonic Color Measures
A Framework for Harmonic Color MeasuresA Framework for Harmonic Color Measures
A Framework for Harmonic Color Measures
 
Effectiveness of Image Quality Assessment Indexes
Effectiveness of Image Quality Assessment IndexesEffectiveness of Image Quality Assessment Indexes
Effectiveness of Image Quality Assessment Indexes
 
Introduction to Kernel Functions
Introduction to Kernel FunctionsIntroduction to Kernel Functions
Introduction to Kernel Functions
 
About Perception and Hue Histograms in HSV Space
About Perception and Hue Histograms in HSV SpaceAbout Perception and Hue Histograms in HSV Space
About Perception and Hue Histograms in HSV Space
 
Color Harmonization - Results
Color Harmonization - ResultsColor Harmonization - Results
Color Harmonization - Results
 
Wave Simulation Using Perlin Noise
Wave Simulation Using Perlin NoiseWave Simulation Using Perlin Noise
Wave Simulation Using Perlin Noise
 
Similarity Maps Using SSIM Index
Similarity Maps Using SSIM IndexSimilarity Maps Using SSIM Index
Similarity Maps Using SSIM Index
 
Qualifying Exam - Image-Based Reconstruction With Color Harmonization
Qualifying Exam - Image-Based Reconstruction With Color HarmonizationQualifying Exam - Image-Based Reconstruction With Color Harmonization
Qualifying Exam - Image-Based Reconstruction With Color Harmonization
 
Month Presentations Schedule - March/2015 - LCG/UFRJ
Month Presentations Schedule - March/2015 - LCG/UFRJMonth Presentations Schedule - March/2015 - LCG/UFRJ
Month Presentations Schedule - March/2015 - LCG/UFRJ
 
Color Palettes in R
Color Palettes in RColor Palettes in R
Color Palettes in R
 
Sigmoid Curve Erf
Sigmoid Curve ErfSigmoid Curve Erf
Sigmoid Curve Erf
 
Hue Wheel Prototype
Hue Wheel PrototypeHue Wheel Prototype
Hue Wheel Prototype
 
Cosine Curve
Cosine CurveCosine Curve
Cosine Curve
 
Triangle Mesh Plot
Triangle Mesh PlotTriangle Mesh Plot
Triangle Mesh Plot
 
Triangle Plot
Triangle PlotTriangle Plot
Triangle Plot
 
Capacity-Constrained Point Distributions :: Video Slides
Capacity-Constrained Point Distributions :: Video SlidesCapacity-Constrained Point Distributions :: Video Slides
Capacity-Constrained Point Distributions :: Video Slides
 
Capacity-Constrained Point Distributions :: Density Function Catalog
Capacity-Constrained Point Distributions :: Density Function CatalogCapacity-Constrained Point Distributions :: Density Function Catalog
Capacity-Constrained Point Distributions :: Density Function Catalog
 
Capacity-Constrained Point Distributions :: Complementary Results
Capacity-Constrained Point Distributions :: Complementary ResultsCapacity-Constrained Point Distributions :: Complementary Results
Capacity-Constrained Point Distributions :: Complementary Results
 

Recently uploaded

Patient Counselling. Definition of patient counseling; steps involved in pati...
Patient Counselling. Definition of patient counseling; steps involved in pati...Patient Counselling. Definition of patient counseling; steps involved in pati...
Patient Counselling. Definition of patient counseling; steps involved in pati...raviapr7
 
CapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapitolTechU
 
HED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfHED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfMohonDas
 
Diploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfDiploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfMohonDas
 
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdfMaximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdfTechSoup
 
The basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxThe basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxheathfieldcps1
 
General views of Histopathology and step
General views of Histopathology and stepGeneral views of Histopathology and step
General views of Histopathology and stepobaje godwin sunday
 
Easter in the USA presentation by Chloe.
Easter in the USA presentation by Chloe.Easter in the USA presentation by Chloe.
Easter in the USA presentation by Chloe.EnglishCEIPdeSigeiro
 
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptxSandy Millin
 
How to Use api.constrains ( ) in Odoo 17
How to Use api.constrains ( ) in Odoo 17How to Use api.constrains ( ) in Odoo 17
How to Use api.constrains ( ) in Odoo 17Celine George
 
What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?TechSoup
 
Practical Research 1 Lesson 9 Scope and delimitation.pptx
Practical Research 1 Lesson 9 Scope and delimitation.pptxPractical Research 1 Lesson 9 Scope and delimitation.pptx
Practical Research 1 Lesson 9 Scope and delimitation.pptxKatherine Villaluna
 
How to Make a Field read-only in Odoo 17
How to Make a Field read-only in Odoo 17How to Make a Field read-only in Odoo 17
How to Make a Field read-only in Odoo 17Celine George
 
Presentation on the Basics of Writing. Writing a Paragraph
Presentation on the Basics of Writing. Writing a ParagraphPresentation on the Basics of Writing. Writing a Paragraph
Presentation on the Basics of Writing. Writing a ParagraphNetziValdelomar1
 
How to Show Error_Warning Messages in Odoo 17
How to Show Error_Warning Messages in Odoo 17How to Show Error_Warning Messages in Odoo 17
How to Show Error_Warning Messages in Odoo 17Celine George
 
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptxPISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptxEduSkills OECD
 
3.21.24 The Origins of Black Power.pptx
3.21.24  The Origins of Black Power.pptx3.21.24  The Origins of Black Power.pptx
3.21.24 The Origins of Black Power.pptxmary850239
 
How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17Celine George
 
CAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxCAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxSaurabhParmar42
 

Recently uploaded (20)

Patient Counselling. Definition of patient counseling; steps involved in pati...
Patient Counselling. Definition of patient counseling; steps involved in pati...Patient Counselling. Definition of patient counseling; steps involved in pati...
Patient Counselling. Definition of patient counseling; steps involved in pati...
 
CapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptx
 
HED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfHED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdf
 
Diploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfDiploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdf
 
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdfMaximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
 
The basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxThe basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptx
 
General views of Histopathology and step
General views of Histopathology and stepGeneral views of Histopathology and step
General views of Histopathology and step
 
Easter in the USA presentation by Chloe.
Easter in the USA presentation by Chloe.Easter in the USA presentation by Chloe.
Easter in the USA presentation by Chloe.
 
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
 
How to Use api.constrains ( ) in Odoo 17
How to Use api.constrains ( ) in Odoo 17How to Use api.constrains ( ) in Odoo 17
How to Use api.constrains ( ) in Odoo 17
 
Prelims of Kant get Marx 2.0: a general politics quiz
Prelims of Kant get Marx 2.0: a general politics quizPrelims of Kant get Marx 2.0: a general politics quiz
Prelims of Kant get Marx 2.0: a general politics quiz
 
What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?
 
Practical Research 1 Lesson 9 Scope and delimitation.pptx
Practical Research 1 Lesson 9 Scope and delimitation.pptxPractical Research 1 Lesson 9 Scope and delimitation.pptx
Practical Research 1 Lesson 9 Scope and delimitation.pptx
 
How to Make a Field read-only in Odoo 17
How to Make a Field read-only in Odoo 17How to Make a Field read-only in Odoo 17
How to Make a Field read-only in Odoo 17
 
Presentation on the Basics of Writing. Writing a Paragraph
Presentation on the Basics of Writing. Writing a ParagraphPresentation on the Basics of Writing. Writing a Paragraph
Presentation on the Basics of Writing. Writing a Paragraph
 
How to Show Error_Warning Messages in Odoo 17
How to Show Error_Warning Messages in Odoo 17How to Show Error_Warning Messages in Odoo 17
How to Show Error_Warning Messages in Odoo 17
 
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptxPISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
 
3.21.24 The Origins of Black Power.pptx
3.21.24  The Origins of Black Power.pptx3.21.24  The Origins of Black Power.pptx
3.21.24 The Origins of Black Power.pptx
 
How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17
 
CAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxCAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptx
 

FLTK Summer Course - Part VI - Sixth Impact - Exercises

  • 1. 1 #include <iostream> 2 #include <FL/Fl.H> 3 #include <FL/Fl_Window.H> 4 #include <FL/Fl_Button.H> 5 6 /*Declaração de namespace para uso das funções de iostream*/ 7 using namespace std; 8 9 /** 10 * Classe para verificação de eventos em um botão ... 11 **/ 12 class MyButton : public Fl_Button 13 { 14 /*Variável estática para contagem de eventos*/ 15 static int count; 16 17 public: 18 19 /*Construtor*/ 20 MyButton(int x,int y,int w,int h,const char*l=0):Fl_Button(x,y,w,h,l){}; 21 22 /*Sobreposição do método manipulador de eventos*/ 23 int handle(int event) 24 { 25 int retorno = Fl_Button::handle(event); 26 cout << endl << count++ << " ******** button " << this->label() << " receives "; 27 28 switch(event) 29 { 30 case FL_PUSH: 31 cout << "push" << " event and returns:" << retorno << endl; 32 break; 33 34 case FL_RELEASE: 35 cout << "release" << " event and returns:" << retorno << endl; 36 break; 37 38 case FL_ENTER: 39 color(FL_CYAN); 40 cout << "enter" << " event and returns:" << retorno << endl; 41 redraw(); 42 break; 43 44 case FL_LEAVE: 45 color(FL_BACKGROUND_COLOR); 46 cout << "leave" << " event and returns:" << retorno << endl; 47 redraw(); 48 break; 49 50 case FL_DRAG: 51 cout << "drag" << " event and returns:" << retorno << endl; 52 break; 53 54 case FL_FOCUS: 55 cout << "focus" << " event and returns:" << retorno << endl; 56 break; 57 58 case FL_UNFOCUS: 59 cout << "unfocus" << " event and returns:" << retorno << endl; 60 break; 61 62 case FL_KEYDOWN: 63 cout << "keydown" << " event and returns:" << retorno << endl; 64 break; 65 66 case FL_KEYUP: 67 if ( Fl::event_key() == shortcut() ) 68 { 69 box(FL_UP_BOX); 70 redraw(); 71 retorno = 1; //return handled so keyup event stops 72 } //being sent to ALL other buttons unecessarily
  • 2. 73 74 cout << "keyup" << " event and returns:" << retorno << endl; 75 break; 76 77 case FL_CLOSE: 78 cout << "close" << " event and returns:" << retorno << endl; 79 break; 80 81 case FL_MOVE: 82 cout << "move" << " event and returns:" << retorno << endl; 83 break; 84 85 case FL_SHORTCUT: 86 if ( Fl::event_key() == shortcut() ) 87 { 88 box(FL_DOWN_BOX); 89 redraw(); 90 } 91 cout << "shortcut" << " event and returns:" << retorno << endl; 92 break; 93 94 case FL_DEACTIVATE: 95 cout << "deactivate" << " event and returns:" << retorno << endl; 96 break; 97 98 case FL_ACTIVATE: 99 cout << "activate" << " event and returns:" << retorno << endl; 100 break; 101 102 case FL_HIDE: 103 cout << "hide" << " event and returns:" << retorno << endl; 104 break; 105 106 case FL_SHOW: 107 cout << "show" << " event and returns:" << retorno << endl; 108 break; 109 110 case FL_PASTE: 111 cout << "paste" << " event and returns:" << retorno << endl; 112 break; 113 114 case FL_SELECTIONCLEAR: 115 cout << "selectionclear" << " event and returns:" << retorno << endl; 116 break; 117 118 case FL_MOUSEWHEEL: 119 cout << "mousewheel" << " event and returns:" << retorno << endl; 120 break; 121 122 case FL_NO_EVENT: 123 cout << "no event" << " and returns:" << retorno << endl; 124 break; 125 } 126 127 /*Retorno do método ...*/ 128 return(retorno); 129 } 130 }; 131 132 /** 133 * Atribuição inicial da variável estática ... 134 */ 135 int MyButton::count=0; 136 137 /** 138 * Funções que respondem aos callbacks 139 */ 140 void but_a_cb(Fl_Widget* w, void* v) 141 { 142 cout << endl << "Button A callback!" << endl; 143 } 144
  • 3. 145 void but_b_cb(Fl_Widget* w, void* v) 146 { 147 cout << endl << "Button B callback!" << endl; 148 } 149 150 void but_c_cb(Fl_Widget* w, void* v) 151 { 152 cout << endl << "Button C callback!" << endl; 153 } 154 155 /** 156 * Função principal do programa. 157 */ 158 int main(int argc, char* argv[]) 159 { 160 Fl_Window win(120,150); 161 win.begin(); 162 MyButton but_a(10,10,100,25,"A"); 163 but_a.shortcut('a'); 164 but_a.callback(but_a_cb); 165 MyButton but_b(10,50,100,25,"B"); 166 but_b.shortcut('b'); 167 but_b.callback(but_b_cb); 168 MyButton but_c(10,90,100,25,"C"); 169 but_c.shortcut('c'); 170 but_c.callback(but_c_cb); 171 win.end(); 172 win.show(); 173 return(Fl::run()); 174 } 175