123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- class IUP_FONT_DIALOG
- -- Creates the Font Dialog element. It is a predefined dialog for selecting a
- -- font.
- -- The IUP_FONT_DIALOG is a native pre-defined dialog not altered by
- -- iup_set_language.
- --
- -- In Windows, the dialog will be modal relative only to its parent or to the
- -- active dialog.
- inherit
- IUP_WIDGET
- redefine
- execute_help
- end
- IUP_WIDGET_INTERNALS
- IUP_WIDGET_TITLE
- IUP_WIDGET_POPUP
- IUP_WIDGET_ICON
- IUP_WIDGET_PARENT_DIALOG
- create {ANY}
- font_dialog
-
- feature {ANY}
- font_dialog
- local
- a_font_dialog: POINTER
- do
- a_font_dialog := int_font_dialog
- set_widget(a_font_dialog)
- end
- -- Attributes
- set_preview_text (text: STRING)
- -- [GTK and Motif only]: the text shown in the preview area. If not
- -- defined, the system will provide a default text.
- do
- iup_open.set_attribute(Current, "PREVIEWTEXT", text)
- end
- set_color (red, green, blue: INTEGER)
- -- [Windows Only]: The initial color value. In Windows the Choose Font
- -- dialog allows the user to select a color from a pre-defined list of
- -- colors. Since IUP 3.15 must set SHOWCOLOR=True to enable this option.
- -- Format: "R G B A". Each component range from 0 to 255.
- do
- iup_open.set_attribute(Current, "COLOR", rgb_to_string(red,
- green,
- blue))
- end
- get_color: TUPLE[INTEGER, INTEGER, INTEGER]
- -- [Windows Only] Return the selected value if the user pressed the Ok
- -- button. Format: "R G B". Each component range from 0 to 255.
- do
- Result := iup_open.get_rgb(Current, "COLOR")
- end
- set_show_color (state: BOOLEAN)
- -- [Windows Only] allows the user to select a color from a pre-defined
- -- list of colors.
- do
- iup_open.set_attribute(Current, "SHOWCOLOR", boolean_to_yesno(state))
- end
- get_status: INTEGER
- -- (read-only): defined to "1" if the user pressed the Ok button, "0" if
- -- pressed the Cancel button.
- local
- value: STRING
- do
- value := iup_open.get_attribute(Current, "STATUS")
-
- if value.is_integer then
- Result := value.to_integer
- else
- Result := 0
- end
- end
- set_value (value: STRING)
- -- The initial font value. Has the same format as the font
- -- attribute in other widgets.
- do
- iup_open.set_attribute(Current, "VALUE", value)
- end
- get_value: STRING
- -- The selected font value, returned if the user pressed the Ok button.
- do
- Result := iup_open.get_attribute(Current, "VALUE")
- end
- -- Callbacks
- set_cb_help (act: detachable PROCEDURE[TUPLE[IUP_FONT_DIALOG]])
- -- Action generated when the user press F1 at a control. In Motif
- -- is also activated by the Help button in some workstations
- -- keyboard.
- -- Returns: IUP_CLOSE will be processed.
- local
- operation: INTEGER
- do
- cb_help := act
- if cb_help /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "HELP_CB", "NONEEDED", operation)
- end
- feature {IUP}
- execute_help
- do
- if attached cb_help as int_cb then
- int_cb.call([Current])
- end
- end
- feature {NONE}
- -- For callbacks
- cb_help: detachable PROCEDURE[TUPLE[IUP_FONT_DIALOG]]
- -- Internal
- int_font_dialog: POINTER
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "return IupFontDlg ();"
- end
- end
- -- The MIT License (MIT)
- -- Copyright (c) 2016, 2017, 2019, 2020 by German A. Arias
- -- Permission is hereby granted, free of charge, to any person obtaining a copy
- -- of this software and associated documentation files (the "Software"), to deal
- -- in the Software without restriction, including without limitation the rights
- -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- -- copies of the Software, and to permit persons to whom the Software is
- -- furnished to do so, subject to the following conditions:
- --
- -- The above copyright notice and this permission notice shall be included in
- -- all copies or substantial portions of the Software.
- --
- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- -- SOFTWARE.
|