Class: SDL2::Event::Window

Inherits:
SDL2::Event show all
Defined in:
ext/sdl2_ext/event.c,
lib/sdl2/event.rb,
ext/sdl2_ext/event.c

Overview

This class represents window event. This type of event occurs when window state is changed.

Instance Attribute Summary collapse

Attributes inherited from SDL2::Event

#timestamp, #type

Instance Method Summary collapse

Methods inherited from SDL2::Event

enable=, enabled?, poll, #window

Instance Attribute Details

#data1Integer

event dependent data

Returns:

  • (Integer)

#data2Integer

event dependent data

Returns:

  • (Integer)

#eventInteger

event type, one of the following:

  • SDL2::Event::Window::NONE - (never used)

  • SDL2::Event::Window::SHOWN - window has been shown

  • SDL2::Event::Window::HIDDEN - window has been hidden

  • SDL2::Event::Window::EXPOSED - window has been exposed and should be redrawn

  • SDL2::Event::Window::MOVED - window has been moved to data1, data2

  • SDL2::Event::Window::RESIZED - window has been resized to data1xdata2;

    this is event is always preceded by SIZE_CHANGED
    
  • SDL2::Event::Window::SIZE_CHANGED -

    window size has changed, either as a result of an API call or through
    the system or user changing the window size;
    this event is followed by
    RESIZED if the size was changed by an external event,
    i.e. the user or the window manager
    
  • SDL2::Event::Window::MINIMIZED - window has been minimized

  • SDL2::Event::Window::MAXIMIZED - window has been maximized

  • SDL2::Event::Window::RESTORED - window has been restored to normal size and position

  • SDL2::Event::Window::ENTER - window has gained mouse focus

  • SDL2::Event::Window::LEAVE - window has lost mouse focus

  • SDL2::Event::Window::FOCUS_GAINED - window has gained keyboard focus

  • SDL2::Event::Window::FOCUS_LOST -window has lost keyboard focus

  • SDL2::Event::Window::CLOSE -

    the window manager requests that the window be closed
    

Returns:

  • (Integer)

#window_idInteger

the associate window id

Returns:

  • (Integer)

Instance Method Details

#inspectString

Returns inspection string.

Returns:

  • (String)

    inspection string



305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
# File 'ext/sdl2_ext/event.c', line 305

def inspect
	# TODO: this is compressible with a dyanmic filled hash
	event_inspect =
		case event
		when NONE then "NONE"
		when SHOWN then "SHOWN"
		when HIDDEN then "HIDDEN"
		when EXPOSED then "EXPOSED"
		when MOVED then "MOVED(#{data1}, #{data2})"
		when RESIZED then "RESIZED(#{data1}, #{data2})"
		when SIZE_CHANGED then "SIZE_CHANGED(#{data1}, #{data2})"
		when MINIMIZED then "MINIMIZED"
		when MAXIMIZED then "MAXIMIZED"
		when RESTORED then "RESTORED"
		when ENTER then "ENTER"
		when LEAVE then "LEAVE"
		when FOCUS_GAINED then "FOCUS_GAINED"
		when FOCUS_LOST then "FOCUS_LOST"
		when CLOSE then "CLOSE"
		else "UNKNOWN(#{event})(#{data1}, #{data2})"
		end

	"<#{self.class.inspect}: " \
		"timestamp=#{timestamp.inspect} " \
		"window_id=#{window_id.inspect} " \
		"event=#{event_inspect}>"
end