123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011 |
- class IUP_CANVAS
- inherit
- IUP_CONTAINER
- undefine
- execute_dragbegin,
- execute_dragdatasize,
- execute_dragdata,
- execute_dragend,
- execute_dropdata,
- execute_dropmotion
- redefine
- execute_map,
- execute_unmap,
- execute_destroy,
- execute_getfocus,
- execute_killfocus,
- execute_enterwindow,
- execute_leavewindow,
- execute_k_any,
- execute_help,
- execute_action_fnff,
- execute_focus,
- execute_motion,
- execute_keypress,
- execute_scroll,
- execute_wheel,
- execute_dropfiles,
- execute_resize,
- execute_button
- end
- IUP_WIDGET_BGCOLOR
- IUP_WIDGET_ACTIVE
- IUP_WIDGET_FONT
- IUP_WIDGET_EXPAND
- IUP_WIDGET_SCREENPOSITION
- IUP_WIDGET_POSITION
- IUP_WIDGET_MAXMIN_SIZE
- IUP_WIDGET_TIP
- IUP_WIDGET_SIZE
- IUP_WIDGET_RASTERSIZE
- IUP_WIDGET_USERSIZE
- IUP_WIDGET_ZORDER
- IUP_WIDGET_VISIBLE
- IUP_WIDGET_CHILD
- IUP_WIDGET_NAME
- IUP_WIDGET_FOCUS
- IUP_WIDGET_PROPAGATEFOCUS
- IUP_DRAG_AND_DROP
- IUP_WIDGET_CUSTOM_ATTRIBUTES
- create {ANY}
- canvas
- feature {ANY}
- canvas
-
- local
- a_canvas, p: detachable POINTER
- do
- a_canvas := int_create_canvas(p)
- set_widget(a_canvas)
- end
-
- get_cd_canvas: CD_IUP
- do
- Result := internal_canvas
- end
- get_front_cd_canvas: CD_IUP
- do
- Result := front_canvas
- end
-
- set_backing_store (state: BOOLEAN)
-
-
- do
- iup_open.set_attribute(Current, "BACKINGSTORE", boolean_to_yesno(state))
- end
- set_border (state: BOOLEAN)
-
- do
- iup_open.set_attribute(Current, "BORDER", boolean_to_yesno(state))
- end
- set_can_focus (state: BOOLEAN)
-
-
-
- do
- iup_open.set_attribute(Current, "CANFOCUS", boolean_to_yesno(state))
- end
-
- set_clip_rect (x1, y1, x2, y2: INTEGER)
-
-
-
- local
- str: STRING
- do
- str := x1.out
- str.append_string(" ")
- str.append_string(y1.out)
- str.append_string(" ")
- str.append_string(x2.out)
- str.append_string(" ")
- str.append_string(y2.out)
- iup_open.set_attribute(Current, "CLIPRECT", str)
- end
- set_cursor (name: STRING)
-
- do
- iup_open.set_attribute(Current, "CURSOR", name)
- end
- set_as_drop_files_target (state: BOOLEAN)
-
-
-
- do
- iup_open.set_attribute(Current, "DROPFILESTARGET", boolean_to_yesno(state))
- end
- get_draw_size: TUPLE[INTEGER, INTEGER]
-
-
-
-
- local
- size: STRING
- do
- size := iup_open.get_attribute(Current, "DRAWSIZE")
- Result := components_of_size(size)
- end
- set_scroll_bar (state: BOOLEAN)
-
-
-
- do
- iup_open.set_attribute(Current, "SCROLLBAR", boolean_to_yesno(state))
- end
-
- set_dx (dx: REAL)
-
-
- require
- dx >= 0
- do
- iup_open.set_attribute(Current, "DX", dx.out)
- end
- set_dy (dy: REAL)
-
-
- require
- dy >= 0
- do
- iup_open.set_attribute(Current, "DY", dy.out)
- end
- set_pos_x (pos: REAL)
-
- require
- pos >= 0
- do
- iup_open.set_attribute(Current, "POSX", pos.out)
- end
- set_pos_y (pos: REAL)
-
- require
- pos >= 0
- do
- iup_open.set_attribute(Current, "POSY", pos.out)
- end
- set_x_min (value: REAL)
-
- require
- value >= 0
- do
- iup_open.set_attribute(Current, "XMIN", value.out)
- end
- set_x_max (value: REAL)
-
- require
- value >= 0
- do
- iup_open.set_attribute(Current, "XMAX", value.out)
- end
- set_y_min (value: REAL)
-
- require
- value >= 0
- do
- iup_open.set_attribute(Current, "YMIN", value.out)
- end
- set_y_max (value: REAL)
-
- require
- value >= 0
- do
- iup_open.set_attribute(Current, "YMAX", value.out)
- end
- set_line_x (value: REAL)
-
-
- require
- value >= 0
- do
- iup_open.set_attribute(Current, "LINEX", value.out)
- end
- set_line_y (value: REAL)
-
-
- require
- value >= 0
- do
- iup_open.set_attribute(Current, "LINEY", value.out)
- end
- set_x_auto_hide (state: BOOLEAN)
-
-
- do
- iup_open.set_attribute(Current, "XAUTOHIDE", boolean_to_yesno(state))
- end
- set_y_auto_hide (state: BOOLEAN)
-
-
- do
- iup_open.set_attribute(Current, "YAUTOHIDE", boolean_to_yesno(state))
- end
-
-
-
-
-
- set_wheel_drop_focus (state: BOOLEAN)
-
-
- do
- iup_open.set_attribute(Current, "WHEELDROPFOCUS", boolean_to_yesno(state))
- end
-
-
- set_mdi_client (state: BOOLEAN)
-
-
-
-
- do
- iup_open.set_attribute(Current, "MDICLIENT", boolean_to_yesno(state))
- end
- set_mdi_menu (menu: STRING)
-
-
-
- do
- iup_open.set_attribute(Current, "MDIMENU", menu)
- end
-
-
- set_cb_map (act: detachable FUNCTION[TUPLE[IUP_CANVAS], STRING])
-
- local
- operation: INTEGER
- do
- cb_map := act
-
- if cb_map /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "MAP_CB", "NONEEDED", operation)
- end
- set_cb_unmap (act: detachable FUNCTION[TUPLE[IUP_CANVAS], STRING])
-
- local
- operation: INTEGER
- do
- cb_unmap := act
- if cb_unmap /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "UNMAP_CB", "NONEEDED", operation)
- end
- set_cb_destroy (act: detachable FUNCTION[TUPLE[IUP_CANVAS], STRING])
-
- local
- operation: INTEGER
- do
- cb_destroy := act
- if cb_destroy /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "DESTROY_CB", "NONEEDED", operation)
- end
- set_cb_get_focus (act: detachable FUNCTION[TUPLE[IUP_CANVAS], STRING])
-
-
-
-
- local
- operation: INTEGER
- do
- cb_getfocus := act
- if cb_getfocus /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "GETFOCUS_CB", "NONEEDED", operation)
- end
- set_cb_kill_focus (act: detachable FUNCTION[TUPLE[IUP_CANVAS], STRING])
-
-
-
- local
- operation: INTEGER
- do
- cb_killfocus := act
- if cb_killfocus /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "KILLFOCUS_CB", "NONEEDED", operation)
- end
- set_cb_enter_window (act: detachable FUNCTION[TUPLE[IUP_CANVAS], STRING])
-
- local
- operation: INTEGER
- do
- cb_enterwindow := act
- if cb_enterwindow /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "ENTERWINDOW_CB", "NONEEDED", operation)
- end
- set_cb_leave_window (act: detachable FUNCTION[TUPLE[IUP_CANVAS], STRING])
-
- local
- operation: INTEGER
- do
- cb_leavewindow := act
- if cb_leavewindow /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "LEAVEWINDOW_CB", "NONEEDED", operation)
- end
- set_cb_k_any (act: detachable FUNCTION[TUPLE[IUP_CANVAS, INTEGER], STRING])
-
-
-
-
-
-
-
-
-
-
-
- local
- operation: INTEGER
- do
- cb_k_any := act
- if cb_k_any /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "K_ANY", "NONEEDED", operation)
- end
- set_cb_help (act: detachable PROCEDURE[TUPLE[IUP_CANVAS]])
-
-
-
-
- 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
-
- set_cb_canvas_action (act: detachable FUNCTION[TUPLE[IUP_CANVAS, REAL_32, REAL_32], STRING])
-
- local
- operation: INTEGER
- do
- cb_canvas_action := act
- if cb_canvas_action /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "ACTION", "Fnff", operation)
- end
- set_cb_button (act: detachable FUNCTION[TUPLE[IUP_CANVAS, INTEGER, INTEGER, INTEGER, INTEGER, STRING], STRING])
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- local
- operation: INTEGER
- do
- cb_button := act
- if cb_button /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "BUTTON_CB", "NONEEDED", operation)
- end
- set_cb_drop_files (act: detachable FUNCTION[TUPLE[IUP_CANVAS, STRING, INTEGER, INTEGER, INTEGER], STRING])
-
-
-
-
- local
- operation: INTEGER
- do
- cb_dropfiles := act
- if cb_dropfiles /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "DROPFILES_CB", "NONEEDED", operation)
- end
- set_cb_focus (act: detachable FUNCTION[TUPLE[IUP_CANVAS, INTEGER], STRING])
-
-
-
-
-
- local
- operation: INTEGER
- do
- cb_focus := act
- if cb_focus /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "FOCUS_CB", "NONEEDED", operation)
- end
- set_cb_motion (act: detachable FUNCTION[TUPLE[IUP_CANVAS, INTEGER, INTEGER, STRING], STRING])
-
-
-
-
-
-
- local
- operation: INTEGER
- do
- cb_motion := act
- if cb_motion /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "MOTION_CB", "NONEEDED", operation)
- end
- set_cb_key_press (act: detachable FUNCTION[TUPLE[IUP_CANVAS, INTEGER, INTEGER], STRING])
-
-
-
-
-
-
-
-
-
-
- local
- operation: INTEGER
- do
- cb_keypress := act
- if cb_keypress /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "KEYPRESS_CB", "NONEEDED", operation)
- end
- set_cb_resize (act: detachable FUNCTION[TUPLE[IUP_CANVAS, INTEGER, INTEGER], STRING])
-
-
-
-
-
-
-
-
-
-
-
-
-
- local
- operation: INTEGER
- do
- cb_resize := act
- if cb_resize /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "RESIZE_CB", "NONEEDED", operation)
- end
- set_cb_scroll (act: detachable FUNCTION[TUPLE[IUP_CANVAS, INTEGER, REAL_32, REAL_32], STRING])
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- local
- operation: INTEGER
- do
- cb_scroll := act
- if cb_scroll /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "SCROLL_CB", "NONEEDED", operation)
- end
- set_cb_wheel (act: detachable FUNCTION[TUPLE[IUP_CANVAS, REAL_32, INTEGER, INTEGER, STRING], STRING])
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- local
- operation: INTEGER
- do
- cb_wheel := act
- if cb_wheel /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "WHEEL_CB", "NONEEDED", operation)
- end
-
-
- feature {IUP}
-
-
-
- execute_map: STRING
- do
- if attached cb_map as int_cb then
- Result := int_cb.item([Current])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_unmap: STRING
- do
- if attached cb_unmap as int_cb then
- Result := int_cb.item([Current])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_destroy: STRING
- do
- if attached cb_destroy as int_cb then
- Result := int_cb.item([Current])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_getfocus: STRING
- do
- if attached cb_getfocus as int_cb then
- Result := int_cb.item([Current])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_killfocus: STRING
- do
- if attached cb_killfocus as int_cb then
- Result := int_cb.item([Current])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_enterwindow: STRING
- do
- if attached cb_enterwindow as int_cb then
- Result := int_cb.item([Current])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_leavewindow: STRING
- do
- if attached cb_leavewindow as int_cb then
- Result := int_cb.item([Current])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_k_any (c: INTEGER): STRING
- do
- if attached cb_k_any as int_cb then
- Result := int_cb.item([Current, c])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_help
- do
- if attached cb_help as int_cb then
- int_cb.call([Current])
- end
- end
-
- execute_action_fnff (posx, posy: REAL_32): STRING
- do
- if attached cb_canvas_action as int_cb then
- Result := int_cb.item([Current, posx, posy])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_button (btn, pressed, x, y: INTEGER; status: STRING): STRING
- do
- if attached cb_button as int_cb then
- Result := int_cb.item([Current, btn, pressed, x, y, status])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_dropfiles (filename: STRING; num: INTEGER; x: INTEGER; y: INTEGER): STRING
- do
- if attached cb_dropfiles as int_cb then
- Result := int_cb.item([Current, filename, num, x, y])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_focus (focus: INTEGER): STRING
- do
- if attached cb_focus as int_cb then
- Result := int_cb.item([Current, focus])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_motion (x, y: INTEGER; status: STRING): STRING
- do
- if attached cb_motion as int_cb then
- Result := int_cb.item([Current, x, y, status])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_keypress (c, press: INTEGER): STRING
- do
- if attached cb_keypress as int_cb then
- Result := int_cb.item([Current, c, press])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_resize (width, height: INTEGER): STRING
- do
- if attached cb_resize as int_cb then
- Result := int_cb.item([Current, width, height])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_scroll (op: INTEGER; posx, posy: REAL_32): STRING
- do
- if attached cb_scroll as int_cb then
- Result := int_cb.item([Current, op, posx, posy])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_wheel (delta: REAL_32; x, y: INTEGER; status: STRING): STRING
- do
- if attached cb_wheel as int_cb then
- Result := int_cb.item([Current, delta, x, y, status])
- else
- Result := "IUP_DEFAULT"
- end
- end
- feature {CD_IUP}
-
- set_cd_canvas (cd: CD_IUP)
- do
- internal_canvas := cd
- end
- set_back_and_front_cd_canvas (back_cd: CD_IUP)
- local
- fcd: CD_IUP
- p: POINTER
- do
- internal_canvas := back_cd
- p := iup_open.get_attribute_ihandle(Current, "")
- create fcd.create_with_front_cd_canvas(p)
- front_canvas := fcd
- end
- feature {NONE}
-
- internal_canvas: CD_IUP
- attribute
- create Result.create_default
- end
- front_canvas: CD_IUP
- attribute
- create Result.create_default
- end
-
-
- cb_map: detachable FUNCTION[TUPLE[IUP_CANVAS], STRING]
- cb_unmap: detachable FUNCTION[TUPLE[IUP_CANVAS], STRING]
- cb_destroy: detachable FUNCTION[TUPLE[IUP_CANVAS], STRING]
- cb_getfocus: detachable FUNCTION[TUPLE[IUP_CANVAS], STRING]
- cb_killfocus: detachable FUNCTION[TUPLE[IUP_CANVAS], STRING]
- cb_enterwindow: detachable FUNCTION[TUPLE[IUP_CANVAS], STRING]
- cb_leavewindow: detachable FUNCTION[TUPLE[IUP_CANVAS], STRING]
- cb_k_any: detachable FUNCTION[TUPLE[IUP_CANVAS, INTEGER], STRING]
- cb_help: detachable PROCEDURE[TUPLE[IUP_CANVAS]]
-
- cb_canvas_action: detachable FUNCTION[TUPLE[IUP_CANVAS, REAL_32, REAL_32], STRING]
- cb_button: detachable FUNCTION[TUPLE[IUP_CANVAS, INTEGER, INTEGER, INTEGER, INTEGER, STRING], STRING]
- cb_dropfiles: detachable FUNCTION[TUPLE[IUP_CANVAS, STRING, INTEGER, INTEGER, INTEGER], STRING]
- cb_focus: detachable FUNCTION[TUPLE[IUP_CANVAS, INTEGER], STRING]
- cb_motion: detachable FUNCTION[TUPLE[IUP_CANVAS, INTEGER, INTEGER, STRING], STRING]
- cb_keypress: detachable FUNCTION[TUPLE[IUP_CANVAS, INTEGER, INTEGER], STRING]
- cb_resize: detachable FUNCTION[TUPLE[IUP_CANVAS, INTEGER, INTEGER], STRING]
- cb_scroll: detachable FUNCTION[TUPLE[IUP_CANVAS, INTEGER, REAL_32, REAL_32], STRING]
- cb_wheel: detachable FUNCTION[TUPLE[IUP_CANVAS, REAL_32, INTEGER, INTEGER, STRING], STRING]
-
- int_create_canvas (action: POINTER): POINTER
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "return IupCanvas ($action);"
- end
-
- end
|