-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcheerilee-classes.el
151 lines (134 loc) · 4.72 KB
/
cheerilee-classes.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
;;; cheerilee-classes.el --- Classes definitions -*- mode: emacs-lisp -*-
;; Copyright (C) 2015 Alessio Vanni
;; Author: Alessio Vanni <[email protected]>
;; Created: December 2015
;; This file is not part of GNU Emacs.
;; Cheerilee is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; Cheerilee 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 General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; This file provides the definitions of the objects used by
;; the library.
;;; Code:
(defclass cheerilee-control ()
((location :initarg :location
:initform (0 . 0)
:type cons
:documentation "The control's location.")
(id :type number
:protection :protected
:documentation "The control's id.")
(frame :type number
:protection :protected
:documentation "The frame that contains the control.")
(background :initarg :background
:initform "white"
:type string
:documentation "The control's background color.")
(foreground :initarg :foreground
:initform "black"
:type string
:documentation "The control's foreground color.")
(clip-region :initform ()
:type list
:protection :protected
:documentation "The control's clip region.")
(button-press :initform ()
:type list
:documentation "Mouse Button Press event handling functions.")
(button-rel :initform ()
:type list
:documentation "Mouse Button Release event handling functions.")
(key-press :initform ()
:type list
:documentation "Key Button Press event handling functions.")
(key-release :initform ()
:type list
:documentation "Key Button Release event handling functions.")
(motion-note :initform ()
:type list
:documentation "Motion Notify event handling functions.")
(capture :initform nil
:type nil
:documentation "If the Pointer has been captured by an event."))
:documentation "Base class for every graphical control."
:abstract t)
(defclass cheerilee-bordered-area (cheerilee-control)
((size :initarg :size
:initform (100 . 100)
:type cons
:documentation "The control's size.")
(line-width :initarg :line-width
:initform 1
:type number
:documentation "The control's line width.")
(list :type list
:protection :protected
:documentation "A list of rectangles to draw."))
:documentation "Base class for graphical controls with a border."
:abstract t)
(defclass cheerilee-with-text (cheerilee-control)
((font-id :type number
:protection :protected
:documentation "The control's font id.")
(font :initarg :font
:initform "7x14"
:type string
:documentation "The control's font for text.")
(text-prop :type list
:protection :protected
:documentation "Text properties.")
(txt-rend :initform nil
:type symbol
:protection :protected
:documentation "Has the text field been rendered at least once?")
(text :initarg :text
:initform ""
:type string
:documentation "Text to be displayed."))
:documentation "Base class for graphical controls with text in them."
:abstract t)
(defclass cheerilee-frame (cheerilee-control)
((size :initarg :size
:initform (320 . 240)
:type cons
:documentation "The frame's size.")
(name :initarg :name
:initform "Application"
:type string
:documentation "The frame's name.")
(open :initarg :open
:initform nil
:type symbol
:protection :private
:documentation "Has the frame been mapped at least once?")
(cursor :type number
:documentation "The cursor ID.")
(cursor-color :initarg :cursor-color
:initform "black"
:type string
:documentation "The cursor color."))
:documentation "A frame control.")
(defclass cheerilee-window (cheerilee-bordered-area cheerilee-with-text)
()
:documentation "A window control.")
(defclass cheerilee-button (cheerilee-window)
()
:documentation "A button control.")
(defclass cheerilee-text (cheerilee-with-text)
()
:documentation "An element displaying some text.")
(defclass cheerilee-textbox (cheerilee-bordered-area cheerilee-with-text)
((selected :initform nil
:type symbol
:documentation "If the textbox was selected by the user."))
:documentation "An element in which is possible to write text.")
(provide 'cheerilee-classes)
;;; cheerilee-classes.el ends here