added get-button-label method to switchable-button%
original commit: 65579793afbebb705080267a37580ec0b94e1e97
This commit is contained in:
parent
6cab7dec39
commit
b77f73f013
|
@ -8,35 +8,37 @@
|
||||||
|
|
||||||
@defclass[switchable-button% canvas% ()]{
|
@defclass[switchable-button% canvas% ()]{
|
||||||
|
|
||||||
A @scheme[switchable-button%] control displays
|
A @scheme[switchable-button%] control displays
|
||||||
and icon and a string label. It toggles between
|
and icon and a string label. It toggles between
|
||||||
display of just the icon and a display with the
|
display of just the icon and a display with the
|
||||||
label and the icon side-by-side.
|
label and the icon side-by-side.
|
||||||
|
|
||||||
@defconstructor/auto-super[([label string?]
|
@defconstructor/auto-super[([label string?]
|
||||||
[callback (-> (is-a?/c switchable-button%) any/c)]
|
[callback (-> (is-a?/c switchable-button%) any/c)]
|
||||||
[bitmap (is-a?/c bitmap%)]
|
[bitmap (is-a?/c bitmap%)]
|
||||||
[alternate-bitmap (is-a?/c bitmap%) bitmap]
|
[alternate-bitmap (is-a?/c bitmap%) bitmap]
|
||||||
[vertical-tight? boolean? #f])]{
|
[vertical-tight? boolean? #f])]{
|
||||||
The @scheme[callback] is called when the button
|
The @scheme[callback] is called when the button
|
||||||
is pressed. The @scheme[string] and @scheme[bitmap] are
|
is pressed. The @scheme[string] and @scheme[bitmap] are
|
||||||
used as discussed above.
|
used as discussed above.
|
||||||
|
|
||||||
If @scheme[alternate-bitmap] is supplied, then it is used
|
If @scheme[alternate-bitmap] is supplied, then it is used
|
||||||
when the button is switched to the view that just shows the bitmap.
|
when the button is switched to the view that just shows the bitmap.
|
||||||
If it is not supplied, both modes show the same bitmap.
|
If it is not supplied, both modes show the same bitmap.
|
||||||
|
|
||||||
If the @scheme[vertical-tight?] argument is @scheme[#t], then the button takes up
|
If the @scheme[vertical-tight?] argument is @scheme[#t], then the button takes up
|
||||||
as little as possible vertical space.
|
as little as possible vertical space.
|
||||||
}
|
}
|
||||||
|
|
||||||
@defmethod[(set-label-visible [visible? boolean?]) void?]{
|
@defmethod[(set-label-visible [visible? boolean?]) void?]{
|
||||||
Sets the visibility of the string part of the label.
|
Sets the visibility of the string part of the label.
|
||||||
|
}
|
||||||
|
|
||||||
|
@defmethod[(command) void?]{
|
||||||
|
Calls the button's callback function.
|
||||||
|
}
|
||||||
|
|
||||||
|
@defmethod[(get-button-label) string?]{
|
||||||
|
Returns the label of this button.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@defmethod[(command) void?]{
|
|
||||||
|
|
||||||
Calls the button's callback function.}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,8 @@
|
||||||
[alternate-bitmap bitmap]
|
[alternate-bitmap bitmap]
|
||||||
[vertical-tight? #f])
|
[vertical-tight? #f])
|
||||||
|
|
||||||
|
(define/public (get-button-label) label)
|
||||||
|
|
||||||
(when (and (is-a? label bitmap%)
|
(when (and (is-a? label bitmap%)
|
||||||
(not (send label ok?)))
|
(not (send label ok?)))
|
||||||
(error 'switchable-button% "label bitmap is not ok?"))
|
(error 'switchable-button% "label bitmap is not ok?"))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user