16 GUI Utilities
(require framework/gui-utils) | package: gui-lib |
procedure
(gui-utils:trim-string str size)
→
(and/c string? (λ (str) ((string-length str) . <= . size))) str : string? size : (and/c number? positive?)
procedure
(gui-utils:quote-literal-label string [ #:quote-amp? quote-amp?])
→
(and/c string? (λ (str) ((string-length str) . <= . 200))) string : string? quote-amp? : any/c = #t
procedure
(gui-utils:format-literal-label str rest ...)
→
(and/c string? (lambda (str) ((string-length str) . <= . 200))) str : string? rest : (listof any/c)
procedure
Just returns what system-position-ok-before-cancel? does.
procedure
(gui-utils:ok/cancel-buttons parent confirm-callback cancel-callback [ confirm-label cancel-label #:confirm-style confirm-style])
→
(is-a?/c button%) (is-a?/c button%) parent : (is-a?/c area-container<%>) confirm-callback : ((is-a?/c button%) (is-a?/c event%) . -> . any) cancel-callback : ((is-a?/c button%) (is-a?/c event%) . -> . any) confirm-label : string? = (string-constant ok) cancel-label : string? = (string-constant cancel) confirm-style : (listof symbol?) = '(border)
The first result is be the OK button and the second is the cancel button.
By default, the confirmation action button has the '(border) style, meaning that hitting return in the dialog will trigger the confirmation action. The confirm-style argument can override this behavior, tho. See button% for the precise list of allowed styles.
procedure
procedure
(gui-utils:cursor-delay new-delay) → void? new-delay : real?
The first case in the case lambda returns the current delay in seconds before a watch cursor is shown, when either gui-utils:local-busy-cursor or gui-utils:show-busy-cursor is called.
procedure
(gui-utils:show-busy-cursor thunk [delay]) → any/c
thunk : (-> any/c) delay : integer? = (gui-utils:cursor-delay)
procedure
(gui-utils:delay-action delay-time open close) → (-> void?) delay-time : real? open : (-> void?) close : (-> void?)
(let ([close-down (gui-utils:delay-action 2 (λ () .. init watch cursor ...) (λ () .. close watch cursor ...))]) (close-down))
procedure
(gui-utils:local-busy-cursor window thunk [ delay]) → any/c window : (is-a?/c window<%>) thunk : (-> any/c) delay : integer? = (gui-utils:cursor-delay)
procedure
(gui-utils:unsaved-warning filename action [ can-save-now? parent cancel? #:dialog-mixin dialog-mixin]) → (symbols 'continue 'save 'cancel) filename : string? action : string? can-save-now? : boolean? = #f
parent :
(or/c false/c (is-a?/c frame%) (is-a?/c dialog%)) = #f cancel? : boolean? = #t dialog-mixin : (make-mixin-contract dialog%) = values
The string, action, indicates what action is about to take place, without saving. For example, if the application is about to close a file, a good action is "Close Anyway". The result symbol indicates the user’s choice. If can-save-now? is #f, this function does not give the user the “Save” option and thus will not return 'save.
If cancel? is #t there is a cancel button in the dialog and the result may be 'cancel. If it is #f, then there is no cancel button, and 'cancel will not be the result of the function.
The dialog-mixin argument is passed to message-box/custom.
Changed in version 1.29 of package gui-lib: Added the dialog-mixin argument.
procedure
(gui-utils:get-choice message true-choice false-choice [ title default-result parent style checkbox-proc checkbox-label #:dialog-mixin dialog-mixin]) → any/c message : string? true-choice : string? false-choice : string? title : string? = (string-constant warning) default-result : any/c = 'disallow-close
parent : (or/c false/c (is-a?/c frame%) (is-a?/c dialog%)) = #f style : (symbols 'app 'caution 'stop) = 'app
checkbox-proc :
(or/c false/c (case-> (boolean? . -> . void?) (-> boolean?))) = #f checkbox-label : string? = (string-constant dont-ask-again) dialog-mixin : (make-mixin-contract dialog%) = values
The dialog will contain the string message and two buttons, labeled with the true-choice and the false-choice. If the user clicks on true-choice #t is returned. If the user clicks on false-choice, #f is returned.
The argument default-result determines how closing the window is treated. If the argument is 'disallow-close, closing the window is not allowed. If it is anything else, that value is returned when the user closes the window.
If gui-utils:cancel-on-right? returns #t, the false choice is on the right. Otherwise, the true choice is on the right.
The style parameter is (eventually) passed to message as an icon in the dialog.
If checkbox-proc is given, it should be a procedure that behaves
like a parameter for getting/setting a boolean value. The intention for
this value is that it can be used to disable the dialog. When it is
given, a checkbox will appear with a checkbox-label label
(defaults to the dont-ask-again string constant), and that
checkbox value will be sent to the checkbox-proc when the dialog
is closed. Note that the dialog will always pop-up —
The dialog-mixin argument is passed to message-box/custom or message+check-box/custom.
Changed in version 1.29 of package gui-lib: Added the dialog-mixin argument.
procedure
(gui-utils:get-clicked-clickback-delta [white-on-black?])
→ (is-a?/c style-delta%) white-on-black? : boolean? = #f
If white-on-black? is true, the function returns a delta suitable for use on a black background.
procedure
(gui-utils:get-clickback-delta [white-on-black?])
→ (is-a?/c style-delta%) white-on-black? : boolean? = #f
If white-on-black? is true, the function returns a delta suitable for use on a black background.
See also gui-utils:get-clicked-clickback-delta.