| 1 |
/* |
| 2 |
Copyright (C) 2002 Kai Sterker <[email protected]> |
| 3 |
Part of the Adonthell Project <http://adonthell.nongnu.org> |
| 4 |
|
| 5 |
Dlgedit is free software; you can redistribute it and/or modify |
| 6 |
it under the terms of the GNU General Public License as published by |
| 7 |
the Free Software Foundation; either version 2 of the License, or |
| 8 |
(at your option) any later version. |
| 9 |
|
| 10 |
Dlgedit is distributed in the hope that it will be useful, |
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
GNU General Public License for more details. |
| 14 |
|
| 15 |
You should have received a copy of the GNU General Public License |
| 16 |
along with Dlgedit. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
*/ |
| 18 |
|
| 19 |
/** |
| 20 |
* @file gui_resources.h |
| 21 |
* |
| 22 |
* @author Kai Sterker |
| 23 |
* @brief Provides fonts and colors used throughout dlgedit. |
| 24 |
*/ |
| 25 |
|
| 26 |
#ifndef GUI_RESOURCES_H |
| 27 |
#define GUI_RESOURCES_H |
| 28 |
|
| 29 |
#include <pango/pango.h> |
| 30 |
#include <gtk/gtk.h> |
| 31 |
#include "dlg_types.h" |
| 32 |
|
| 33 |
/** |
| 34 |
* This class provides some fonts and pens that are used throughout |
| 35 |
* dlgedit. Instead of creating the newly each time something needs |
| 36 |
* to be drawn, they are created once when the program starts. |
| 37 |
*/ |
| 38 |
class GuiResources |
| 39 |
{ |
| 40 |
public: |
| 41 |
/** |
| 42 |
* Create all the fonts and colors needed. |
| 43 |
* @param widget the widget we later draw to |
| 44 |
*/ |
| 45 |
static void init (GtkWidget *widget); |
| 46 |
|
| 47 |
/** |
| 48 |
* Retrieve a colored 'pen' to draw onto a drawing area. |
| 49 |
* @param color the color to retrieve |
| 50 |
* @return a GdkColor. |
| 51 |
*/ |
| 52 |
static const GdkColor *getColor (int color); |
| 53 |
/** |
| 54 |
* Retrieve a colored 'pen' to draw onto a drawing area, depending |
| 55 |
* on the given mode and type. |
| 56 |
* @param mode the mode of a DlgNode |
| 57 |
* @param type the type of a DlgNode |
| 58 |
* @return a GdkColor. |
| 59 |
*/ |
| 60 |
static const GdkColor *getColor (mode_type mode, node_type type); |
| 61 |
/** |
| 62 |
* Retrieve a color to fill drawn objects on a drawing area, |
| 63 |
* depending on the given mode and type. |
| 64 |
* @param mode the mode of a DlgNode |
| 65 |
* @param type the type of a DlgNode |
| 66 |
* @return a GdkColor. |
| 67 |
*/ |
| 68 |
static const GdkColor *getFill (mode_type mode, node_type type); |
| 69 |
/** |
| 70 |
* Retrieve the font used to draw text onto a drawing area. |
| 71 |
* @return a PangoLayout. |
| 72 |
*/ |
| 73 |
static PangoLayout *font () { return Font; } |
| 74 |
|
| 75 |
private: |
| 76 |
static PangoLayout *Font; // font for text-output |
| 77 |
static GdkColor Color[MAX_GC]; // custom colors |
| 78 |
}; |
| 79 |
|
| 80 |
#endif // GUI_RESOURCES_H |