Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members

FXEX::FXUtils Namespace Reference

The FXUtils namespace encapsulates some useful functions, into a single collection. More...


Functions

void convert_timeval (struct timeval *tv, FXuint ms)
void convert_timespec (struct timespec *ts, FXuint ms)
void saveEndianness (FXStream &store)
void loadEndianness (FXStream &store)
FXuint fxrandomseed ()
FXint fxrand (FXint upperBound, FXint lowerBound=0)
FXfloat fxrand (FXfloat upperBound, FXfloat lowerBound=0.0)
void setFontOfChildren (FXComposite *w, FXFont *f)
void enableWindow (FXWindow *w)
void disableWindow (FXWindow *w)
FXuint fxfilemode (FXFilePermission permissions)
FXbool loadFileImage (const FXString &file, FXImage *img)
FXbool loadFileIcon (const FXString &file, FXIcon *ico)
FXImage * loadImage (const FXString &file)
FXIcon * loadIcon (const FXString &file)
FXIcon * blendIcon (FXIcon *icon, FXColor baseColor)

Variables

const FXuchar fxexversion [3]


Detailed Description

The FXUtils namespace encapsulates some useful functions, into a single collection.

Function Documentation

void convert_timeval (  struct timeval * tv,
FXuint ms
) 
 

time conversion routines.

void convert_timespec (  struct timespec * ts,
FXuint ms
) 
 

void saveEndianness (  FXStream & store ) 
 

Save the machine dependant endianness value to the stream.

void loadEndianness (  FXStream & store ) 
 

Load the machine dependant endianness value from the stream, and setup stream to swap the bytes if the stream byte order is non-native to the CPU architecture.

FXuint fxrandomseed (  ) 
 

Create a random seed for use with fxrandom.

It is based on the current time, so its a _reasonably_ random seed

FXint fxrand (  FXint upperBound,
FXint lowerBound = 0
) 
 

A useful function calls for generating random numbers generate an integer/float number between [lowerBound,upperBound).

FXfloat fxrand (  FXfloat upperBound,
FXfloat lowerBound = 0.0
) 
 

Returns a float rather than an int.

void setFontOfChildren (  FXComposite * w,
FXFont * f
) 
 

Set the font of all children - this is recursive.

void enableWindow (  FXWindow * w ) 
 

Enable every widget and its children.

void disableWindow (  FXWindow * w ) 
 

Disable every widget and its children.

FXuint fxfilemode (  FXFilePermission permissions ) 
 

set the flags appropriately for the platform.

FXbool loadFileImage (  const FXString & file,
FXImage * img
) 
 

load an image from a file.

FXbool loadFileIcon (  const FXString & file,
FXIcon * ico
) 
 

load an icon from a file.

FXImage* loadImage (  const FXString & file ) 
 

Load an image from a file; return an FXImage.

... dont forget to delete the image, when finished with...

FXIcon* loadIcon (  const FXString & file ) 
 

Load an icon from a file; return an FXIcon ...

dont forget to delete the icon, when finished with...

FXIcon* blendIcon (  FXIcon * icon,
FXColor baseColor
) 
 

For anyone that uses images/icons with transparency here is a pretty good function to have.

A function I wrote called blendIcon is below. Basically it takes and icon and applies the transparency blend for you and sets the color back to the icon. When using icons/images with gradient transparencies (such as those used for drop shadows) on menus and buttons they will look perfect. It should be somewhat optimized so that no floating point math is needed. Here is a simple example of how to use it:

FXPNGIcon *icon = new FXPNGIcon(getApp(), my_icon); blendIcon(icon, getApp()->getBaseColor()); FXButton *button = new FXButton(this, "Click", icon);


Variable Documentation

const FXuchar FXEX::FXUtils::fxexversion[3]
 

Version number that the library version is compiled with.

Definition at line 329 of file fxexdefs.h.