static const int nBitmaps
static const int nCursors
static const int nFonts
static const int nSamples
-
Number of skin data elements.
These define the number of bitmaps, cursors, fonts and samples in a
skin datafile:
nBitmaps = 46;
nCursors = 12;
nFonts = 8;
nSamples = 7;
nInfoItems = 13;
static const int nBitmapsEx
static const int nCursorsEx
static const int nFontsEx
static const int nSamplesEx
-
Sizes of data arrays.
These are the sizes of the bitmap, cursor, font and sample vectors.
The skin itself doesn't use the entire vectors, so all the space
above nBitmaps, nCursors, nFonts and nSamples in their respective
arrays can be used by the user. The array sizes are:
nBitmapsEx = 1024;
nCursorsEx = 64;
nFontsEx = 64;
nSamplesEx = 1024;
enum SkinBitmapIndex
-
Bitmap indices.
These are the indices of the skin bitmaps in the datafile and the
skins bitmap array. The possible values are as follows:
BOX
BOX_SHADOW
BUTTON
CHECKBOX
CLEAR_BACK
COMBO_BUTTON
HSLIDER_BACK
HSLIDER_GRIP
ICONEXIT
ICONMAX
ICONMIN
ICONRESTORE
LIST
MENU_BACK
MENU_BUTTON
MENU_ITEM
PANEL_GROOVE
PANEL_RAISED
PANEL_RIDGE
PANEL_SUNKEN
PROGRESSH
PROGRESSV
RADIO
SCROLL_DOWN
SCROLL_HBACK
SCROLL_HGRIP
SCROLL_HGRIPOVERLAY
SCROLL_LEFT
SCROLL_RIGHT
SCROLL_UP
SCROLL_VBACK
SCROLL_VGRIP
SCROLL_VGRIPOVERLAY
SEPARATORH
SEPARATORV
TAB_BUTTON
TAB_WINDOW
VSLIDER_BACK
VSLIDER_GRIP
WINBOTTOM
WINDOW
WINGRIP
WINLEFT
WINRIGHT
WINTEXT
WINTOP
XTRA_PALETTE
The last entry is the palette that is to be used for 8 bit mode.
enum SkinCursorIndex
-
Cursor indices.
These are the indices of the cursor bitmaps in the cursor datafile
and the cursor array. Possible values are as follows:
MOUSE_ALTERNATIVE
MOUSE_CROSSHAIR
MOUSE_HOURGLASS
MOUSE_MOVE
MOUSE_NORMAL
MOUSE_SELECT
MOUSE_SIZE_DIAGONAL1
MOUSE_SIZE_DIAGONAL2
MOUSE_SIZE_HORIZONTAL
MOUSE_SIZE_VERTICAL
MOUSE_TEXTSELECT
MOUSE_UNAVAILABLE
enum SkinSampleIndex
-
Sample indices.
These are the indices of the sound samples in the sample datafile
and the sample array. Possible values are as follows:
SAMPLE_ACTIVATE
SAMPLE_CLOSE
SAMPLE_GOTFOCUS
SAMPLE_KEY
SAMPLE_LOSTFOCUS
SAMPLE_OPEN
SAMPLE_SCROLL
enum SkinFontInfo
-
Font and color array indices.
These are the indices into the font and font color arrays within the
skin for each widget. Possible values are as follows:
INFO_BOX
INFO_BUTTON
INFO_CHECKBOX
INFO_RADIO
INFO_LIST
INFO_WINDOW
INFO_MENU
INFO_TEXT
INFO_EDITBOX
INFO_BAR
INFO_HYPER
INFO_TAB
INFO_TOOLTIP
enum SkinWidgetState
-
Object states.
These are the possible states each dialog object can be in. Every
object can have a different font and font color for each of these
states. Most of the skin bitmaps are divided into four subbitmaps,
one for each state. The possible states are as follows:
NORMAL - the normal idle state
SELECT - the widget is selected
DISABLE - the widget is disabled
FOCUS - the widget has input focus
std::vector<Bitmap *> bmpList
-
The array of bitmaps that are used to skin the dialog objects
std::vector<Cursor *> curList
-
The array of cursors used by the skin
std::vector<Font *> fntList
-
The array of fonts that can be used in the skin
std::vector<Sample *> smpList
-
The array of samples that are used by the skin
char* skinFilePath
-
Path to the file the skin was loaded from.
The skin saves the path to the skin file that was loaded in this
string. This allows the skin to be reloaded later if necessary.
virtual Error LoadData(const char* file)
-
Attempts to load all the skin bitmaps from a regular Allegro datafile.
If some bitmaps are missing old ones stay untouched.
virtual Error LoadCursors(const char* file)
-
Attempts to load the cursors in the same way as LoadData()
virtual Error LoadSamples(const char* file)
-
Attempts to load the samples in the same way as LoadData()
virtual void GenerateDefaultBitmaps()
-
Generate default skin bitmaps for all the dialog objects. These are
extremely ugly and shouldn't be viewed by anyone :) This function only
fails if it runs out of memory (unlikely).
virtual void GenerateDefaultBitmap(int i)
-
Generates the default bitmap in slot i of the bitmap array
virtual void GenerateDefaultSamples()
-
Destroys all samples and generates default empty ones
virtual void GenerateDefaultCursors()
-
Destroys all existing cursors and sets them to the default Allegro arrow
virtual void GenerateDefaultFonts()
-
Sets all the fonts in the font array to the default Allegro font
virtual void ResetColors()
-
Resets the default skin colors to the default values (a grayish green theme)
virtual void ResetControls()
-
Resets all the extra object info to default values
Skin(const char* fileName)
-
Default constructor.
Load the skin from a file. If the filename is NULL or reads "default",
then the default skin is generated instead of trying to load from a file.
The path must be an absolute one (as opposed to being relative)
virtual Error Load(const char* file)
-
Attempts to load a skin configuration file.
If the file exists it tries to read every possible bit of skin information.
If some data is missing it applies default values. This means that the old
skin is lost even if the file you're trying to load isn't a valid skin file.
Load() will also try to load the bitmaps, fonts, samples and cursors.
The file path you specify must be an absolute path. If you pass a relative
path, the function may fail.
virtual void Reload()
-
Attempts to reload the skin from the file that was last loaded
virtual void Unload()
-
Unloads the skin.
Frees all memory allocated for bitmaps, cursors, fonts and samples and unloads all
loaded datafiles. This is called by the destructor so you normally don't have to
care about it.
virtual void Reset()
-
Resets all skin data to default values.
This includes bitmaps, fonts, cursors, colors, etc.
Note: all user bitmaps, cursors and fonts will be lost too.
Error GetError()
Bitmap& GetBitmap(int i) const
-
Returns the bitmap from slot i of the bitmap array
Cursor& GetCursor(int i) const
-
Returns the cursor from slot i of the cursor array
Font& GetFont(int i) const
-
Returns the font from slot i of the font array
Sample& GetSample(int i) const
-
Returns the sample from slot i of the sample array
Error LoadBitmap(const char* file, int i)
-
Attempts to load a bitmap from a file on disk into slot i of the bitmap array.
This is usefull if you don't want to load your bitmaps from a regular Allegro
datafile or if you want to load additional bitmaps for some of your own widgets.
You can use as many slots in the bitmap array as defined here. The skin itself
uses nBitmaps slots so all the slots above that are at your disposal.
The bitmap has to be either in BMP, PCX or TGA format. Even if the new bitmap
can't be loaded the old one may be destroyed.
Error LoadCursor(const char* file, int i, int n = 1, int interval = 20)
-
The same as LoadBitmap() only this function loads mouse pointers. Pointers are
stored on disk as bitmaps in either BMP, PCX or TGA format. You must use the
Cursor::SetFocus() function to set your newly loaded cursor's focus point. The
optional parameters are the number of frames and the interval between frames in
miliseconds. They are relevant only if you're loading an animated cursor.
Error LoadFont(const char* file, int i, int size = 10)
-
Attempts to load a font into the font array. The last parameter is the size
(height) of the font that you are loading. Filename can be either relative or
absolute path to the font. If the font can't be found MASkinG will look into your
windows/fonts directory if it can find it. See Allegro Font documentation for a
list of supported font formats.
Error LoadSample(const char* file, int i)
-
Loads a sample in WAV or VOC format into the sample array
void SetBitmap(Bitmap& b, int i, bool copy = false)
-
Uploads the passed Bitmap into the bitmap array. The bitmap is loaded into slot i
of the array by either making a link to it (a pointer) or by copying the actual
data. If you make a copy you don't have to deal with destroying the data when it
is no longer needed as the skin will do it for you but if you just set a pointer
(the default) you have to destroy the bitmap yourself when you're done with your
program.
void SetCursor(Cursor& c, int i)
-
Like SetBitmap() only this one uploads a mouse cursor
void SetFont(Font& f, int i)
-
Uploads the passed font into the font array. It destroys the old font if it is
different form the Allegro font. This function is a little different from SetBitmap()
and SetCursor() as it can't copy the font, it just sets a pointer to the font data.
This means you must make sure the font you pass to this function remains valid for
the duration of the skin (i.e. you mustn't destroy it or close the datafile if it
was loaded from one).
void SetSample(Sample& s, int i, bool copy = false)
-
Like SetBitmap() only this one is for sound samples
void PlaySample(int i)
-
Attempts to play the sample in slot i of the sample array.
If any instances of the same sample are already playing they are stopped.
void Colorize(const Color &col, int alpha)
-
Reloads the skin and colorizes all the bitmaps to the specified color.
Alpha determines by how much the hue will shift towards the destination color.
It's range is [0,255]. 0 will keep the bitmaps unchanged, 255 will colorize
the bitmaps completely, any other value between 0 and 255 will let the original
colours show through a bit.
Color c_face
-
default color for boxes, menus, etc
Color c_font
-
default text color
Color c_shad1
-
the lighter shade of the colors used for 3D effects
Color c_shad2
-
the darker shade of the shadow colors
Color c_disable
-
the font color for disabled objects
Color c_select
-
the face color for selected objects
Color c_deselect
-
the default color for buttons, etc
Color c_focus
-
the face color for objects that have the input focus
Color c_sunken
-
the color for the sunken panel (for lists, edit boxes, etc)
Color c_back
-
the default desktop color
These colors are primarily used when no skin has been loaded from disk
or some bitmaps were missing. They may be used by MASkinG widgets as well
so every skin file has to specify them. If it doesn't then defaults are used.
int fnt[nInfoItems][4]
-
indices into the array of fonts
Color fcol[nInfoItems][4]
-
the primary text colors
Color scol[nInfoItems][4]
-
the secondary (shadow) text colors
These three arrays hold the font, color and shadow information for each widget
for each state. Actually only info for objects that require it is stored. The
possible states of objects are: normal, selected, disabled and focused.
int focus
-
How input focus follows the mouse.
Possible values are:
0 - objects will get focus when the mouse is on top of them and loose it
as soon as they loose the mouse
1 - objects get focus when they get the mouse but they can hold it until
another object takes it away
2 - focus will not follow the mouse, i.e. you have to click on an
object for it to get focus (like in Windows)
Default is 1.
int drawDots
-
Should widgets draw dotted rectangles?
If set to 1, objects that have the input focus should draw a dotted rectangle
around themselves.
int wallpaperStyle
-
the default style of the wallpaper widget
int buttonDisplacement
-
the displacement of the button text when selected (in pixels)
int buttonAnimationType
-
the type of animation used for buttons, checkboxes, etc
int buttonAnimationLength
-
the length of animation in miliseconds
int boxX
-
x offset of the group box title
int boxY
-
y offset of the group box title
int boxAlign
-
alignment of the box title text (left, right, centre)
Color boxBack
-
the background color of the group box title text (-1 is transparent)
Point winTextPos
-
the position of the title text
Point winExitPos
-
the position of the exit icon
Point winMaxPos
-
the position of the maximize icon
Point winMinPos
-
the position of the minimize icon
int winTextAlign
-
alignment of the title text
int winTextBack
-
true if the title text has a background false otherwise
int winAnimationType
-
the type of animation used to popup a window
int winAnimationLength
-
the length of animation in miliseconds
int comboAnimationType
-
the type of animation used for the list
int comboAnimationLength
-
the length of list animation in miliseconds
int menuHeight
-
the height of one menu entry
int menuDelay
-
the menu auto-open delay in miliseconds
int menuAnimationType
-
the type of menu animation
int menuAnimationLength
-
the length of menu animation in miliseconds
Color tooltipBack
-
the background colour for tooltips (pale yellow by default)
Color tooltipBorder
-
the border colour for tooltips (black by default)
int tooltipAnimationType
-
the tooltip animation type
int tooltipAnimationLength
-
the tooltip animation length