libwtk-sdl2
0.0.1
include
widget_context.hpp
1
#ifndef LIBWTK_SDL2_WIDGET_CONTEXT_HPP
2
#define LIBWTK_SDL2_WIDGET_CONTEXT_HPP
3
4
#include <optional>
5
#include <string>
6
7
#include <SDL2/SDL_events.h>
8
#include <SDL2/SDL_rect.h>
9
#include <SDL2/SDL_video.h>
10
11
#include "context_info.hpp"
12
#include "draw_context.hpp"
13
#include "font.hpp"
14
#include "font_word_cache.hpp"
15
#include "font_manager.hpp"
16
#include "mouse_tracker.hpp"
17
#include "selection_context.hpp"
18
19
struct
widget
;
20
21
struct
widget_context
22
{
23
24
widget_context
(SDL_Renderer * renderer, std::vector<font> fonts,
widget
& main_widget);
25
widget_context
(SDL_Renderer * renderer, std::vector<font> fonts,
widget
& main_widget, SDL_Rect
box
);
26
27
void
process_event(SDL_Event
const
& ev);
28
29
void
draw(
bool
present =
true
);
30
void
draw_dirty(
int
dirty_redraws = 1);
31
32
void
select_widget(
widget
& w);
33
void
unselect_widget();
34
bool
is_selected_widget(
widget
const
& w);
35
36
void
change_widget_area(SDL_Rect new_box);
37
38
// forwarded
39
void
activate();
40
void
navigate_selection(navigation_type nt);
41
42
private
:
43
44
void
set_context_info(
widget
*);
45
46
SDL_Rect _box;
47
SDL_Renderer * _renderer;
48
font_manager
_fm;
49
draw_context
_dc;
50
selection_context
_sc;
51
mouse_tracker
_mt;
52
widget
& _main_widget;
53
context_info
_context_info;
54
std::optional<vec> _mouse_down_position;
55
};
56
57
#endif
58
mouse_tracker
Definition:
mouse_tracker.hpp:10
context_info
Definition:
context_info.hpp:7
draw_context
Definition:
draw_context.hpp:126
widget_context
Definition:
widget_context.hpp:21
font_manager
Definition:
font_manager.hpp:13
selection_context
Definition:
selection_context.hpp:18
widget
Definition:
widget.hpp:52
box
Definition:
box.hpp:11
Generated by
1.8.14