IUP: Base Class

From IUP - Portable User Interface

Base Class
[Control SDK]


Detailed Description

See iup_class.h


Data Structures

struct  Iclass_

Typedefs

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

Enumerations

enum  {
  IUP_TYPEVOID, IUP_TYPECONTROL, IUP_TYPECANVAS, IUP_TYPEDIALOG,
  IUP_TYPEIMAGE, IUP_TYPEMENU
}
enum  { IUP_CHILDNONE, IUP_CHILDONE, IUP_CHILDMANY }

Functions

Iclass * iupClassCreateBase (void)
void iupClassDestroyBase (Iclass *ic)
void iupClassRegisterAttribute (Iclass *ic, const char *name, IattribGetFunc get, IattribSetFunc set, const char *default_value, int no_handle, int inherit)
int iupClassSetAttributeBase (Ihandle *ih, const char *name, const char *value, int *inherit)
char * iupClassGetAttributeBase (Ihandle *ih, const char *name, char **def_value, int *inherit)
int iupClassSetAttributeIdBase (Ihandle *ih, const char *name, const char *value, int *inherit)
char * iupClassGetAttributeIdBase (Ihandle *ih, const char *name, char **def_value, int *inherit)
void iupClassRegisterCallback (Iclass *ic, const char *name, const char *format)
char * iupClassCallbackFormat (Iclass *ic, const char *name)
void iupLayoutSetExpand (Ihandle *ih)

Typedef Documentation

typedef struct Iclass_ Iclass
 

Base Class Structure

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

GetAttribute called for a specific attribute.

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

SetAttribute called for a specific attribute.


Enumeration Type Documentation

anonymous enum
 

Known native types.

Enumerator:
IUP_TYPEVOID  No native representation - HBOX, VBOX, ZBOX, FILL, RADIO
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.


Function Documentation

Iclass* iupClassCreateBase (  void   ) 
 

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

void iupClassDestroyBase (  Iclass *  ic  ) 
 

Destroys the attribute handling functions table.

void iupClassRegisterAttribute (  Iclass *  ic,
const char *  name,
IattribGetFunc  get,
IattribSetFunc  set,
const char *  default_value,
int  no_handle,
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.

int iupClassSetAttributeBase (  Ihandle *  ih,
const char *  name,
const char *  value,
int *  inherit
) 
 

Default SetAttribute implementation that check for attribute handling functions.

char* iupClassGetAttributeBase (  Ihandle *  ih,
const char *  name,
char **  def_value,
int *  inherit
) 
 

Default GetAttribute implementation that check for attribute handling functions.

int iupClassSetAttributeIdBase (  Ihandle *  ih,
const char *  name,
const char *  value,
int *  inherit
) 
 

Same as iupClassSetAttributeBase but handle attribute names with number ids at the end. the get function receives also the Id. When calling iupClassRegisterAttribute just use a typecast. It is used by IupList, IupTree, IupMatrix and IupColorbar. Pure numbers are translated into IDVALUEid.

char* iupClassGetAttributeIdBase (  Ihandle *  ih,
const char *  name,
char **  def_value,
int *  inherit
) 
 

Same as iupClassGetAttributeBase but handle attribute names with number ids at the end. the get function receives also the Id. When calling iupClassRegisterAttribute just use a typecast. It is used by IupList, IupTree, IupMatrix and IupColorbar. Pure numbers are translated into IDVALUEid.

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 other 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* iupClassCallbackFormat (  Iclass *  ic,
const char *  name
) 
 

Returns the format of the parameters of a registered callback.

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.