@@ -27,65 +27,70 @@ extern "C" {
2727};
2828
2929// / Provides a ``NB_OVERRIDE`` for any relevant Widget items that need to be bound.
30- #define NANOGUI_WIDGET_OVERLOADS (Parent ) \
31- NB_TRAMPOLINE (Parent, 20 ) \
32- bool mouse_button_event(const ::nanogui::Vector2i &p, int button, bool down, int modifiers) override { \
33- NB_OVERRIDE (bool , Parent, mouse_button_event, p, button, down, modifiers); \
34- } \
35- bool mouse_motion_event (const ::nanogui::Vector2i &p, const ::nanogui::Vector2i &rel, int button, int modifiers) override { \
36- NB_OVERRIDE (bool , Parent, mouse_motion_event, p, rel, button, modifiers); \
37- } \
38- bool mouse_drag_event (const ::nanogui::Vector2i &p, const ::nanogui::Vector2i &rel, int button, int modifiers) override { \
39- NB_OVERRIDE (bool , Parent, mouse_drag_event, p, rel, button, modifiers); \
40- } \
41- bool mouse_enter_event (const ::nanogui::Vector2i &p, bool enter) override { \
42- NB_OVERRIDE (bool , Parent, mouse_enter_event, p, enter); \
43- } \
44- bool scroll_event (const ::nanogui::Vector2i &p, const ::nanogui::Vector2f &rel) override { \
45- NB_OVERRIDE (bool , Parent, scroll_event, p, rel); \
46- } \
47- bool focus_event (bool focused) override { \
48- NB_OVERRIDE (bool , Parent, focus_event, focused); \
49- } \
50- bool keyboard_event (int key, int scancode, int action, int modifiers) override { \
51- NB_OVERRIDE (bool , Parent, keyboard_event, key, scancode, action, modifiers); \
52- } \
53- bool keyboard_character_event (unsigned int codepoint) override { \
54- NB_OVERRIDE (bool , Parent, keyboard_character_event, codepoint); \
55- } \
56- ::nanogui::Vector2i preferred_size (NVGcontext *ctx) const override { \
57- NB_OVERRIDE (::nanogui::Vector2i, Parent, preferred_size, ctx); \
58- } \
59- void perform_layout (NVGcontext *ctx) override { \
60- NB_OVERRIDE (void , Parent, perform_layout, ctx); \
61- } \
62- void draw (NVGcontext *ctx) override { \
63- NB_OVERRIDE (void , Parent, draw, ctx); \
64- }
30+ #define NANOGUI_WIDGET_OVERLOADS (Parent ) \
31+ NB_TRAMPOLINE (Parent, 16 ); \
32+ bool mouse_button_event (const ::nanogui::Vector2i &p, int button, \
33+ bool down, int modifiers) override { \
34+ NB_OVERRIDE (mouse_button_event, p, button, down, modifiers); \
35+ } \
36+ bool mouse_motion_event (const ::nanogui::Vector2i &p, \
37+ const ::nanogui::Vector2i &rel, int button, \
38+ int modifiers) override { \
39+ NB_OVERRIDE (mouse_motion_event, p, rel, button, modifiers); \
40+ } \
41+ bool mouse_drag_event (const ::nanogui::Vector2i &p, \
42+ const ::nanogui::Vector2i &rel, int button, \
43+ int modifiers) override { \
44+ NB_OVERRIDE (mouse_drag_event, p, rel, button, modifiers); \
45+ } \
46+ bool mouse_enter_event (const ::nanogui::Vector2i &p, bool enter) \
47+ override { \
48+ NB_OVERRIDE (mouse_enter_event, p, enter); \
49+ } \
50+ bool scroll_event (const ::nanogui::Vector2i &p, \
51+ const ::nanogui::Vector2f &rel) override { \
52+ NB_OVERRIDE (scroll_event, p, rel); \
53+ } \
54+ bool focus_event (bool focused) override { \
55+ NB_OVERRIDE (focus_event, focused); \
56+ } \
57+ bool keyboard_event (int key, int scancode, int action, int modifiers) \
58+ override { \
59+ NB_OVERRIDE (keyboard_event, key, scancode, action, modifiers); \
60+ } \
61+ bool keyboard_character_event (unsigned int codepoint) override { \
62+ NB_OVERRIDE (keyboard_character_event, codepoint); \
63+ } \
64+ ::nanogui::Vector2i preferred_size (NVGcontext *ctx) const override { \
65+ NB_OVERRIDE (preferred_size, ctx); \
66+ } \
67+ void perform_layout (NVGcontext *ctx) override { \
68+ NB_OVERRIDE (perform_layout, ctx); \
69+ } \
70+ void draw (NVGcontext *ctx) override { NB_OVERRIDE (draw, ctx); }
6571
6672// / Provides a ``NB_OVERRIDE`` for any relevant Layout items that need to be bound.
67- #define NANOGUI_LAYOUT_OVERLOADS (Parent ) \
68- NB_TRAMPOLINE (Parent, 2 ) \
69- ::nanogui::Vector2i preferred_size(NVGcontext *ctx, const ::nanogui::Widget *widget) const override { \
70- NB_OVERRIDE (::nanogui::Vector2i, Parent, preferred_size, ctx, widget); \
71- } \
72- void perform_layout (NVGcontext *ctx, ::nanogui::Widget *widget) const override { \
73- NB_OVERRIDE (void , Parent, perform_layout, ctx, widget); \
73+ #define NANOGUI_LAYOUT_OVERLOADS (Parent ) \
74+ NB_TRAMPOLINE (Parent, 2 ); \
75+ ::nanogui::Vector2i preferred_size ( \
76+ NVGcontext *ctx, const ::nanogui::Widget *widget) const override { \
77+ NB_OVERRIDE (preferred_size, ctx, widget); \
78+ } \
79+ void perform_layout (NVGcontext *ctx, ::nanogui::Widget *widget) \
80+ const override { \
81+ NB_OVERRIDE (perform_layout, ctx, widget); \
7482 }
7583
7684// / Provides a ``NB_OVERRIDE`` for any relevant Screen items that need to be bound.
77- #define NANOGUI_SCREEN_OVERLOADS (Parent ) \
78- virtual void draw_all () override { \
79- NB_OVERRIDE (void , Parent, draw_all); \
80- } \
81- virtual void draw_contents () override { \
82- NB_OVERRIDE (void , Parent, draw_contents); \
83- } \
84- virtual bool drop_event (const std::vector<std::string> &filenames) override { \
85- NB_OVERRIDE (bool , Parent, drop_event, filenames); \
86- } \
87- virtual bool resize_event (const ::nanogui::Vector2i &size) override { \
88- NB_OVERRIDE (bool , Parent, resize_event, size); \
85+ #define NANOGUI_SCREEN_OVERLOADS (Parent ) \
86+ virtual void draw_all () override { NB_OVERRIDE (draw_all); } \
87+ virtual void draw_contents () override { NB_OVERRIDE (draw_contents); } \
88+ virtual bool drop_event (const std::vector<std::string> &filenames) \
89+ override { \
90+ NB_OVERRIDE (drop_event, filenames); \
91+ } \
92+ virtual bool resize_event (const ::nanogui::Vector2i &size) override { \
93+ NB_OVERRIDE (resize_event, size); \
8994 }
9095
9196NAMESPACE_BEGIN (nanobind)
0 commit comments