123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- deferred class IUP_WIDGET_SHOW
- -- Commands to show dialogs.
- inherit
- IUP_WIDGET_INTERNALS
-
- feature {ANY}
- show : STRING
- -- Show the dialog at screen, return IUP_NOERROR if successful.
- -- If there was an error returns IUP_ERROR.
- local
- r: INTEGER
- do
- r := int_show(widget)
- if r.is_equal(0) then
- Result := "IUP_NOERROR"
- else
- Result := "IUP_ERROR"
- end
- end
- show_predefined_xy (x, y: STRING): STRING
- -- Displays a dialog in a given position on the screen using predefined
- -- values. However you can combine a predefined value with an integer (as
- -- string). If there was an error returns IUP_ERROR.
- --
- -- x: The following predefined values can be used:
- --
- -- IUP_LEFT: Positions the dialog on the left corner of the main screen
- -- IUP_CENTER: Horizontally centralizes the dialog on the main screen
- -- IUP_RIGHT: Positions the dialog on the right corner of the main screen
- -- IUP_MOUSEPOS: Positions the dialog on the mouse position
- -- IUP_CENTERPARENT: Horizontally centralizes the dialog relative to its
- -- parent
- -- IUP_CURRENT: use the current position of the dialog.
- --
- -- y: The following predefined calues can be used:
- --
- -- IUP_TOP: Positions the dialog on the top of the main screen
- -- IUP_CENTER: Vertically centralizes the dialog on the main screen
- -- IUP_BOTTOM: Positions the dialog on the base of the main screen
- -- IUP_MOUSEPOS: Positions the dialog on the mouse position
- -- IUP_CENTERPARENT: Vertically centralizes the dialog relative to its
- -- parent
- -- IUP_CURRENT: use the current position of the dialog.
- require
- is_valid_position(x, y)
- do
- Result := show_xy(iup_open.position_to_integer(x),
- iup_open.position_to_integer(y))
- end
- show_xy (x, y: INTEGER): STRING
- -- Displays a dialog in a given position on the screen. If there was an
- -- error returns IUP_ERROR.
- --
- -- x: horizontal position of the top left corner of the window, relative
- -- to the origin of the main screen.
- --
- -- y: vertical position of the top left corner of the window, relative to
- -- the origin of the main screen.
- require
- x >= 0
- y >= 0
- local
- r: INTEGER
- do
- r := int_show_xy(widget, x, y)
-
- if r.is_equal(-1) then
- Result := "IUP_INVALID"
- elseif r.is_equal(0) then
- Result := "IUP_NOERROR"
- else
- Result := "IUP_ERROR"
- end
- end
- -- Validations
- is_valid_position (x, y: STRING): BOOLEAN
- local
- xs, ys: BOOLEAN
- do
- if x.is_equal("IUP_LEFT") or
- x.is_equal("IUP_CENTER") or
- x.is_equal("IUP_RIGHT") or
- x.is_equal("IUP_MOUSEPOS") or
- x.is_equal("IUP_CENTERPARENT") or
- x.is_equal("IUP_CURRENT") then
- xs := True
- elseif x.is_integer and x.to_integer >= 0 then
- xs := True
- else
- xs := False
- end
- if y.is_equal("IUP_TOP") or
- y.is_equal("IUP_CENTER") or
- y.is_equal("IUP_BOTTOM") or
- y.is_equal("IUP_MOUSEPOS") or
- y.is_equal("IUP_CENTERPARENT") or
- y.is_equal("IUP_CURRENT") then
- ys := True
- elseif y.is_integer and y.to_integer >= 0 then
- ys := True
- else
- ys := False
- end
- if xs and ys then
- Result := True
- else
- Result := False
- end
- end
- feature {NONE}
- -- Internals
- int_show (dlg: POINTER): INTEGER
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "return IupShow ($dlg);"
- end
- int_show_xy (wgt: POINTER; x, y: INTEGER): INTEGER
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "return IupShowXY ($wgt, $x, $y);"
- end
- end
- -- The MIT License (MIT)
- -- Copyright (c) 2016, 2017, 2019 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.
|