1#[macro_export]
3macro_rules! tauri_panel {
4 ($panel_name:ident {
6 $(
7 config: {
8 $($method_name:ident: $method_value:expr),* $(,)?
9 }
10 )?
11 $(
12 with: {
13 $(tracking_area: {
14 $($tracking_key:ident: $tracking_value:expr),* $(,)?
15 })?
16 }
17 )?
18 }) => {
19 #[allow(unused_imports)]
20 use $crate::objc2::{define_class, msg_send, MainThreadOnly, Message, DefinedClass, rc::{Retained, Allocated}, ClassType, runtime::ProtocolObject};
21 #[allow(unused_imports)]
22 use $crate::objc2_foundation::{NSObject, NSObjectProtocol, MainThreadMarker};
23 #[allow(unused_imports)]
24 use $crate::objc2_app_kit::{NSWindowDelegate};
25 #[allow(unused_imports)]
26 use $crate::{NSNotification, NSWindow, NSView, NSPanel, NSPoint, NSRect, NSSize, AnyObject};
27 #[allow(unused_imports)]
28 use $crate::objc2::runtime::Bool;
29 #[allow(unused_imports)]
30 use $crate::objc2_app_kit::NSEvent;
31
32 $crate::panel!($panel_name {
33 $(
34 config: {
35 $($method_name: $method_value),*
36 }
37 )?
38 $(
39 with: {
40 $(tracking_area: {
41 $($tracking_key: $tracking_value),*
42 })?
43 }
44 )?
45 });
46 };
47
48 (
50 $(
51 panel_event!($handler_name:ident {
52 $(
53 $method:ident ( $first_param:ident : $first_type:ty $(, $param:ident : $param_type:ty)* $(,)? ) -> $return_type:ty
54 ),* $(,)?
55 })
56 )*
57 ) => {
58 #[allow(unused_imports)]
59 use $crate::objc2::{define_class, msg_send, MainThreadOnly, Message, DefinedClass, rc::{Retained, Allocated}, ClassType, runtime::ProtocolObject};
60 #[allow(unused_imports)]
61 use $crate::objc2_foundation::{NSObject, NSObjectProtocol, MainThreadMarker};
62 #[allow(unused_imports)]
63 use $crate::objc2_app_kit::{NSWindowDelegate};
64 #[allow(unused_imports)]
65 use $crate::{NSNotification, NSWindow, NSView, NSPanel, NSPoint, NSRect, NSSize, AnyObject};
66 #[allow(unused_imports)]
67 use $crate::objc2::runtime::Bool;
68 #[allow(unused_imports)]
69 use $crate::objc2_app_kit::NSEvent;
70
71 $(
72 $crate::panel_event!($handler_name {
73 $(
74 $method ( $first_param : $first_type $(, $param : $param_type)* ) -> $return_type
75 ),*
76 });
77 )*
78 };
79
80 (
82 $(
83 panel!($panel_name:ident {
84 $(
85 config: {
86 $($method_name:ident: $method_value:expr),* $(,)?
87 }
88 )?
89 $(
90 with: {
91 $(tracking_area: {
92 $($tracking_key:ident: $tracking_value:expr),* $(,)?
93 })?
94 }
95 )?
96 })
97 )*
98 $(
99 panel_event!($handler_name:ident {
100 $(
101 $event_method:ident ( $first_param:ident : $first_type:ty $(, $param:ident : $param_type:ty)* $(,)? ) -> $return_type:ty
102 ),* $(,)?
103 })
104 )*
105 ) => {
106 #[allow(unused_imports)]
107 use $crate::objc2::{define_class, msg_send, MainThreadOnly, Message, DefinedClass, rc::{Retained, Allocated}, ClassType, runtime::ProtocolObject};
108 #[allow(unused_imports)]
109 use $crate::objc2_foundation::{NSObject, NSObjectProtocol, MainThreadMarker};
110 #[allow(unused_imports)]
111 use $crate::objc2_app_kit::{NSWindowDelegate};
112 #[allow(unused_imports)]
113 use $crate::{NSNotification, NSWindow, NSView, NSPanel, NSPoint, NSRect, NSSize, AnyObject};
114 #[allow(unused_imports)]
115 use $crate::objc2::runtime::Bool;
116 #[allow(unused_imports)]
117 use $crate::objc2_app_kit::NSEvent;
118
119 $(
120 $crate::panel!($panel_name {
121 $(
122 config: {
123 $($method_name: $method_value),*
124 }
125 )?
126 $(
127 with: {
128 $(tracking_area: {
129 $($tracking_key: $tracking_value),*
130 })?
131 }
132 )?
133 });
134 )*
135
136 $(
137 $crate::panel_event!($handler_name {
138 $(
139 $event_method ( $first_param : $first_type $(, $param : $param_type)* ) -> $return_type
140 ),*
141 });
142 )*
143 };
144}