class MASKING_DLL_DECLSPEC Skin

The skin class.

Public Fields

[more]static const int nBitmaps
[more]static const int nCursors
[more]static const int nFonts
[more]static const int nSamples
Number of skin data elements.
[more]static const int nBitmapsEx
[more]static const int nCursorsEx
[more]static const int nFontsEx
[more]static const int nSamplesEx
Sizes of data arrays.
[more]Color c_face
default color for boxes, menus, etc
[more]Color c_font
default text color
[more]Color c_shad1
the lighter shade of the colors used for 3D effects
[more]Color c_shad2
the darker shade of the shadow colors
[more]Color c_disable
the font color for disabled objects
[more]Color c_select
the face color for selected objects
[more]Color c_deselect
the default color for buttons, etc
[more]Color c_focus
the face color for objects that have the input focus
[more]Color c_sunken
the color for the sunken panel (for lists, edit boxes, etc)
[more]Color c_back
the default desktop color
[more]int fnt[nInfoItems][4]
indices into the array of fonts
[more]Color fcol[nInfoItems][4]
the primary text colors
[more]Color scol[nInfoItems][4]
the secondary (shadow) text colors
[more]int focus
How input focus follows the mouse.
[more]int drawDots
Should widgets draw dotted rectangles?
[more]int wallpaperStyle
the default style of the wallpaper widget
[more]int buttonDisplacement
the displacement of the button text when selected (in pixels)
[more]int buttonAnimationType
the type of animation used for buttons, checkboxes, etc
[more]int buttonAnimationLength
the length of animation in miliseconds
[more]int boxX
x offset of the group box title
[more]int boxY
y offset of the group box title
[more]int boxAlign
alignment of the box title text (left, right, centre)
[more]Color boxBack
the background color of the group box title text (-1 is transparent)
[more]Point winTextPos
the position of the title text
[more]Point winExitPos
the position of the exit icon
[more]Point winMaxPos
the position of the maximize icon
[more]Point winMinPos
the position of the minimize icon
[more]int winTextAlign
alignment of the title text
[more]int winTextBack
true if the title text has a background false otherwise
[more]int winAnimationType
the type of animation used to popup a window
[more]int winAnimationLength
the length of animation in miliseconds
[more]int comboAnimationType
the type of animation used for the list
[more]int comboAnimationLength
the length of list animation in miliseconds
[more]int menuHeight
the height of one menu entry
[more]int menuDelay
the menu auto-open delay in miliseconds
[more]int menuAnimationType
the type of menu animation
[more]int menuAnimationLength
the length of menu animation in miliseconds
[more]Color tooltipBack
the background colour for tooltips (pale yellow by default)
[more]Color tooltipBorder
the border colour for tooltips (black by default)
[more]int tooltipAnimationType
the tooltip animation type
[more]int tooltipAnimationLength
the tooltip animation length

Public Methods

[more] Skin(const char* fileName)
Default constructor.
[more]virtual Error Load(const char* file)
Attempts to load a skin configuration file.
[more]virtual void Reload()
Attempts to reload the skin from the file that was last loaded
[more]virtual void Unload()
Unloads the skin.
[more]virtual void Reset()
Resets all skin data to default values.
[more]Error GetError()
[more]Bitmap& GetBitmap(int i) const
Returns the bitmap from slot i of the bitmap array
[more]Cursor& GetCursor(int i) const
Returns the cursor from slot i of the cursor array
[more]Font& GetFont(int i) const
Returns the font from slot i of the font array
[more]Sample& GetSample(int i) const
Returns the sample from slot i of the sample array
[more]Error LoadBitmap(const char* file, int i)
Attempts to load a bitmap from a file on disk into slot i of the bitmap array.
[more]Error LoadCursor(const char* file, int i, int n = 1, int interval = 20)
The same as LoadBitmap() only this function loads mouse pointers.
[more]Error LoadFont(const char* file, int i, int size = 10)
Attempts to load a font into the font array.
[more]Error LoadSample(const char* file, int i)
Loads a sample in WAV or VOC format into the sample array
[more]void SetBitmap(Bitmap& b, int i, bool copy = false)
Uploads the passed Bitmap into the bitmap array.
[more]void SetCursor(Cursor& c, int i)
Like SetBitmap() only this one uploads a mouse cursor
[more]void SetFont(Font& f, int i)
Uploads the passed font into the font array.
[more]void SetSample(Sample& s, int i, bool copy = false)
Like SetBitmap() only this one is for sound samples
[more]void PlaySample(int i)
Attempts to play the sample in slot i of the sample array.
[more]void Colorize(const Color &col, int alpha)
Reloads the skin and colorizes all the bitmaps to the specified color.

Public Members

[more]enum SkinBitmapIndex
Bitmap indices.
[more]enum SkinCursorIndex
Cursor indices.
[more]enum SkinSampleIndex
Sample indices.
[more]enum SkinFontInfo
Font and color array indices.
[more]enum SkinWidgetState
Object states.

Protected Fields

[more]std::vector<Bitmap *> bmpList
The array of bitmaps that are used to skin the dialog objects
[more]std::vector<Cursor *> curList
The array of cursors used by the skin
[more]std::vector<Font *> fntList
The array of fonts that can be used in the skin
[more]std::vector<Sample *> smpList
The array of samples that are used by the skin
[more]char* skinFilePath
Path to the file the skin was loaded from.

Protected Methods

[more]virtual Error LoadData(const char* file)
Attempts to load all the skin bitmaps from a regular Allegro datafile.
[more]virtual Error LoadCursors(const char* file)
Attempts to load the cursors in the same way as LoadData()
[more]virtual Error LoadSamples(const char* file)
Attempts to load the samples in the same way as LoadData()
[more]virtual void GenerateDefaultBitmaps()
Generate default skin bitmaps for all the dialog objects.
[more]virtual void GenerateDefaultBitmap(int i)
Generates the default bitmap in slot i of the bitmap array
[more]virtual void GenerateDefaultSamples()
Destroys all samples and generates default empty ones
[more]virtual void GenerateDefaultCursors()
Destroys all existing cursors and sets them to the default Allegro arrow
[more]virtual void GenerateDefaultFonts()
Sets all the fonts in the font array to the default Allegro font
[more]virtual void ResetColors()
Resets the default skin colors to the default values (a grayish green theme)
[more]virtual void ResetControls()
Resets all the extra object info to default values


Documentation

The skin class. Used to store all the data that descriebes a skin: bitmaps, fonts, cursors, colors, etc.
ostatic const int nBitmaps

ostatic const int nCursors

ostatic const int nFonts

ostatic 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;

ostatic const int nBitmapsEx

ostatic const int nCursorsEx

ostatic const int nFontsEx

ostatic 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;

oenum 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.

oenum 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

oenum 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

oenum 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

oenum 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

ostd::vector<Bitmap *> bmpList
The array of bitmaps that are used to skin the dialog objects

ostd::vector<Cursor *> curList
The array of cursors used by the skin

ostd::vector<Font *> fntList
The array of fonts that can be used in the skin

ostd::vector<Sample *> smpList
The array of samples that are used by the skin

ochar* 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.

ovirtual 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.

ovirtual Error LoadCursors(const char* file)
Attempts to load the cursors in the same way as LoadData()

ovirtual Error LoadSamples(const char* file)
Attempts to load the samples in the same way as LoadData()

ovirtual 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).

ovirtual void GenerateDefaultBitmap(int i)
Generates the default bitmap in slot i of the bitmap array

ovirtual void GenerateDefaultSamples()
Destroys all samples and generates default empty ones

ovirtual void GenerateDefaultCursors()
Destroys all existing cursors and sets them to the default Allegro arrow

ovirtual void GenerateDefaultFonts()
Sets all the fonts in the font array to the default Allegro font

ovirtual void ResetColors()
Resets the default skin colors to the default values (a grayish green theme)

ovirtual void ResetControls()
Resets all the extra object info to default values

o 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)

ovirtual 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.

ovirtual void Reload()
Attempts to reload the skin from the file that was last loaded

ovirtual 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.

ovirtual 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.

oError GetError()

oBitmap& GetBitmap(int i) const
Returns the bitmap from slot i of the bitmap array

oCursor& GetCursor(int i) const
Returns the cursor from slot i of the cursor array

oFont& GetFont(int i) const
Returns the font from slot i of the font array

oSample& GetSample(int i) const
Returns the sample from slot i of the sample array

oError 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.

oError 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.

oError 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.

oError LoadSample(const char* file, int i)
Loads a sample in WAV or VOC format into the sample array

ovoid 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.

ovoid SetCursor(Cursor& c, int i)
Like SetBitmap() only this one uploads a mouse cursor

ovoid 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).

ovoid SetSample(Sample& s, int i, bool copy = false)
Like SetBitmap() only this one is for sound samples

ovoid 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.

ovoid 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.

oColor c_face
default color for boxes, menus, etc

oColor c_font
default text color

oColor c_shad1
the lighter shade of the colors used for 3D effects

oColor c_shad2
the darker shade of the shadow colors

oColor c_disable
the font color for disabled objects

oColor c_select
the face color for selected objects

oColor c_deselect
the default color for buttons, etc

oColor c_focus
the face color for objects that have the input focus

oColor c_sunken
the color for the sunken panel (for lists, edit boxes, etc)

oColor 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.

oint fnt[nInfoItems][4]
indices into the array of fonts

oColor fcol[nInfoItems][4]
the primary text colors

oColor 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.

oint 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.

oint drawDots
Should widgets draw dotted rectangles? If set to 1, objects that have the input focus should draw a dotted rectangle around themselves.

oint wallpaperStyle
the default style of the wallpaper widget

oint buttonDisplacement
the displacement of the button text when selected (in pixels)

oint buttonAnimationType
the type of animation used for buttons, checkboxes, etc

oint buttonAnimationLength
the length of animation in miliseconds

oint boxX
x offset of the group box title

oint boxY
y offset of the group box title

oint boxAlign
alignment of the box title text (left, right, centre)

oColor boxBack
the background color of the group box title text (-1 is transparent)

oPoint winTextPos
the position of the title text

oPoint winExitPos
the position of the exit icon

oPoint winMaxPos
the position of the maximize icon

oPoint winMinPos
the position of the minimize icon

oint winTextAlign
alignment of the title text

oint winTextBack
true if the title text has a background false otherwise

oint winAnimationType
the type of animation used to popup a window

oint winAnimationLength
the length of animation in miliseconds

oint comboAnimationType
the type of animation used for the list

oint comboAnimationLength
the length of list animation in miliseconds

oint menuHeight
the height of one menu entry

oint menuDelay
the menu auto-open delay in miliseconds

oint menuAnimationType
the type of menu animation

oint menuAnimationLength
the length of menu animation in miliseconds

oColor tooltipBack
the background colour for tooltips (pale yellow by default)

oColor tooltipBorder
the border colour for tooltips (black by default)

oint tooltipAnimationType
the tooltip animation type

oint tooltipAnimationLength
the tooltip animation length


This class has no child classes.

Alphabetic index Hierarchy of classes


Back to front page   |   page generated with DOC++