123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824 |
- class IUP_WIDGET
- inherit
- ANY
- HASHABLE
- IUP_GET_POINTER
- IUP_INTERFACE
- export
- {NONE} All
- end
- create {IUP}
- make
- feature {IUP}
- make
- do
- -- Just create an IUP_WIDGET not associated with a real widget.
- end
-
- feature {ANY}
- widget: POINTER
- hash_code: INTEGER_32
- do
- Result := Current.default_pointer.hash_code
- end
- -- Widget name
- set_widget_name (name: STRING)
- local
- p: POINTER
- do
- p := int_set_widget_name(get_pointer(name.to_c), widget)
- --if p /= default_pointer then
- -- io.put_string("There was a previous widget with this name. %N")
- --end
- end
- map: STRING
- -- Creates (maps) the native interface objects corresponding to the given
- -- IUP interface elements.
- --
- -- It will also called recursively to create the native element of all
- -- the children in the element's tree.
- --
- -- The element must be already attached to a mapped container, except the
- -- dialog. A child can only be mapped if its parent is already mapped.
- --
- -- This function is automatically called before a dialog is shown in
- -- show, show_xy or popup.
- --
- -- Returns: IUP_NOERROR if successful. If the element was already mapped
- -- returns IUP_NOERROR. If the native creation failed returns IUP_ERROR.
- local
- r: INTEGER
- do
- r := int_map(widget)
- if r.is_equal(0) then
- Result := "IUP_NOERROR"
- else
- Result := "IUP_ERROR"
- end
- end
- unmap
- -- Unmap the element from the native system. It will also unmap all its
- -- children.
- --
- -- It will NOT detach the element from its parent, and it will NOT
- -- destroy the IUP element.
- do
- int_unmap(widget);
- end
-
- refresh
- -- Updates the size and layout of all controls in the same dialog.
- do
- iup_open.iup_refresh(Current)
- end
- update_control
- -- Mark the element to be redraw when the control returns
- -- to the system.
- do
- iup_open.iup_update(Current)
- end
- redraw
- -- Force the element to be redrawn immediately.
- do
- iup_open.iup_redraw(Current, 0)
- end
- destroy
- -- Explicitly destroy de IUP widget.
- do
- iup_open.delete_widget_for_object (widget, Current)
- end
- -- Theme attributes
- set_theme (name: STRING)
- -- Applies a set of attributes to a control. The THEME attributes are
- -- inheritable.
- do
- iup_open.set_attribute(Current, "THEME", name)
- end
- set_ntheme (name: STRING)
- -- Like "set_theme" but NOT inheritable.
- do
- iup_open.set_attribute(Current, "NTHEME", name)
- end
- feature {IUP} -- Internal handle of callbacks
- -- The following should be redefined when appropriate.
- -- Common callbacks
-
- execute_map: STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_unmap: STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_destroy: STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_getfocus: STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_killfocus: STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_enterwindow: STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_leavewindow: STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_k_any (c: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_help
- do
- -- Nothing to be done.
- end
- execute_action: STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Dialogs
- execute_close: STRING
- do
- Result := "IUP_DEFAULT"
- end
-
- execute_copydata (cmdline: STRING; size: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Also canvas, label, list, text
- execute_dropfiles (filename: STRING; num: INTEGER; x: INTEGER; y: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_mdiactivate: STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_move (x: INTEGER; y: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Also for canvas.
- execute_resize (width: INTEGER; height: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_show (state: STRING): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_trayclick (but: INTEGER; pressed: INTEGER; dclick: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- File dialog
- execute_file (file_name, status: STRING): STRING
- do
- Result := "IUP_DEFAULT"
- end
-
- -- Color dialog
- execute_colorupdate: STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Progress bar dialog
- execute_cancel: STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Buttons, canvas, label, list, text
- execute_button (btn, pressed, x, y: INTEGER; status: STRING): STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Calendar, also split, text, flat button
- execute_valuechanged: STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Canvas
- execute_action_fnff (posx, posy: REAL_32): STRING
- do
- Result := "IUP_DEFAULT"
- end
-
- execute_focus (focus: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Also list, text
- execute_motion (x, y: INTEGER; status: STRING): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_keypress (c, press: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_scroll (op: INTEGER; posx, posy: REAL_32): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_wheel (delta: REAL_32; x, y: INTEGER; status: STRING): STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Detach box
- execute_detached (new_parent: IUP_DIALOG; x, y: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_restored (old_parent: IUP_WIDGET; x, y: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Expander
- execute_openclose (state: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_extrabutton (button, pressed: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Link
- execute_click (url: STRING): STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- List
- execute_action_fnsii (text: STRING; item, state: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Also text
- execute_caret (lin, col, pos: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_dblclick (item: INTEGER; text: STRING): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_dragdrop (drag_id, drop_id, isshift, iscontrol: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_dropdown (state: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_edit (c: INTEGER; new_value: STRING): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_multiselect (value: STRING): STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Spin, Spin box
- execute_spin (inc: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Tabs
- execute_tabchange (new_tab, old_tab: IUP_WIDGET): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_tabchangepos (new_pos, old_pos: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_tabclose (pos: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_rightclick (pos: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Text
- execute_action_fnis (c: INTEGER; new_value: STRING): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_maskfail (new_value: STRING): STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Toggle
- execute_action_fni (state: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Tree
- execute_selection (id, status: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_multiselection (ids: POINTER; n: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_multiunselection (ids: POINTER; n: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_branchopen (id: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_branchclose (id: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_executeleaf (id: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_showrename (id: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_rename (id: INTEGER; title: STRING): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_noderemoved (userdata: POINTER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_togglevalue (id, state: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Menu item and submenu
- execute_highlight: STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Menu
- execute_open: STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_menuclose: STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Drag callbacks
- execute_dragbegin (x, y: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_dragdatasize (type: STRING): INTEGER
- do
- Result := 0
- end
- execute_dragdata (type: STRING; data: POINTER; size: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_dragend (action: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Drop callbacks
- execute_dropdata (type: STRING; data: POINTER; size, x, y: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_dropmotion (x, y: INTEGER; status: STRING): STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Recent file menu callback
- execute_recent: STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Get param
- execute_param (handle: POINTER; param_index: INTEGER; user_data: POINTER): INTEGER
- do
- Result := 0
- end
- -- Flat button
- execute_flat_action: STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_flat_button (btn, pressed, x, y: INTEGER; status: STRING): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_flat_focus (focus: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_flat_enterwindow: STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_flat_leavewindow: STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Cells
- execute_draw (line, column, xmin, xmax, ymin, ymax: INTEGER; canvas: POINTER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_height (line: INTEGER): INTEGER
- do
- Result := 30
- end
- execute_hspan (line, column: INTEGER): INTEGER
- do
- Result := 1
- end
- execute_mouseclick (btn, prd, l, c, x, y: INTEGER; s: STRING): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_mousemotion (l, c, x, y: INTEGER; r: STRING): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_ncols: INTEGER
- do
- Result := 10
- end
- execute_nlines: INTEGER
- do
- Result := 10
- end
- execute_scrolling (l, c: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_vspan (l, c: INTEGER): INTEGER
- do
- Result := 1
- end
- execute_width (c: INTEGER): INTEGER
- do
- Result := 60
- end
- -- Color bar
- execute_cell (cell: INTEGER): TUPLE[INTEGER, INTEGER, INTEGER]
- do
- Result := [(0).to_integer_32, (0).to_integer_32, (0).to_integer_32]
- end
- execute_extended (cell: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_select (cell, type: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_switch (prim_cell, sec_cell: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Matrix
- execute_action_fniiiis (key, lin, col, edition: INTEGER; value: STRING): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_click_fniis (lin, col: INTEGER; status: STRING): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_colresize (col: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_release (lin, col: INTEGER; status: STRING): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_resizematrix (width, height: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_mousemove (lin, col: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_enteritem (lin, col: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_leaveitem (lin, col: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_scrolltop (lin, col: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_bgcolor (lin, col: INTEGER; red, green, blue: POINTER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_fgcolor (lin, col: INTEGER; red, green, blue: POINTER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_font (lin, col: INTEGER): STRING
- do
- Result := ""
- end
- execute_type (lin, col: INTEGER): STRING
- do
- Result := ""
- end
- execute_dropcheck (lin, col: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_translatevalue (lin, col: INTEGER; value: STRING): STRING
- do
- Result := ""
- end
- execute_togglevalue_fniii (lin, col, status: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_drop (drop: IUP_DROP; lin, col: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_menudrop (drop: IUP_DROP; lin, col: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_dropselect (lin, col: INTEGER; drop: IUP_DROP; t: STRING; i, v: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_edition (lin, col, mode, update: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_value (lin, col: INTEGER): STRING
- do
- Result := ""
- end
- execute_value_edit (lin, col: INTEGER; newval: STRING): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_mark (lin, col: INTEGER): INTEGER
- do
- Result := (0).to_integer_32
- end
- execute_markedit (lin, col, marked: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Flat tabs
- execute_flat_motion (x, y: INTEGER; status: STRING): STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Drop button
- execute_dropshow (state: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Dial
- execute_button_press (angle: REAL_64): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_button_release (angle: REAL_64): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_mousemove_fnd (angle: REAL_64): STRING
- do
- Result := "IUP_DEFAULT"
- end
- -- Color browser
- execute_change (red, green, blue: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- execute_drag (red, green, blue: INTEGER): STRING
- do
- Result := "IUP_DEFAULT"
- end
- feature {NONE}
- -- Internal
- set_widget (wgt: detachable POINTER)
- do
- if attached wgt as a_wgt then
- widget := a_wgt
- iup_open.set_widget_for_object (widget, Current)
- end
- end
- int_set_widget_name(name, wgt: POINTER): POINTER
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "return IupSetHandle ($name, $wgt);"
- end
- int_map(wgt: POINTER): INTEGER
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "return IupMap ($wgt);"
- end
- int_unmap(wgt: POINTER)
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "IupUnmap ($wgt);"
- 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.
|