IUP: Base Class

IUP - Portable User Interface

Base Class
[Control SDK]


Detailed Description

See iup_class.h


Data Structures

struct  Iclass_

Typedefs

typedef char *(* IattribGetFunc )(Ihandle *ih)
typedef char *(* IattribGetIdFunc )(Ihandle *ih, const char *name_id)
typedef int(* IattribSetFunc )(Ihandle *ih, const char *value)
typedef int(* IattribSetIdFunc )(Ihandle *ih, const char *name_id, const char *value)

Enumerations

enum  {
  IUP_TYPEVOID, IUP_TYPECONTROL, IUP_TYPECANVAS, IUP_TYPEDIALOG,
  IUP_TYPEIMAGE, IUP_TYPEMENU
}
enum  { IUP_CHILDNONE, IUP_CHILDONE, IUP_CHILDMANY }
enum  { IUP_NOT_MAPPED, IUP_MAPPED }
enum  { IUP_NO_INHERIT, IUP_INHERIT }

Functions

IclassiupClassGetBase (Iclass *parent)
void iupClassRelease (Iclass *ic)
void iupClassRegisterAttribute (Iclass *ic, const char *name, IattribGetFunc get, IattribSetFunc set, const char *default_value, int mapped, int inherit)
void iupClassRegisterCallback (Iclass *ic, const char *name, const char *format)
char * iupClassCallbackGetFormat (Iclass *ic, const char *name)
void iupLayoutSetExpand (Ihandle *ih)
void iupBaseSetCurrentSizeMethod (Ihandle *ih, int w, int h, int shrink)
void iupBaseSetPositionMethod (Ihandle *ih, int x, int y)

Typedef Documentation

typedef char*(* IattribGetFunc)(Ihandle *ih)
 

GetAttribute called for a specific attribute. Used by iupClassRegisterAttribute.

typedef char*(* IattribGetIdFunc)(Ihandle *ih, const char *name_id)
 

GetAttribute called for a specific attribute when attrib_id is true.
Same as IattribGetFunc but handle attribute names with number ids at the end.
When calling iupClassRegisterAttribute just use a typecast.
Pure numbers are translated into IDVALUEid. Used by iupClassRegisterAttribute.

typedef int(* IattribSetFunc)(Ihandle *ih, const char *value)
 

SetAttribute called for a specific attribute.
If returns 0, the attribute will not be stored in the attribute environment.
When IupSetAttribute is called using value=NULL, the default_value is passed to this function. Used by iupClassRegisterAttribute.

typedef int(* IattribSetIdFunc)(Ihandle *ih, const char *name_id, const char *value)
 

SetAttribute called for a specific attribute when attrib_id is true.
Same as IattribSetFunc but handle attribute names with number ids at the end.
When calling iupClassRegisterAttribute just use a typecast.
Pure numbers are translated into IDVALUEid. Used by iupClassRegisterAttribute.


Enumeration Type Documentation

anonymous enum
 

Known native types.

Enumerator:
IUP_TYPEVOID  No native representation - HBOX, VBOX, ZBOX, FILL, RADIO (handle==(void*)-1 always)
IUP_TYPECONTROL  Native controls - BUTTON, LABEL, TOGGLE, LIST, TEXT, MULTILINE, ITEM, SEPARATOR, SUBMENU, FRAME, others
IUP_TYPECANVAS  Drawing canvas, also used as a base control for custom controls.

anonymous enum
 

Possible number of children.

anonymous enum
 

Attribute map state dependency. Used by iupClassRegisterAttribute.

anonymous enum
 

Attribute inheritance dependency. Used by iupClassRegisterAttribute.


Function Documentation

Iclass* iupClassGetBase Iclass parent  ) 
 

Allocates memory for the Iclass structure and initializes the attribute handling functions table.

void iupClassRelease Iclass ic  ) 
 

Release the memory allocated by the class and parent classes.

void iupClassRegisterAttribute Iclass ic,
const char *  name,
IattribGetFunc  get,
IattribSetFunc  set,
const char *  default_value,
int  mapped,
int  inherit
 

Register attribute handling functions. get, set and default_value can be NULL. default_value should point to a constant string. It will not be duplicated internally. Notice that when an attribute is not defined then default_value=NULL and inherit=IUP_INHERIT.

void iupClassRegisterCallback Iclass ic,
const char *  name,
const char *  format
 

Register the parameters of a callback. Used by language bindings. format follows the format specification of the class creation parameters format, but it adds the "double" option and remove array options. It can have none, one or more of the following.

  • "b" = (unsigned char) - byte
  • "i" = (int) - integer
  • "f" = (float) - real
  • "d" = (double) - real
  • "s" = (char*) - string
  • "h" = (Ihandle*) - element handle The default return value for all callbacks is "i" (int). But the return value can be specified using one of the above parameters, after all parameters using "=" to separate it from them.

char* iupClassCallbackGetFormat Iclass ic,
const char *  name
 

Returns the format of the parameters of a registered callback. If NULL then the default callback definition is assumed.

void iupLayoutSetExpand Ihandle *  ih  ) 
 

Updates the expand member of the IUP object from the EXPAND attribute. Should be called in the begining of the ComputeNaturalSize of each element.

void iupBaseSetCurrentSizeMethod Ihandle *  ih,
int  w,
int  h,
int  shrink
 

SetCurrentSize method for controls that are not containers.

void iupBaseSetPositionMethod Ihandle *  ih,
int  x,
int  y
 

SetPositionSize method for controls that are not containers.