Planeshift
|
00001 /* 00002 * pawsborder.h - Author: Andrew Craig 00003 * 00004 * Copyright (C) 2003 Atomic Blue ([email protected], http://www.atomicblue.org) 00005 * 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation (version 2 of the License) 00010 * This program 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 00013 * GNU General Public License for more details. 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 * 00018 */ 00019 // pawsborder.h: interface for the pawsBorder class. 00020 // 00022 00023 #ifndef PAWS_BORDER_HEADER 00024 #define PAWS_BORDER_HEADER 00025 00026 #include <ivideo/graph2d.h> 00027 #include <csgeom/csrectrg.h> 00028 #include "pawswidget.h" 00029 00034 00035 // Function Declarations 00037 void DrawBumpFrame(iGraphics2D* graphics2D, 00038 pawsWidget* widget, 00039 csRect frame, int flags); 00040 00042 00043 00044 // A list of the border image positions 00045 enum BorderPositions 00046 { 00047 PAWS_BORDER_TOPLEFT, 00048 PAWS_BORDER_TOPRIGHT, 00049 PAWS_BORDER_BOTTOMLEFT, 00050 PAWS_BORDER_BOTTOMRIGHT, 00051 PAWS_BORDER_LEFTMIDDLE, 00052 PAWS_BORDER_RIGHTMIDDLE, 00053 PAWS_BORDER_TOPMIDDLE, 00054 PAWS_BORDER_BOTTOMMIDDLE, 00055 PAWS_BORDER_MAX 00056 }; 00057 00058 00063 struct BorderDefinition 00064 { 00066 csString name; 00067 00069 csString descriptions[PAWS_BORDER_MAX]; 00070 }; 00071 00078 class pawsBorder 00079 { 00080 public: 00081 pawsBorder(const char* styleName); 00082 pawsBorder(const pawsBorder &origin); 00083 ~pawsBorder(); 00084 00085 void SetParent(pawsWidget* parent); 00086 void Draw(); 00092 void UseBorder(const char* style); 00093 00095 void JustTitle() 00096 { 00097 justTitle = true; 00098 } 00099 00100 void Hide() 00101 { 00102 draw = false; 00103 } 00104 void Show() 00105 { 00106 draw = true; 00107 } 00108 csRect GetRect(); 00109 00110 void SetTitle(const char* t, bool shadow = true); 00111 void SetTitleImage(iPawsImage* drawable) 00112 { 00113 titleImage = drawable; // This will take delete responsibility 00114 } 00115 void SetTitleAlign(int al) 00116 { 00117 align = al; 00118 } 00119 00120 iPawsImage* GetTitleImage() 00121 { 00122 return titleImage; 00123 } 00124 const char* GetTitle() 00125 { 00126 return title; 00127 } 00128 00129 protected: 00130 00131 void DrawTitle(csRect &frame); 00132 void DrawFrame(csRect frame); 00133 00134 csRect frame; 00135 pawsWidget* parent; 00136 00137 csRef<iPawsImage> borderImages[PAWS_BORDER_MAX]; 00138 00140 csString title; 00142 csRef<iPawsImage> titleImage; 00144 int align; 00145 00146 bool usingGraphics; 00147 bool draw; 00148 bool justTitle; 00149 int style; 00150 bool shadowFont; 00151 }; 00152 00155 #endif 00156 00157