Skip to content

Commit 672a599

Browse files
committed
Merge pull request #26 from dcampbell24/doczz
Fix doc comments on callbacks
2 parents ecc8c2e + 13016e2 commit 672a599

File tree

3 files changed

+85
-85
lines changed

3 files changed

+85
-85
lines changed

Diff for: src/callback/callbacks.rs

+62-62
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ use std::path::PathBuf;
44
impl_callback! {
55
let name = "IDLE_ACTION";
66
extern fn listener() -> CallbackReturn;
7-
/// Action generated when there are no events or messages to be processed.
8-
///
9-
/// Often used to perform background operations.
7+
#[doc="Action generated when there are no events or messages to be processed."]
8+
#[doc=""]
9+
#[doc="Often used to perform background operations."]
1010
pub fn set_idle<F: Callback()>(cb: F);
11-
/// Removes a previosly set up idle_action callback.
11+
#[doc="Removes a previosly set up idle_action callback."]
1212
pub fn remove_idle() -> Option<Box<_>>;
1313
}
1414

@@ -18,9 +18,9 @@ impl_callback! {
1818
// This is the common version of the ACTION callback, any so called ACTION that does not
1919
// have the `(*mut iup_sys::Ihandle)` signature should be another trait.
2020
impl_callback! {
21-
/// Action generated when the element is activated. Affects each element differently.
22-
///
23-
/// See the documentation of the `Self` object for the effect of this callback on it.
21+
#[doc="Action generated when the element is activated. Affects each element differently."]
22+
#[doc=""]
23+
#[doc="See the documentation of the `Self` object for the effect of this callback on it."]
2424
pub trait Action where Self: Element {
2525
let name = "ACTION";
2626
extern fn listener(ih: *mut iup_sys::Ihandle) -> CallbackReturn;
@@ -37,7 +37,7 @@ impl_callback! {
3737
// The binding free needs to be called after LDESTROY_CB (i.e. at DESTROY_CB) because
3838
// the LDESTROY_CB event call depends on the binding boxed data to work properly.
3939
impl_callback! {
40-
/// Called right before an element is destroyed.
40+
#[doc="Called right before an element is destroyed."]
4141
pub trait DestroyCb where Self: Element {
4242
let name = "LDESTROY_CB"; // See comments above for reason behind LDESTROY_CB.
4343
extern fn listener(ih: *mut iup_sys::Ihandle) -> CallbackReturn;
@@ -47,11 +47,11 @@ impl_callback! {
4747
}
4848

4949
impl_callback! {
50-
/// Called right after an element is mapped and its attributes updated in `Element::map`.
51-
///
52-
/// When the element is a dialog, it is called after the layout is updated. For all other
53-
/// elements is called before the layout is updated, so the element current size will still
54-
/// be 0x0 during MAP_CB.
50+
#[doc="Called right after an element is mapped and its attributes updated in `Element::map`."]
51+
#[doc=""]
52+
#[doc="When the element is a dialog, it is called after the layout is updated. For all other"]
53+
#[doc="elements is called before the layout is updated, so the element current size will still"]
54+
#[doc="be 0x0 during MAP_CB."]
5555
pub trait MapCb where Self: Element {
5656
let name = "MAP_CB";
5757
extern fn listener(ih: *mut iup_sys::Ihandle) -> CallbackReturn;
@@ -61,7 +61,7 @@ impl_callback! {
6161
}
6262

6363
impl_callback! {
64-
/// Called right before an element is unmapped.
64+
#[doc="Called right before an element is unmapped."]
6565
pub trait UnmapCb where Self: Element {
6666
let name = "UNMAP_CB";
6767
extern fn listener(ih: *mut iup_sys::Ihandle) -> CallbackReturn;
@@ -71,10 +71,10 @@ impl_callback! {
7171
}
7272

7373
impl_callback! {
74-
/// Action generated when an element is given keyboard focus.
75-
///
76-
/// This callback is called after the `KillFocusCb` of the element that loosed the focus.
77-
/// The IupGetFocus (TODO) function during the callback returns the element that loosed the focus.
74+
#[doc="Action generated when an element is given keyboard focus."]
75+
#[doc=""]
76+
#[doc="This callback is called after the `KillFocusCb` of the element that loosed the focus."]
77+
#[doc="The IupGetFocus (TODO) function during the callback returns the element that loosed the focus."]
7878
pub trait GetFocusCb where Self: Element {
7979
let name = "GETFOCUS_CB";
8080
extern fn listener(ih: *mut iup_sys::Ihandle) -> CallbackReturn;
@@ -84,13 +84,13 @@ impl_callback! {
8484
}
8585

8686
impl_callback! {
87-
/// Action generated when an element loses keyboard focus.
88-
///
89-
/// This callback is called before the `GetFocusCb` of the element that gets the focus.
90-
///
91-
/// While processing this message, do not make any function calls that display or activate a
92-
/// window. This causes the thread to yield control and can cause the application to stop
93-
/// responding to messages.
87+
#[doc="Action generated when an element loses keyboard focus."]
88+
#[doc=""]
89+
#[doc="This callback is called before the `GetFocusCb` of the element that gets the focus."]
90+
#[doc=""]
91+
#[doc="While processing this message, do not make any function calls that display or activate a"]
92+
#[doc="window. This causes the thread to yield control and can cause the application to stop"]
93+
#[doc="responding to messages."]
9494
pub trait KillFocusCb where Self: Element {
9595
let name = "KILLFOCUS_CB";
9696
extern fn listener(ih: *mut iup_sys::Ihandle) -> CallbackReturn;
@@ -100,11 +100,11 @@ impl_callback! {
100100
}
101101

102102
impl_callback! {
103-
/// Action generated when the mouse enters the native element.
104-
///
105-
/// When the cursor is moved from one element to another, the call order in all platforms will
106-
/// be first the `LeaveWindowCb` callback of the old control followed by the `EnterWindowCb`
107-
/// callback of the new control.
103+
#[doc="Action generated when the mouse enters the native element."]
104+
#[doc=""]
105+
#[doc="When the cursor is moved from one element to another, the call order in all platforms will"]
106+
#[doc="be first the `LeaveWindowCb` callback of the old control followed by the `EnterWindowCb`"]
107+
#[doc="callback of the new control."]
108108
pub trait EnterWindowCb where Self: Element {
109109
let name = "ENTERWINDOW_CB";
110110
extern fn listener(ih: *mut iup_sys::Ihandle) -> CallbackReturn;
@@ -114,11 +114,11 @@ impl_callback! {
114114
}
115115

116116
impl_callback! {
117-
/// Action generated when the mouse leaves the native element.
118-
///
119-
/// When the cursor is moved from one element to another, the call order in all platforms will
120-
/// be first the `LeaveWindowCb` callback of the old control followed by the `EnterWindowCb`
121-
/// callback of the new control.
117+
#[doc="Action generated when the mouse leaves the native element."]
118+
#[doc=""]
119+
#[doc="When the cursor is moved from one element to another, the call order in all platforms will"]
120+
#[doc="be first the `LeaveWindowCb` callback of the old control followed by the `EnterWindowCb`"]
121+
#[doc="callback of the new control."]
122122
pub trait LeaveWindowCb where Self: Element {
123123
let name = "LEAVEWINDOW_CB";
124124
extern fn listener(ih: *mut iup_sys::Ihandle) -> CallbackReturn;
@@ -128,9 +128,9 @@ impl_callback! {
128128
}
129129

130130
impl_callback! {
131-
/// Action generated when the user press F1 at a control.
132-
///
133-
/// `CallbackReturn::Close` will be processed.
131+
#[doc="Action generated when the user press F1 at a control."]
132+
#[doc=""]
133+
#[doc="`CallbackReturn::Close` will be processed."]
134134
pub trait HelpCb where Self: Element {
135135
let name = "HELP_CB";
136136
extern fn listener(ih: *mut iup_sys::Ihandle) -> CallbackReturn;
@@ -143,10 +143,10 @@ impl_callback! {
143143
// ----------------------------
144144

145145
impl_callback! {
146-
/// Action generated when the caret/cursor position is changed.
147-
///
148-
/// The second and third parameters are the line and column number (start at 1).
149-
/// The fourth parameter is a 0 based character position.
146+
#[doc="Action generated when the caret/cursor position is changed."]
147+
#[doc=""]
148+
#[doc="The second and third parameters are the line and column number (start at 1)."]
149+
#[doc="The fourth parameter is a 0 based character position."]
150150
pub trait CaretCb where Self: Element {
151151
let name = "CARET_CB";
152152
extern fn listener(ih: *mut iup_sys::Ihandle, lin: c_int, col: c_int, pos: c_int) -> CallbackReturn;
@@ -156,7 +156,7 @@ impl_callback! {
156156
}
157157

158158
impl_callback! {
159-
/// Action generated when a spin button is pressed.
159+
#[doc="Action generated when a spin button is pressed."]
160160
pub trait SpinCb where Self: Element {
161161
let name = "SPIN_CB";
162162
extern fn listener(ih: *mut iup_sys::Ihandle, i: c_int) -> CallbackReturn;
@@ -166,9 +166,9 @@ impl_callback! {
166166
}
167167

168168
impl_callback! {
169-
/// Usually called after the value of a control changed.
170-
///
171-
/// See the specific control documentation for more details.
169+
#[doc="Usually called after the value of a control changed."]
170+
#[doc=""]
171+
#[doc="See the specific control documentation for more details."]
172172
pub trait ValueChangedCb where Self: Element {
173173
let name = "VALUECHANGED_CB";
174174
extern fn listener(ih: *mut iup_sys::Ihandle) -> CallbackReturn;
@@ -179,22 +179,22 @@ impl_callback! {
179179

180180

181181
impl_callback! {
182-
/// Action called when a file is *dropped* into the control.
183-
///
184-
/// When several files are dropped at once, the callback is called several times, once for
185-
/// each file.
186-
///
187-
/// If defined after the element is mapped then the attribute DROPFILESTARGET must be set
188-
/// to YES.
189-
///
190-
/// The third parameter of the callback is the number index of the dropped file. If several
191-
/// files are dropped, it is the index of the dropped file starting from *total-1* to *0*.
192-
/// The fourth and fifth parameters are x,y coordinate of the point where the user
193-
/// released the mouse button.
194-
///
195-
/// if `CallbackReturn::Ignore` is returned the callback will **not** be called for the
196-
/// next dropped files, and the processing of dropped files will be interrupted.
197-
///
182+
#[doc="Action called when a file is *dropped* into the control."]
183+
#[doc=""]
184+
#[doc="When several files are dropped at once, the callback is called several times, once for"]
185+
#[doc="each file. "]
186+
#[doc=""]
187+
#[doc="If defined after the element is mapped then the attribute DROPFILESTARGET must be set"]
188+
#[doc="to YES."]
189+
#[doc=""]
190+
#[doc="The third parameter of the callback is the number index of the dropped file. If several"]
191+
#[doc="files are dropped, it is the index of the dropped file starting from *total-1* to *0*."]
192+
#[doc="The fourth and fifth parameters are x,y coordinate of the point where the user"]
193+
#[doc="released the mouse button."]
194+
#[doc=""]
195+
#[doc="if `CallbackReturn::Ignore` is returned the callback will **not** be called for the"]
196+
#[doc="next dropped files, and the processing of dropped files will be interrupted."]
197+
#[doc=""]
198198
#[doc="\\[Windows and GTK Only\\] (GTK 2.6)"]
199199
pub trait DropFilesCb where Self: Element {
200200
let name = "DROPFILES_CB";

Diff for: src/control/text.rs

+18-18
Original file line numberDiff line numberDiff line change
@@ -92,24 +92,24 @@ impl ::callback::ValueChangedCb for Text {}
9292
/// See the `TextAction` documentation.
9393
impl self::TextAction for Text {}
9494
impl_callback! {
95-
/// Action generated when the text is edited, but before its value is actually changed.
96-
///
97-
/// Can be generated when using the keyboard, undo system or from the clipboard.
98-
///
99-
/// The following values can be returned from the callback:
100-
/// + `CallbackReturn::Default` or `()` for the default reaction.
101-
/// + `CallbackReturn::Close` will be processed, but the change will be ignored.
102-
/// + `CallbackReturn::Ignore` ignores the new value.
103-
/// + An `CallbackReturn::Char`, if the received `c` is `None` or NUL is returned it'll act
104-
/// just like `CallbackReturn::Default` otherwise the returned character will be used
105-
/// instead of the one sent to the callback.
106-
///
107-
/// The VALUE attribute can be changed only if `CallbackReturn::Ignore` is returned.
108-
///
109-
/// **NOTE:** The **character** received and returned must be in the ASCII range of
110-
/// UTF-8 (0-127). No restriction on the `newvalue` string, when the value added to the VALUE
111-
/// is a non-ASCII character the `c` parameter will be `None` but the value is still used for
112-
/// updating the VALUE attribute.
95+
#[doc="Action generated when the text is edited, but before its value is actually changed."]
96+
#[doc=""]
97+
#[doc="Can be generated when using the keyboard, undo system or from the clipboard."]
98+
#[doc=""]
99+
#[doc="The following values can be returned from the callback:"]
100+
#[doc=" + `CallbackReturn::Default` or `()` for the default reaction."]
101+
#[doc=" + `CallbackReturn::Close` will be processed, but the change will be ignored."]
102+
#[doc=" + `CallbackReturn::Ignore` ignores the new value."]
103+
#[doc=" + An `CallbackReturn::Char`, if the received `c` is `None` or NUL is returned it'll act"]
104+
#[doc=" just like `CallbackReturn::Default` otherwise the returned character will be used"]
105+
#[doc=" instead of the one sent to the callback."]
106+
#[doc=""]
107+
#[doc="The VALUE attribute can be changed only if `CallbackReturn::Ignore` is returned."]
108+
#[doc=""]
109+
#[doc="**NOTE:** The **character** received and returned must be in the ASCII range of"]
110+
#[doc=" UTF-8 (0-127). No restriction on the `newvalue` string, when the value added to the VALUE"]
111+
#[doc="is a non-ASCII character the `c` parameter will be `None` but the value is still used for"]
112+
#[doc="updating the VALUE attribute."]
113113
pub trait TextAction where Self: Element {
114114
let name = "ACTION";
115115
extern fn listener(ih: *mut iup_sys::Ihandle, c: c_int, newvalue: *const c_char) -> CallbackReturn;

Diff for: src/control/toggle.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ impl ::callback::ValueChangedCb for Toggle {}
3939
/// See the `ToggleAction` documentation.
4040
impl self::ToggleAction for Toggle {}
4141
impl_callback! {
42-
/// Action generated when the toggle's state (on/off) was changed.
43-
///
44-
/// The callback boolean parameter represents the state the toggle was switched to.
45-
///
46-
/// `CallbackReturn::Close` will be processed
42+
#[doc="Action generated when the toggle's state (on/off) was changed."]
43+
#[doc=""]
44+
#[doc="The callback boolean parameter represents the state the toggle was switched to."]
45+
#[doc=""]
46+
#[doc="`CallbackReturn::Close` will be processed"]
4747
pub trait ToggleAction where Self: Element {
4848
let name = "ACTION";
4949
extern fn listener(ih: *mut iup_sys::Ihandle, state: c_int) -> CallbackReturn;

0 commit comments

Comments
 (0)