// filename: Component.h // author: John Flores // date: May, 2003. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. #ifndef COMPONENT_H #define COMPONENT_H #include // This abstract class is the parent of most of the "visual" objects, such // as Textbox, Listbox, etc. Mostly it provides a means of communication // between objects via the "notify" method. class Component { protected: struct key { enum { CTRL_A = 01, CTRL_B, CTRL_C, CTRL_D, CTRL_E, CTRL_F, CTRL_G, CTRL_H, CTRL_I, CTRL_J, CTRL_K, CTRL_L, CTRL_M, CTRL_N, CTRL_O, CTRL_P, CTRL_Q, CTRL_R, CTRL_S, CTRL_T, CTRL_U, CTRL_V, CTRL_W, CTRL_X, CTRL_Y, CTRL_Z }; enum { #ifdef __GNUC__ TAB = 0011, ENTER = 0012, ESCAPE = 0033, DELETE_ASCII = 0177, DOWN = KEY_DOWN, UP = KEY_UP, LEFT = KEY_LEFT, RIGHT = KEY_RIGHT, HOME = KEY_HOME, BACKSPACE = KEY_BACKSPACE, F1 = KEY_F(1), F2 = KEY_F(2), F3 = KEY_F(3), F4 = KEY_F(4), F5 = KEY_F(5), F6 = KEY_F(6), F7 = KEY_F(7), F8 = KEY_F(8), F9 = KEY_F(9), F10 = KEY_F(10), F11 = KEY_F(11), F12 = KEY_F(12), DELETE = KEY_DC, INSERT = KEY_IC, PAGEDOWN = KEY_NPAGE, PAGEUP = KEY_PPAGE, END = KEY_END #else BACKSPACE = 0010, TAB = 0011, ENTER = 0012, ESCAPE = 0033, DELETE_ASCII = 0177, DOWN = KEY_DOWN, UP = KEY_UP, LEFT = KEY_LEFT, RIGHT = KEY_RIGHT, HOME = KEY_HOME, F1 = KEY_F(1), F2 = KEY_F(2), F3 = KEY_F(3), F4 = KEY_F(4), F5 = KEY_F(5), F6 = KEY_F(6), F7 = KEY_F(7), F8 = KEY_F(8), F9 = KEY_F(9), F10 = KEY_F(10), F11 = KEY_F(11), F12 = KEY_F(12), DELETE = KEY_DC, PAGEDOWN = KEY_NPAGE, PAGEUP = KEY_PPAGE, END = KEY_END #endif }; }; Component *parent; public: virtual void notify(Component *who) = 0; }; #endif