1 (in-package #:clnl-gltk)
3 (defgeneric render (item)
9 ITEM: item to be rendered
14 RENDER is the entry point for rendering different items in the
17 RENDER will return the opengl world to the way it found it after
18 finishing, usually via just popping the matrix."))
20 (defgeneric resize (item width height)
22 "RESIZE ITEM WIDTH HEIGHT => RESULT
26 ITEM: item to be rendered
33 RESIZE is the general purpose resizing entry point for all widgets.
35 WIDTH and HEIGHT are contextual to the actual item being resized, and
36 may be even be ignored."))
38 (defgeneric reposition (item x y)
40 "REPOSITION ITEM X Y => RESULT
44 ITEM: item to be rendered
51 REPOSITION is the general purpose resizing entry point for all widgets.
53 X and Y are contextual to the actual item being repositioned, and
54 may be even be ignored."))
56 (defgeneric mousemove (item x y)
58 "MOUSEMOVE ITEM X Y => RESULT
62 ITEM: item handling event
69 MOUSEMOVE is the general purpose mousemove entry point for all widgets. It
70 is used to alert widgets to movements of the mouse, regardless of button state.
72 X and Y are absolute coordinates, and assumed to be opengl coordinates,
73 not window coordinates (meaning they match the render and setup functions
76 A catchall method that does nothing is also defined so that mouse functions
77 can loop over all available widgets and let them decide what they want to do."))
79 (defmethod mousemove (item x y))
81 (defgeneric mousedown (item x y)
83 "MOUSEDOWN ITEM X Y => RESULT
87 ITEM: item handling event
94 MOUSEDOWN is the general purpose mousedown entry point for all widgets. It
95 is used to alert widgets that a mouse button has been pressed, and where.
96 There's no information on which button has been pressed.
98 X and Y are absolute coordinates, and assumed to be opengl coordinates,
99 not window coordinates (meaning they match the render and setup functions
102 A catchall method that does nothing is also defined so that mouse functions
103 can loop over all available widgets and let them decide what they want to do."))
105 (defmethod mousedown (item x y))
107 (defgeneric mouseup (item x y)
109 "MOUSEUP ITEM X Y => RESULT
111 ARGUMENTS AND VALUES:
113 ITEM: item handling event
120 MOUSEUP is the general purpose mouseup entry point for all widgets. It
121 is used to alert widgets to that a mouse button has been released, and where.
122 There's no information on which button has been released, and it is
123 up to the widget to decide if a click was triggered.
125 X and Y are absolute coordinates, and assumed to be opengl coordinates,
126 not window coordinates (meaning they match the render and setup functions
129 A catchall method that does nothing is also defined so that mouse functions
130 can loop over all available widgets and let them decide what they want to do."))
132 (defmethod mouseup (item x y))
134 (defgeneric toggle (item &optional state)
136 "TOGGLE ITEM &optional STATE => NEW-STATE
138 ARGUMENTS AND VALUES:
141 STATE: a boolean, the state to set to
142 NEW-STATE: a boolean, the state after being set
146 TOGGLE toggles an ITEM.
148 Inverts the current toggle status of the ITEM if no STATE
149 passed in, otherwise sets to STATE."))
151 ; Stick utilities here for now
152 (defun draw-border (x1 y1 x2 y2 &optional (line-width 1f0))
154 ((offset (/ (1- line-width) 2)))
155 (gl:line-width line-width)
158 (gl:vertex (+ x2 offset) y1)
160 (gl:vertex x2 (+ y2 offset))
162 (gl:vertex (- x1 offset) y2)
164 (gl:vertex x1 (- y1 offset))