reflexion 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.doc/ext/reflex/application.cpp +54 -39
- data/.doc/ext/reflex/capture_event.cpp +87 -0
- data/.doc/ext/reflex/draw_event.cpp +103 -0
- data/.doc/ext/reflex/event.cpp +73 -0
- data/.doc/ext/reflex/focus_event.cpp +98 -0
- data/.doc/ext/reflex/frame_event.cpp +133 -0
- data/.doc/ext/reflex/image_view.cpp +74 -0
- data/.doc/ext/reflex/key_event.cpp +124 -0
- data/.doc/ext/reflex/native.cpp +45 -6
- data/.doc/ext/reflex/pointer_event.cpp +181 -0
- data/.doc/ext/reflex/reflex.cpp +17 -41
- data/.doc/ext/reflex/scroll_event.cpp +141 -0
- data/.doc/ext/reflex/selector.cpp +135 -0
- data/.doc/ext/reflex/style.cpp +253 -0
- data/.doc/ext/reflex/style_length.cpp +133 -0
- data/.doc/ext/reflex/style_length2.cpp +149 -0
- data/.doc/ext/reflex/style_length4.cpp +192 -0
- data/.doc/ext/reflex/update_event.cpp +77 -0
- data/.doc/ext/reflex/view.cpp +408 -88
- data/.doc/ext/reflex/wheel_event.cpp +146 -0
- data/.doc/ext/reflex/window.cpp +95 -92
- data/Rakefile +6 -5
- data/VERSION +1 -1
- data/ext/reflex/application.cpp +67 -49
- data/ext/reflex/capture_event.cpp +92 -0
- data/ext/reflex/draw_event.cpp +110 -0
- data/ext/reflex/event.cpp +77 -0
- data/ext/reflex/extconf.rb +18 -68
- data/ext/reflex/focus_event.cpp +104 -0
- data/ext/reflex/frame_event.cpp +143 -0
- data/ext/reflex/image_view.cpp +77 -0
- data/ext/reflex/key_event.cpp +133 -0
- data/ext/reflex/native.cpp +45 -6
- data/ext/reflex/pointer_event.cpp +195 -0
- data/ext/reflex/reflex.cpp +21 -47
- data/ext/reflex/scroll_event.cpp +152 -0
- data/ext/reflex/selector.cpp +144 -0
- data/ext/reflex/style.cpp +277 -0
- data/ext/reflex/style_length.cpp +140 -0
- data/ext/reflex/style_length2.cpp +157 -0
- data/ext/reflex/style_length4.cpp +204 -0
- data/ext/reflex/update_event.cpp +81 -0
- data/ext/reflex/view.cpp +469 -114
- data/ext/reflex/wheel_event.cpp +158 -0
- data/ext/reflex/window.cpp +130 -123
- data/include/reflex/application.h +12 -7
- data/include/reflex/defs.h +13 -89
- data/include/reflex/event.h +260 -0
- data/include/reflex/exception.h +17 -11
- data/include/reflex/image_view.h +45 -0
- data/include/reflex/reflex.h +2 -6
- data/include/reflex/ruby/application.h +40 -13
- data/include/reflex/ruby/event.h +72 -0
- data/include/reflex/ruby/image_view.h +25 -0
- data/include/reflex/ruby/selector.h +27 -0
- data/include/reflex/ruby/style.h +27 -0
- data/include/reflex/ruby/style_length.h +37 -0
- data/include/reflex/ruby/view.h +193 -38
- data/include/reflex/ruby/window.h +123 -39
- data/include/reflex/ruby.h +3 -2
- data/include/reflex/selector.h +64 -0
- data/include/reflex/style.h +144 -0
- data/include/reflex/style_length.h +147 -0
- data/include/reflex/view.h +182 -19
- data/include/reflex/window.h +35 -19
- data/include/reflex.h +7 -0
- data/lib/reflex/application.rb +14 -5
- data/lib/reflex/arc_shape.rb +20 -0
- data/lib/reflex/button.rb +75 -0
- data/lib/reflex/capture_event.rb +37 -0
- data/lib/reflex/color.rb +13 -0
- data/lib/reflex/color_space.rb +13 -0
- data/lib/reflex/draw_event.rb +19 -0
- data/lib/reflex/ellipse_shape.rb +20 -0
- data/lib/reflex/ext.rb +1 -1
- data/lib/reflex/flags.rb +18 -0
- data/lib/reflex/focus_event.rb +38 -0
- data/lib/reflex/font.rb +13 -0
- data/lib/reflex/frame_event.rb +42 -0
- data/lib/reflex/helper.rb +87 -30
- data/lib/reflex/image_view.rb +25 -0
- data/lib/reflex/key_event.rb +38 -0
- data/lib/reflex/line_shape.rb +20 -0
- data/lib/reflex/list_view.rb +15 -0
- data/lib/reflex/model.rb +149 -0
- data/lib/reflex/model_owner.rb +57 -0
- data/lib/reflex/model_view.rb +22 -0
- data/lib/reflex/module.rb +11 -7
- data/lib/reflex/pointer_event.rb +85 -0
- data/lib/reflex/rect_shape.rb +20 -0
- data/lib/reflex/reflex.rb +13 -2
- data/lib/reflex/scroll_event.rb +19 -0
- data/lib/reflex/selector.rb +31 -0
- data/lib/reflex/shader.rb +13 -0
- data/lib/reflex/shape.rb +34 -0
- data/lib/reflex/style.rb +55 -0
- data/lib/reflex/style_length.rb +30 -0
- data/lib/reflex/style_length2.rb +34 -0
- data/lib/reflex/style_length4.rb +38 -0
- data/lib/reflex/text_view.rb +55 -0
- data/lib/reflex/update_event.rb +19 -0
- data/lib/reflex/view.rb +38 -4
- data/lib/reflex/wheel_event.rb +19 -0
- data/lib/reflex/window.rb +7 -5
- data/lib/reflex.rb +38 -1
- data/lib/reflexion/include.rb +5 -0
- data/lib/reflexion.rb +100 -0
- data/reflex.gemspec +3 -4
- data/samples/app.rb +13 -0
- data/samples/bats.rb +91 -0
- data/samples/checker.rb +36 -0
- data/{examples/ruby/shapes.rb → samples/fans.rb} +12 -16
- data/samples/fps.rb +46 -0
- data/samples/grid.rb +60 -0
- data/{examples/ruby → samples}/hello.rb +14 -16
- data/samples/image.rb +44 -0
- data/samples/ios/hello/hello/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- data/samples/ios/hello/hello/Images.xcassets/LaunchImage.launchimage/Contents.json +51 -0
- data/samples/ios/hello/hello/en.lproj/InfoPlist.strings +2 -0
- data/samples/ios/hello/hello/hello-Info.plist +47 -0
- data/samples/ios/hello/hello/hello-Prefix.pch +10 -0
- data/samples/ios/hello/hello/main.cpp +79 -0
- data/samples/ios/hello/hello.xcodeproj/project.pbxproj +725 -0
- data/{examples/ruby → samples}/key.rb +11 -14
- data/samples/layout.rb +89 -0
- data/samples/model.rb +86 -0
- data/samples/osx/hello/hello/Images.xcassets/AppIcon.appiconset/Contents.json +58 -0
- data/samples/osx/hello/hello/en.lproj/Credits.rtf +29 -0
- data/samples/osx/hello/hello/en.lproj/InfoPlist.strings +2 -0
- data/samples/osx/hello/hello/hello-Info.plist +32 -0
- data/samples/osx/hello/hello/hello-Prefix.pch +3 -0
- data/samples/osx/hello/hello/main.cpp +79 -0
- data/samples/osx/hello/hello.xcodeproj/project.pbxproj +725 -0
- data/samples/reflexion/hello.rb +24 -0
- data/samples/reflexion/paint.rb +40 -0
- data/samples/reflexion/pulse.rb +34 -0
- data/samples/repl.rb +69 -0
- data/samples/shader.rb +41 -0
- data/samples/shapes.rb +30 -0
- data/{examples/ruby → samples}/text.rb +7 -8
- data/samples/tree.rb +71 -0
- data/samples/views.rb +41 -0
- data/samples/visuals.rb +22 -0
- data/src/event.cpp +225 -0
- data/src/exception.cpp +24 -15
- data/src/image_view.cpp +70 -0
- data/src/ios/app_delegate.h +17 -0
- data/src/ios/app_delegate.mm +120 -0
- data/src/ios/application.mm +116 -0
- data/src/{cocoa/applicationdata.h → ios/application_data.h} +6 -6
- data/src/ios/event.h +26 -0
- data/src/ios/event.mm +31 -0
- data/src/ios/native_window.h +37 -0
- data/src/ios/native_window.mm +220 -0
- data/src/ios/opengl_view.h +13 -0
- data/src/ios/opengl_view.mm +131 -0
- data/src/{cocoa → ios}/reflex.mm +8 -12
- data/src/ios/window.mm +303 -0
- data/src/ios/window_data.h +75 -0
- data/src/osx/app_delegate.h +17 -0
- data/src/{cocoa/cocoaapplication.mm → osx/app_delegate.mm} +90 -48
- data/src/osx/application.mm +132 -0
- data/src/osx/application_data.h +45 -0
- data/src/osx/event.h +42 -0
- data/src/osx/event.mm +112 -0
- data/src/osx/native_window.h +26 -0
- data/src/osx/native_window.mm +322 -0
- data/src/{cocoa/openglview.h → osx/opengl_view.h} +0 -4
- data/src/{cocoa/openglview.mm → osx/opengl_view.mm} +66 -23
- data/src/osx/reflex.mm +50 -0
- data/src/osx/window.mm +308 -0
- data/src/osx/window_data.h +75 -0
- data/src/selector.cpp +121 -0
- data/src/style.cpp +576 -0
- data/src/style_length.cpp +341 -0
- data/src/view.cpp +1228 -129
- data/src/win32/application.cpp +1 -1
- data/src/window.cpp +54 -26
- data/test/helper.rb +8 -4
- data/test/test_capture_event.rb +41 -0
- data/test/test_event.rb +20 -0
- data/test/test_has_frame.rb +45 -0
- data/test/test_model.rb +9 -0
- data/test/test_model_owner.rb +9 -0
- data/test/test_selector.rb +75 -0
- data/test/test_style.rb +70 -0
- data/test/test_style_length.rb +38 -0
- data/test/test_style_length2.rb +50 -0
- data/test/test_style_length4.rb +56 -0
- data/test/test_view.rb +97 -23
- data/test/test_window.rb +54 -46
- metadata +205 -84
- data/.doc/ext/reflex/defs.cpp +0 -8
- data/.doc/ext/reflex/key.cpp +0 -122
- data/.doc/ext/reflex/points.cpp +0 -151
- data/.gitignore +0 -14
- data/ChangeLog +0 -8
- data/examples/hello/.gitignore +0 -2
- data/examples/hello/Rakefile +0 -41
- data/examples/hello/main.cpp +0 -18
- data/examples/ruby/app.rb +0 -13
- data/examples/ruby/checker.rb +0 -41
- data/examples/ruby/fps.rb +0 -49
- data/examples/ruby/grid.rb +0 -65
- data/examples/ruby/views.rb +0 -88
- data/examples/ruby/visuals.rb +0 -27
- data/ext/reflex/defs.cpp +0 -8
- data/ext/reflex/key.cpp +0 -129
- data/ext/reflex/points.cpp +0 -161
- data/include/reflex/ruby/key.h +0 -39
- data/include/reflex/ruby/points.h +0 -39
- data/lib/reflex/visuals/string.rb +0 -53
- data/src/cocoa/application.mm +0 -101
- data/src/cocoa/cocoaapplication.h +0 -21
- data/src/cocoa/cocoawindow.h +0 -46
- data/src/cocoa/cocoawindow.mm +0 -230
- data/src/cocoa/defs.h +0 -34
- data/src/cocoa/defs.mm +0 -87
- data/src/cocoa/window.mm +0 -148
- data/src/cocoa/windowdata.h +0 -56
- data/src/defs.cpp +0 -47
- data/src/helper.h +0 -12
- data/src/reflex.cpp +0 -43
- /data/{README → README.md} +0 -0
@@ -0,0 +1,144 @@
|
|
1
|
+
// -*- c++ -*-
|
2
|
+
#pragma once
|
3
|
+
#ifndef __REFLEX_STYLE_H__
|
4
|
+
#define __REFLEX_STYLE_H__
|
5
|
+
|
6
|
+
|
7
|
+
#include <xot/ref.h>
|
8
|
+
#include <rays/color.h>
|
9
|
+
#include <rays/image.h>
|
10
|
+
#include <reflex/defs.h>
|
11
|
+
#include <reflex/selector.h>
|
12
|
+
#include <reflex/style_length.h>
|
13
|
+
|
14
|
+
|
15
|
+
namespace Reflex
|
16
|
+
{
|
17
|
+
|
18
|
+
|
19
|
+
class Style
|
20
|
+
{
|
21
|
+
|
22
|
+
typedef Style This;
|
23
|
+
|
24
|
+
public:
|
25
|
+
|
26
|
+
enum Flow {FLOW_NONE = 0, FLOW_DOWN, FLOW_RIGHT, FLOW_UP, FLOW_LEFT, FLOW_LAST};
|
27
|
+
|
28
|
+
typedef Selector:: iterator tag_iterator;
|
29
|
+
|
30
|
+
typedef Selector::const_iterator const_tag_iterator;
|
31
|
+
|
32
|
+
Style (const char* name = NULL);
|
33
|
+
|
34
|
+
Style (const This& obj);
|
35
|
+
|
36
|
+
Style& operator = (const This& obj);
|
37
|
+
|
38
|
+
~Style ();
|
39
|
+
|
40
|
+
void set_name (const char* name);
|
41
|
+
|
42
|
+
const char* name () const;
|
43
|
+
|
44
|
+
void add_tag (const char* tag);
|
45
|
+
|
46
|
+
void remove_tag (const char* tag);
|
47
|
+
|
48
|
+
tag_iterator tag_begin ();
|
49
|
+
|
50
|
+
const_tag_iterator tag_begin () const;
|
51
|
+
|
52
|
+
tag_iterator tag_end ();
|
53
|
+
|
54
|
+
const_tag_iterator tag_end () const;
|
55
|
+
|
56
|
+
void set_selector (const Selector& selector);
|
57
|
+
|
58
|
+
Selector& selector ();
|
59
|
+
|
60
|
+
const Selector& selector () const;
|
61
|
+
|
62
|
+
void set_flow (Flow main, Flow sub = FLOW_NONE);
|
63
|
+
|
64
|
+
void get_flow (Flow* main, Flow* sub) const;
|
65
|
+
|
66
|
+
void set_size (const StyleLength2& size);
|
67
|
+
|
68
|
+
void set_width (const StyleLength& width);
|
69
|
+
|
70
|
+
void set_height (const StyleLength& height);
|
71
|
+
|
72
|
+
const StyleLength2& size () const;
|
73
|
+
|
74
|
+
void set_position (const StyleLength4& position);
|
75
|
+
|
76
|
+
void set_left (const StyleLength& left);
|
77
|
+
|
78
|
+
void set_top (const StyleLength& top);
|
79
|
+
|
80
|
+
void set_right (const StyleLength& right);
|
81
|
+
|
82
|
+
void set_bottom (const StyleLength& bottom);
|
83
|
+
|
84
|
+
const StyleLength4& position () const;
|
85
|
+
|
86
|
+
void set_offset (const StyleLength4& offset);
|
87
|
+
|
88
|
+
void set_offset_left (const StyleLength& left);
|
89
|
+
|
90
|
+
void set_offset_top (const StyleLength& top);
|
91
|
+
|
92
|
+
void set_offset_right (const StyleLength& right);
|
93
|
+
|
94
|
+
void set_offset_bottom (const StyleLength& bottom);
|
95
|
+
|
96
|
+
const StyleLength4& offset () const;
|
97
|
+
|
98
|
+
void set_margin (const StyleLength4& margin);
|
99
|
+
|
100
|
+
void set_margin_left (const StyleLength& left);
|
101
|
+
|
102
|
+
void set_margin_top (const StyleLength& top);
|
103
|
+
|
104
|
+
void set_margin_right (const StyleLength& right);
|
105
|
+
|
106
|
+
void set_margin_bottom (const StyleLength& bottom);
|
107
|
+
|
108
|
+
const StyleLength4& margin () const;
|
109
|
+
|
110
|
+
void set_padding (const StyleLength4& padding);
|
111
|
+
|
112
|
+
void set_padding_left (const StyleLength& left);
|
113
|
+
|
114
|
+
void set_padding_top (const StyleLength& top);
|
115
|
+
|
116
|
+
void set_padding_right (const StyleLength& right);
|
117
|
+
|
118
|
+
void set_padding_bottom (const StyleLength& bottom);
|
119
|
+
|
120
|
+
const StyleLength4& padding () const;
|
121
|
+
|
122
|
+
void set_background_color (const Color& value);
|
123
|
+
|
124
|
+
const Color& background_color () const;
|
125
|
+
|
126
|
+
void set_background_image (const Image& value);
|
127
|
+
|
128
|
+
const Image& background_image () const;
|
129
|
+
|
130
|
+
friend bool operator == (const This& lhs, const This& rhs);
|
131
|
+
|
132
|
+
friend bool operator != (const This& lhs, const This& rhs);
|
133
|
+
|
134
|
+
struct Data;
|
135
|
+
|
136
|
+
Xot::Ref<Data> ref;
|
137
|
+
|
138
|
+
};// Style
|
139
|
+
|
140
|
+
|
141
|
+
}// Reflex
|
142
|
+
|
143
|
+
|
144
|
+
#endif//EOH
|
@@ -0,0 +1,147 @@
|
|
1
|
+
// -*- c++ -*-
|
2
|
+
#pragma once
|
3
|
+
#ifndef __REFLEX_STYLE_LENGTH_H__
|
4
|
+
#define __REFLEX_STYLE_LENGTH_H__
|
5
|
+
|
6
|
+
|
7
|
+
#include <xot/pimpl.h>
|
8
|
+
#include <reflex/defs.h>
|
9
|
+
|
10
|
+
|
11
|
+
namespace Reflex
|
12
|
+
{
|
13
|
+
|
14
|
+
|
15
|
+
class StyleLength
|
16
|
+
{
|
17
|
+
|
18
|
+
public:
|
19
|
+
|
20
|
+
typedef coord Value;
|
21
|
+
|
22
|
+
enum Unit {NONE = 0, PIXEL, PERCENT, UNIT_LAST};
|
23
|
+
|
24
|
+
StyleLength ();
|
25
|
+
|
26
|
+
StyleLength (Value value, Unit unit = PIXEL);
|
27
|
+
|
28
|
+
explicit StyleLength (const char* str);
|
29
|
+
|
30
|
+
StyleLength copy () const;
|
31
|
+
|
32
|
+
void reset (Value value = 0, Unit unit = NONE);
|
33
|
+
|
34
|
+
void reset (const char* str);
|
35
|
+
|
36
|
+
Value value () const;
|
37
|
+
|
38
|
+
Unit unit () const;
|
39
|
+
|
40
|
+
bool get_pixel (coord* pixel, coord parent_size) const;
|
41
|
+
|
42
|
+
String to_s () const;
|
43
|
+
|
44
|
+
operator bool () const;
|
45
|
+
|
46
|
+
bool operator ! () const;
|
47
|
+
|
48
|
+
struct Data;
|
49
|
+
|
50
|
+
Xot::PImpl<Data, true> self;
|
51
|
+
|
52
|
+
};// StyleLength
|
53
|
+
|
54
|
+
|
55
|
+
class StyleLength2
|
56
|
+
{
|
57
|
+
|
58
|
+
public:
|
59
|
+
|
60
|
+
StyleLength2 ();
|
61
|
+
|
62
|
+
StyleLength2 (const StyleLength& all);
|
63
|
+
|
64
|
+
StyleLength2 (const StyleLength& width, const StyleLength& height);
|
65
|
+
|
66
|
+
StyleLength2 copy () const;
|
67
|
+
|
68
|
+
void set_width (const StyleLength& width);
|
69
|
+
|
70
|
+
const StyleLength& width () const;
|
71
|
+
|
72
|
+
void set_height (const StyleLength& height);
|
73
|
+
|
74
|
+
const StyleLength& height () const;
|
75
|
+
|
76
|
+
size_t size () const;
|
77
|
+
|
78
|
+
StyleLength& operator [] (size_t i);
|
79
|
+
|
80
|
+
const StyleLength& operator [] (size_t i) const;
|
81
|
+
|
82
|
+
struct Data;
|
83
|
+
|
84
|
+
Xot::PImpl<Data, true> self;
|
85
|
+
|
86
|
+
};// StyleLength2
|
87
|
+
|
88
|
+
|
89
|
+
class StyleLength4
|
90
|
+
{
|
91
|
+
|
92
|
+
public:
|
93
|
+
|
94
|
+
StyleLength4 ();
|
95
|
+
|
96
|
+
StyleLength4 (const StyleLength& all);
|
97
|
+
|
98
|
+
StyleLength4 (
|
99
|
+
const StyleLength& horizontal,
|
100
|
+
const StyleLength& vertical);
|
101
|
+
|
102
|
+
StyleLength4 (
|
103
|
+
const StyleLength& left,
|
104
|
+
const StyleLength& vertical,
|
105
|
+
const StyleLength& right);
|
106
|
+
|
107
|
+
StyleLength4 (
|
108
|
+
const StyleLength& left,
|
109
|
+
const StyleLength& top,
|
110
|
+
const StyleLength& right,
|
111
|
+
const StyleLength& bottom);
|
112
|
+
|
113
|
+
StyleLength4 copy () const;
|
114
|
+
|
115
|
+
void set_left (const StyleLength& left);
|
116
|
+
|
117
|
+
const StyleLength& left () const;
|
118
|
+
|
119
|
+
void set_top (const StyleLength& top);
|
120
|
+
|
121
|
+
const StyleLength& top () const;
|
122
|
+
|
123
|
+
void set_right (const StyleLength& right);
|
124
|
+
|
125
|
+
const StyleLength& right () const;
|
126
|
+
|
127
|
+
void set_bottom (const StyleLength& bottom);
|
128
|
+
|
129
|
+
const StyleLength& bottom () const;
|
130
|
+
|
131
|
+
size_t size () const;
|
132
|
+
|
133
|
+
StyleLength& operator [] (size_t i);
|
134
|
+
|
135
|
+
const StyleLength& operator [] (size_t i) const;
|
136
|
+
|
137
|
+
struct Data;
|
138
|
+
|
139
|
+
Xot::PImpl<Data, true> self;
|
140
|
+
|
141
|
+
};// StyleLength4
|
142
|
+
|
143
|
+
|
144
|
+
}// Reflex
|
145
|
+
|
146
|
+
|
147
|
+
#endif//EOH
|
data/include/reflex/view.h
CHANGED
@@ -7,7 +7,13 @@
|
|
7
7
|
#include <vector>
|
8
8
|
#include <xot/ref.h>
|
9
9
|
#include <xot/pimpl.h>
|
10
|
+
#include <rays/point.h>
|
10
11
|
#include <reflex/defs.h>
|
12
|
+
#include <reflex/style.h>
|
13
|
+
#include <reflex/event.h>
|
14
|
+
|
15
|
+
|
16
|
+
//#define REFLEX_VIEW_REF_DEBUG 1
|
11
17
|
|
12
18
|
|
13
19
|
namespace Rays
|
@@ -36,36 +42,135 @@ namespace Reflex
|
|
36
42
|
|
37
43
|
typedef Xot::Ref<This> Ref;
|
38
44
|
|
39
|
-
|
45
|
+
typedef std::vector<Ref> ChildList;
|
40
46
|
|
41
|
-
|
47
|
+
typedef std::vector<Style> StyleList;
|
42
48
|
|
43
|
-
|
49
|
+
typedef ChildList:: iterator child_iterator;
|
44
50
|
|
45
|
-
|
51
|
+
typedef ChildList::const_iterator const_child_iterator;
|
46
52
|
|
47
|
-
|
53
|
+
typedef StyleList:: iterator style_iterator;
|
48
54
|
|
49
|
-
|
55
|
+
typedef StyleList::const_iterator const_style_iterator;
|
50
56
|
|
51
|
-
|
52
|
-
const char* name, size_t index = 0, bool recursive = false);
|
57
|
+
typedef Selector:: iterator tag_iterator;
|
53
58
|
|
54
|
-
|
55
|
-
const char* name, size_t index = 0, bool recursive = false) const;
|
59
|
+
typedef Selector:: const_iterator const_tag_iterator;
|
56
60
|
|
57
|
-
|
61
|
+
enum Capture
|
62
|
+
{
|
58
63
|
|
59
|
-
|
64
|
+
CAPTURE_NONE = 0,
|
65
|
+
|
66
|
+
CAPTURE_KEY = 0x1 << 0,
|
67
|
+
|
68
|
+
CAPTURE_POINTER = 0x1 << 1,
|
60
69
|
|
61
|
-
|
70
|
+
CAPTURE_ALL = CAPTURE_KEY | CAPTURE_POINTER,
|
62
71
|
|
63
|
-
|
72
|
+
};// Capture
|
64
73
|
|
65
|
-
|
74
|
+
View (const char* name = NULL);
|
75
|
+
|
76
|
+
virtual void show ();
|
77
|
+
|
78
|
+
virtual void hide ();
|
66
79
|
|
67
80
|
virtual bool hidden () const;
|
68
81
|
|
82
|
+
virtual void redraw ();
|
83
|
+
|
84
|
+
virtual void add_child (View* child);
|
85
|
+
|
86
|
+
virtual void remove_child (View* child);
|
87
|
+
|
88
|
+
virtual void find_children (
|
89
|
+
ChildList* result, const Selector& selector, bool recursive = false) const;
|
90
|
+
|
91
|
+
virtual child_iterator child_begin ();
|
92
|
+
|
93
|
+
virtual const_child_iterator child_begin () const;
|
94
|
+
|
95
|
+
virtual child_iterator child_end ();
|
96
|
+
|
97
|
+
virtual const_child_iterator child_end () const;
|
98
|
+
|
99
|
+
virtual Style& style ();
|
100
|
+
|
101
|
+
virtual const Style& style () const;
|
102
|
+
|
103
|
+
virtual void add_style (const Style& style);
|
104
|
+
|
105
|
+
virtual void remove_style (const Style& style);
|
106
|
+
|
107
|
+
virtual Style* get_style (const Selector& selector);
|
108
|
+
|
109
|
+
virtual const Style* get_style (const Selector& selector) const;
|
110
|
+
|
111
|
+
virtual void find_styles (
|
112
|
+
StyleList* result, const Selector& selector, bool recursive = false) const;
|
113
|
+
|
114
|
+
virtual style_iterator style_begin ();
|
115
|
+
|
116
|
+
virtual const_style_iterator style_begin () const;
|
117
|
+
|
118
|
+
virtual style_iterator style_end ();
|
119
|
+
|
120
|
+
virtual const_style_iterator style_end () const;
|
121
|
+
|
122
|
+
virtual void focus (bool state = true);
|
123
|
+
|
124
|
+
virtual void blur ();
|
125
|
+
|
126
|
+
virtual bool has_focus () const;
|
127
|
+
|
128
|
+
virtual void resize_to_fit ();
|
129
|
+
|
130
|
+
virtual Rays::Point content_size () const;
|
131
|
+
|
132
|
+
virtual void set_name (const char* name);
|
133
|
+
|
134
|
+
virtual const char* name () const;
|
135
|
+
|
136
|
+
virtual void add_tag (const char* tag);
|
137
|
+
|
138
|
+
virtual void remove_tag (const char* tag);
|
139
|
+
|
140
|
+
virtual tag_iterator tag_begin ();
|
141
|
+
|
142
|
+
virtual const_tag_iterator tag_begin () const;
|
143
|
+
|
144
|
+
virtual tag_iterator tag_end ();
|
145
|
+
|
146
|
+
virtual const_tag_iterator tag_end () const;
|
147
|
+
|
148
|
+
virtual void set_selector (const Selector& selector);
|
149
|
+
|
150
|
+
virtual Selector& selector ();
|
151
|
+
|
152
|
+
virtual const Selector& selector () const;
|
153
|
+
|
154
|
+
virtual void set_frame (coord x, coord y, coord width, coord height);
|
155
|
+
|
156
|
+
virtual void set_frame (const Bounds& bounds);
|
157
|
+
|
158
|
+
virtual const Bounds& frame () const;
|
159
|
+
|
160
|
+
virtual void scroll_to (coord x, coord y, coord z = 0);
|
161
|
+
|
162
|
+
virtual void scroll_to (const Rays::Point& scroll);
|
163
|
+
|
164
|
+
virtual void scroll_by (coord x, coord y, coord z = 0);
|
165
|
+
|
166
|
+
virtual void scroll_by (const Rays::Point& dscroll);
|
167
|
+
|
168
|
+
virtual const Rays::Point& scroll () const;
|
169
|
+
|
170
|
+
virtual void set_capture (uint types);
|
171
|
+
|
172
|
+
virtual uint capture () const;
|
173
|
+
|
69
174
|
virtual View* parent ();
|
70
175
|
|
71
176
|
virtual const View* parent () const;
|
@@ -74,13 +179,53 @@ namespace Reflex
|
|
74
179
|
|
75
180
|
virtual const Window* window () const;
|
76
181
|
|
77
|
-
virtual
|
182
|
+
virtual Rays::Point from_parent (const Rays::Point& point) const;
|
183
|
+
|
184
|
+
virtual Rays::Point to_parent (const Rays::Point& point) const;
|
185
|
+
|
186
|
+
virtual Rays::Point from_window (const Rays::Point& point) const;
|
187
|
+
|
188
|
+
virtual Rays::Point to_window (const Rays::Point& point) const;
|
78
189
|
|
79
|
-
virtual
|
190
|
+
virtual Rays::Point from_screen (const Rays::Point& point) const;
|
80
191
|
|
81
|
-
virtual
|
192
|
+
virtual Rays::Point to_screen (const Rays::Point& point) const;
|
82
193
|
|
83
|
-
virtual void
|
194
|
+
virtual void on_attach (Event* e);
|
195
|
+
|
196
|
+
virtual void on_detach (Event* e);
|
197
|
+
|
198
|
+
virtual void on_update (UpdateEvent* e);
|
199
|
+
|
200
|
+
virtual void on_draw (DrawEvent* e);
|
201
|
+
|
202
|
+
virtual void on_move (FrameEvent* e);
|
203
|
+
|
204
|
+
virtual void on_resize (FrameEvent* e);
|
205
|
+
|
206
|
+
virtual void on_scroll (ScrollEvent* e);
|
207
|
+
|
208
|
+
virtual void on_focus (FocusEvent* e);
|
209
|
+
|
210
|
+
virtual void on_blur (FocusEvent* e);
|
211
|
+
|
212
|
+
virtual void on_key (KeyEvent* e);
|
213
|
+
|
214
|
+
virtual void on_key_down (KeyEvent* e);
|
215
|
+
|
216
|
+
virtual void on_key_up (KeyEvent* e);
|
217
|
+
|
218
|
+
virtual void on_pointer (PointerEvent* e);
|
219
|
+
|
220
|
+
virtual void on_pointer_down (PointerEvent* e);
|
221
|
+
|
222
|
+
virtual void on_pointer_up (PointerEvent* e);
|
223
|
+
|
224
|
+
virtual void on_pointer_move (PointerEvent* e);
|
225
|
+
|
226
|
+
virtual void on_wheel (WheelEvent* e);
|
227
|
+
|
228
|
+
virtual void on_capture (CaptureEvent* e);
|
84
229
|
|
85
230
|
virtual operator bool () const;
|
86
231
|
|
@@ -90,6 +235,24 @@ namespace Reflex
|
|
90
235
|
|
91
236
|
Xot::PImpl<Data> self;
|
92
237
|
|
238
|
+
#ifdef REFLEX_VIEW_REF_DEBUG
|
239
|
+
virtual void retain (void* data = NULL) const
|
240
|
+
{
|
241
|
+
RefCountable::retain(data);
|
242
|
+
String spaces = "";
|
243
|
+
for (int i = 0; i < refc_count(); ++i) spaces += " ";
|
244
|
+
printf("(%d)%s-> %s\n", refc_count(), spaces.c_str(), name());
|
245
|
+
}
|
246
|
+
|
247
|
+
virtual void release (void* data = NULL) const
|
248
|
+
{
|
249
|
+
RefCountable::release(data);
|
250
|
+
String spaces = "";
|
251
|
+
for (int i = 0; i < refc_count(); ++i) spaces += " ";
|
252
|
+
printf("(%d)%s<- %s\n", refc_count(), spaces.c_str(), name());
|
253
|
+
}
|
254
|
+
#endif// REFLEX_VIEW_REF_DEBUG
|
255
|
+
|
93
256
|
protected:
|
94
257
|
|
95
258
|
virtual ~View ();
|
data/include/reflex/window.h
CHANGED
@@ -6,13 +6,15 @@
|
|
6
6
|
|
7
7
|
#include <xot/ref.h>
|
8
8
|
#include <xot/pimpl.h>
|
9
|
+
#include <rays/point.h>
|
9
10
|
#include <reflex/defs.h>
|
11
|
+
#include <reflex/event.h>
|
10
12
|
|
11
13
|
|
12
14
|
namespace Rays
|
13
15
|
{
|
14
16
|
|
15
|
-
|
17
|
+
struct Bounds;
|
16
18
|
|
17
19
|
class Painter;
|
18
20
|
|
@@ -37,23 +39,23 @@ namespace Reflex
|
|
37
39
|
|
38
40
|
Window ();
|
39
41
|
|
40
|
-
virtual
|
42
|
+
virtual void show ();
|
41
43
|
|
42
|
-
virtual
|
44
|
+
virtual void hide ();
|
43
45
|
|
44
|
-
virtual
|
46
|
+
virtual void close ();
|
45
47
|
|
46
|
-
virtual
|
48
|
+
virtual void redraw ();
|
47
49
|
|
48
|
-
virtual
|
50
|
+
virtual void set_title (const char* title);
|
49
51
|
|
50
52
|
virtual const char* title () const;
|
51
53
|
|
52
|
-
virtual
|
54
|
+
virtual void set_frame (coord x, coord y, coord width, coord height);
|
53
55
|
|
54
|
-
virtual
|
56
|
+
virtual void set_frame (const Bounds& bounds);
|
55
57
|
|
56
|
-
virtual Bounds
|
58
|
+
virtual Bounds frame () const;
|
57
59
|
|
58
60
|
virtual bool hidden () const;
|
59
61
|
|
@@ -61,27 +63,41 @@ namespace Reflex
|
|
61
63
|
|
62
64
|
virtual const View* root () const;
|
63
65
|
|
66
|
+
virtual View* focus ();
|
67
|
+
|
68
|
+
virtual const View* focus () const;
|
69
|
+
|
64
70
|
virtual Painter* painter ();
|
65
71
|
|
66
72
|
virtual const Painter* painter () const;
|
67
73
|
|
68
|
-
virtual
|
74
|
+
virtual Rays::Point from_screen (const Rays::Point& point) const;
|
75
|
+
|
76
|
+
virtual Rays::Point to_screen (const Rays::Point& point) const;
|
77
|
+
|
78
|
+
virtual void on_update (UpdateEvent* e);
|
79
|
+
|
80
|
+
virtual void on_draw (DrawEvent* e);
|
81
|
+
|
82
|
+
virtual void on_move (FrameEvent* e);
|
83
|
+
|
84
|
+
virtual void on_resize (FrameEvent* e);
|
69
85
|
|
70
|
-
virtual void
|
86
|
+
virtual void on_key (KeyEvent* e);
|
71
87
|
|
72
|
-
virtual void
|
88
|
+
virtual void on_key_down (KeyEvent* e);
|
73
89
|
|
74
|
-
virtual void
|
90
|
+
virtual void on_key_up (KeyEvent* e);
|
75
91
|
|
76
|
-
virtual void
|
92
|
+
virtual void on_pointer (PointerEvent* e);
|
77
93
|
|
78
|
-
virtual void
|
94
|
+
virtual void on_pointer_down (PointerEvent* e);
|
79
95
|
|
80
|
-
virtual void
|
96
|
+
virtual void on_pointer_up (PointerEvent* e);
|
81
97
|
|
82
|
-
virtual void
|
98
|
+
virtual void on_pointer_move (PointerEvent* e);
|
83
99
|
|
84
|
-
virtual void
|
100
|
+
virtual void on_wheel (WheelEvent* e);
|
85
101
|
|
86
102
|
operator bool () const;
|
87
103
|
|
@@ -89,7 +105,7 @@ namespace Reflex
|
|
89
105
|
|
90
106
|
struct Data;
|
91
107
|
|
92
|
-
Xot::PImpl<Data
|
108
|
+
Xot::PImpl<Data> self;
|
93
109
|
|
94
110
|
protected:
|
95
111
|
|
data/include/reflex.h
CHANGED
@@ -7,9 +7,16 @@
|
|
7
7
|
#include <reflex/defs.h>
|
8
8
|
#include <reflex/reflex.h>
|
9
9
|
#include <reflex/exception.h>
|
10
|
+
|
11
|
+
#include <reflex/selector.h>
|
12
|
+
#include <reflex/style.h>
|
13
|
+
#include <reflex/event.h>
|
14
|
+
|
10
15
|
#include <reflex/application.h>
|
11
16
|
#include <reflex/window.h>
|
12
17
|
#include <reflex/view.h>
|
13
18
|
|
19
|
+
#include <reflex/image_view.h>
|
20
|
+
|
14
21
|
|
15
22
|
#endif//EOH
|
data/lib/reflex/application.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
3
|
|
4
|
-
require 'xot/hookable'
|
5
4
|
require 'xot/setter'
|
5
|
+
require 'xot/block_util'
|
6
6
|
require 'reflex/ext'
|
7
|
+
require 'reflex/helper'
|
7
8
|
|
8
9
|
|
9
10
|
module Reflex
|
@@ -11,13 +12,21 @@ module Reflex
|
|
11
12
|
|
12
13
|
class Application
|
13
14
|
|
14
|
-
include Xot::Hookable
|
15
15
|
include Xot::Setter
|
16
|
+
include Hookable
|
16
17
|
|
17
|
-
def initialize (opts = {})
|
18
|
+
def initialize (opts = {}, &block)
|
18
19
|
super()
|
19
|
-
|
20
|
-
|
20
|
+
set opts
|
21
|
+
@start_block = block
|
22
|
+
end
|
23
|
+
|
24
|
+
def on_start (e)
|
25
|
+
Xot::BlockUtil.instance_eval_or_block_call self, &@start_block if @start_block
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.start (*args, &block)
|
29
|
+
self.new(*args, &block).start
|
21
30
|
end
|
22
31
|
|
23
32
|
end# Application
|