1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
#ifndef UPEM_MORPHING_WINDOW
#define UPEM_MORPHING_WINDOW
/**
* File: window.h
* Windows and components handling.
*
* Author:
* Adam NAILI
*/
#include <MLV/MLV_keyboard.h>
#include "gui/group.h"
#include "gui/button.h"
#include "gui/pictureframe.h"
/**
* Struct: Window
* Supports and handles components.
*
* Fields:
* width - width of the window
* height - height of the window
* *title - string printed as name for the window
* *group_buttons - group that handles the buttons added to the window
* *group_pictureframe - group that handles the picture frames added to the window
*/
typedef struct {
int width, height;
char *title;
Group *group_buttons;
Group *group_pictureframe;
} Window;
/**
* Function: window_create
* Allocates and initializes a window.
*
* Parameters:
* width - width of the window to initialize
* height - height of the window to initialize
* *title - title of the actual window
* Returns:
* A pointer to a Window
*/
Window *window_create(int width, int height, char *title);
/**
* Function: window_destroy
* Frees the resources supported by the window and the window itself.
*
* Parameters:
* *window - pointer to the input window
*/
void window_destroy(Window *window);
/**
* Function: window_add_button
* Adds Button component to the group of buttons of the current window.
*
* Parameters:
* *window - pointer to the input window
* *button - pointer to the input button
*/
void window_add_button(Window *window, Button *button);
/**
* Function: window_add_pictureframe
* Adds PictureFrame component to the group of picture frames of the current window.
*
* Parameters:
* *window - pointer to the input window
* *pictureFrame - pointer to the input picture frame
*/
void window_add_pictureframe(Window *window, PictureFrame *pictureFrame);
/**
* Function: window_print_buttons
* Prints all the buttons to the screen
*
* Parameters:
* *window - pointer to the input window
*/
void window_print_buttons(Window *window);
/**
* Function: window_print_pictureframes
* Prints all the picture frames to the screen
*
* Parameters:
* *window - pointer to the input window
*/
void window_print_pictureframes(Window *window);
/**
* Function: window_click_keyboard_handler
* Handles click and keyboard.
*
* Parameters:
* *window - pointer to the current window
* *keyboardButton - code of the keyboard key that is pushed or released
* *keyboardModifier - mode of the keyboard when a key is push or released
* *unicode - character coded in unicode of the letter obtained by combining the code and the mode
* *mouse_x - coordinate on the X axis of the mouse
* *mouse_y - coordinate on the Y axis of the mouse
*/
void window_click_keyboard_handler(Window *window, MLV_Keyboard_button *keyboardButton,
MLV_Keyboard_modifier *keyboardModifier,
int *unicode, int *mouse_x, int *mouse_y);
/**
* Function: window_rendering
* Launches the rendering on the pictureframe origin.
*
* Parameters:
* *window - pointer to the current window
* *pictureFrame1 - pointer to the origin PictureFrame
* *canvasSrc - pointer to the source Canvas
* *canvasTarget - pointer to the target Canvas
* *morphing - pointer to the Morphing that will makes the transformation
*/
void window_rendering(Window *window, PictureFrame pictureFrame1, Canvas *canvasSrc, Canvas *canvasTarget,
Morphing *morphing);
#endif
|