Info
Get involved
Documentation
00001 /* 00002 SAL - Simple Application Library 00003 Copyright (C) 2006-2006 Kronon 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the Free Software 00017 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 00019 Kronon 00020 kronon88@users.sourceforge.net 00021 */ 00022 00023 //SAL gui objects 00024 //Created by Kronon 00025 00026 #ifndef SAL_GUI_OBJECTS_H 00027 #define SAL_GUI_OBJECTS_H 00028 00029 struct SAL_gui_functions; 00030 00031 //Object class 00032 struct SAL_gui_object 00033 { 00034 public: 00035 int id; 00036 int x; //X position 00037 int y; //Y position 00038 int w; //Width 00039 int h; //Height 00040 SDL_Surface *surface; //Graphical image that represents the object 00041 SAL_gui_functions *func; 00042 }; 00043 00044 //References to functions that the object uses 00045 struct SAL_gui_functions 00046 { 00047 int (*pressed)(SAL_gui_object*); //Object is pressed 00048 int (*released)(SAL_gui_object*); //Object is released 00049 int (*key_down)(SAL_gui_object*,SDLKey, SDLMod); //Key stroke 00050 00051 }; 00052 00053 struct SAL_button 00054 { 00055 //Same as any basic gui object 00056 public: 00057 SAL_gui_object std; //Standart gui variables 00058 //Graphical properties 00059 TTF_Font* font; //Font of the text 00060 SDL_Color fgcolor; //Color of the text 00061 Uint32 bgcolor; //Color of the background 00062 //TODO: Fast key for button 00063 }; 00064 00065 struct SAL_input_box 00066 { 00067 //Same as any basic gui object 00068 public: 00069 SAL_gui_object std; //Standart gui variables 00070 //Graphical properties 00071 TTF_Font* font; //Font of the text 00072 SDL_Color fgcolor; //Color of the text 00073 Uint32 bgcolor; //Color of the background 00074 string *value; 00075 }; 00076 00077 struct SAL_GuiContainer 00078 { 00079 //WARNING: WOLF IN SHEEPS CLOTHS structures are in real gui structures like SAL_button thoudh the variables of SAL_gui_object 00080 // are accesable 00081 SAL_gui_object *objects[1000]; 00082 int last_id; 00083 salList<int> free; 00084 }; 00085 00086 #endif