-- EWS (Eiffel Windowing System) - A small OO windowing system -- Copyright (C) 2004 Daniel F. Moisset, Anthony Lenton -- -- This library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Library General Public -- License as published by the Free Software Foundation; either -- version 2 of the License, or (at your option) any later version. -- -- This library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Library General Public License for more details. -- -- You should have received a copy of the GNU Library General Public -- License along with this library; if not, write to the -- Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- Boston, MA 02111-1307 USA. -- -- Author's email: dmoisset@grulic.org.ar -- Snail mail address: Pirovano 196, 5000 Cordoba, Argentina -- class ENTRY_TEST create make feature {NONE} -- Creation d: DISPLAY e1, e2: TEXT_ENTRY new_img (fn: STRING): IMAGE is do create {SDL_IMAGE}Result.make_from_file (fn) end make is local r: RECTANGLE c: MOUSE_POINTER sdl: SDL i: IMAGE w: WINDOW f: SDL_BITMAP_FONT do -- Init video create {SDL_DISPLAY}d.make (640,480, 16, False) -- Set Pointer create c.make (new_img ("cursor1.png"), 6, 4) d.root.set_pointer (c) -- Background create {SDL_IMAGE}i.make_from_file ("entry.png") create {WINDOW_IMAGE}w.make (d.root, 20, 20, i) create {WINDOW_IMAGE}w.make (d.root, 20, 50, i) create f.make ("default_font.png") r.set_with_size (20, 20, 124, 24) create e1.make (d.root, r) e1.set_font (f) e1.set_border_size (5) r.set_with_size (20, 50, 124, 24) create e2.make (d.root, r) e2.set_font (f) e2.set_border_size (5) e1.set_next_in_tab_order (e2) e1.set_default_action(agent e2.grab) e2.set_next_in_tab_order (e1) e2.set_default_action(agent print_contents) sdl.enable_keyboard_repeat (250, 50) e1.grab -- Main loop d.do_event_loop d.close rescue if d /= Void then d.close end end print_contents is do print (e1.text + "%N") print (e2.text + "%N%N") end end -- class ENTRY_TEST