Scol standard library package
0.3.1
Common and usefull functions for all Scol applications
|
Classes | |
struct | L2D_BUTTON |
Opaque internal structure. You should not call it directly, use API instead ! More... | |
Functions | |
lib2d_butBuild (strBut) | |
Build the button. More... | |
lib2d_butClose (strBut) | |
Close a button. More... | |
lib2d_butDestroy (strBut) | |
Destroy a button. More... | |
lib2d_butDisable (strBut) | |
Disable (hide) a button. More... | |
lib2d_butEnable (strBut) | |
Enable (show) a button. More... | |
lib2d_butGetBgColor (strBut) | |
Retreive the background color. More... | |
lib2d_butGetBgParams (strBut) | |
Get the background parameters of the button. More... | |
lib2d_butGetBitmap (strBut) | |
Return the bitmap object to a button object. More... | |
lib2d_butGetBitmapPos (strBut) | |
Get the bitmap position of a button object. More... | |
lib2d_butGetBitmapSize (strBut) | |
Get the bitmap size of a button object. More... | |
lib2d_butGetCbClick (strBut) | |
Get the "Click" event callback to a button object. More... | |
lib2d_butGetCbClose (strBut) | |
Get the "Close" event callback to a button object. More... | |
lib2d_butGetCbDestroy (strBut) | |
Get the "Destroy" event callback to a button object. More... | |
lib2d_butGetCbDrop (strBut) | |
Get the "drop files" callback to a button object. More... | |
lib2d_butGetCbDropfiles (strBut) | |
Get the "Drop files" event callback to a button object. More... | |
lib2d_butGetFoColor (strBut) | |
Retreive the foreground (title) color. More... | |
lib2d_butGetFont (strBut) | |
Return the useed font of a button object. More... | |
lib2d_butGetMother (strBut) | |
Get the mother window. More... | |
lib2d_butGetPos (strBut) | |
Get the position of a button object. More... | |
lib2d_butGetSize (strBut) | |
Get the size of a button object. More... | |
lib2d_butGetTitle (strBut) | |
Return the title to a button object. More... | |
lib2d_butGetType (strBut) | |
Return the type of a button object. More... | |
lib2d_butGetWinFlag (strBut) | |
Get the flags of the window button. More... | |
lib2d_butIsEnabled (strBut) | |
Return if a button is shown or hidden (enabled / disabled). More... | |
lib2d_butNew (iType, oMother, cbClick) | |
Create a new object. More... | |
lib2d_butSetBgColor (strBut, color) | |
Set the background color. More... | |
lib2d_butSetBgParams (strBut, b, fullbg, border, sizeborder) | |
Set the background parameters of the button. More... | |
lib2d_butSetBitmap (strBut, bmp) | |
Set a bitmap object to a button object. More... | |
lib2d_butSetBitmapPos (strBut, x, y) | |
Set the bitmap position of a button object. More... | |
lib2d_butSetBitmapSize (strBut, width, height) | |
Set the bitmap size of a button object. More... | |
lib2d_butSetCbClick (strBut, cb) | |
Set the callback when a 'Click' event occurs. More... | |
lib2d_butSetCbClose (strBut, cb) | |
Set the callback when a 'Close' event occurs. More... | |
lib2d_butSetCbDestroy (strBut, cb) | |
Set the callback when a 'Destroy' event occurs. More... | |
lib2d_butSetCbDrop (strBut, cb) | |
Define the "drop files" callback to a button object. More... | |
lib2d_butSetCbDropfiles (strBut, cb) | |
Set the callback when a 'Drop files' event occurs. More... | |
lib2d_butSetFile (strBut, szPath) | |
Set a bitmap file to a button object. More... | |
lib2d_butSetFoColor (strBut, color) | |
Set the foreground color, i.e. the title color. More... | |
lib2d_butSetFont (strBut, oFont) | |
Set the used font to a button object. More... | |
lib2d_butSetMother (strBut, mother) | |
Set the mother window to a button object. More... | |
lib2d_butSetPos (strBut, x, y) | |
Set the position of a button object. More... | |
lib2d_butSetSize (strBut, width, height) | |
Set the size of a button object. More... | |
lib2d_butSetTitle (strBut, szTitle) | |
Set a title to a button object. More... | |
lib2d_butSetType (strBut, iType) | |
Set the type to a button object. More... | |
lib2d_butSetWinFlag (strBut, flags) | |
Set the flags of the window button. More... | |
lib2d_buttonNewCopy (strBut) | |
Create a new object from another one. More... | |
lib2s_butGetSpacing (strBut) | |
Get the spacing between the graphical elements. More... | |
lib2s_butGetTextPos (strBut) | |
Get the text position of a button object. More... | |
lib2s_butSetSpacing (strBut, spacing) | |
Set the spacing between the graphical elements. More... | |
lib2s_butSetTextPos (strBut, pos, ref) | |
From the bitmap, set the text position of a button object. If it is no bitmap, the position is from the edge of the window. More... | |
Variables | |
var | L2D_BUTTON_BUTTON =1 |
button is a button | |
var | L2D_BUTTON_SPACING =10 |
default spacing value between the graphical elements | |
var | L2D_BUTTON_WINDOW =0 |
button is a window | |
To create and manage customized buttons.
Package to load : lib/2dos/button.pkg
Dependancies :
lib2d_butNew | ( | iType | , |
oMother | , | ||
cbClick | |||
) |
Create a new object.
Some parameters take default values (they can be modified with tthis API) :
Prototype : fun [I ObjWin fun [L2D_BUTTON I I I I] I] L2D_BUTTON
I | : the type of the button, one of these following values :
|
ObjWin | : the mother window. It can be nil. |
fun | [L2D_BUTTON I I I I] I : the callback when a click event occurs. The suplemental arguments are (they are always nil if the type is L2D_BUTTON_BUTTON except 'mask') :
|
lib2d_buttonNewCopy | ( | strBut | ) |
Create a new object from another one.
All parameters are copied EXCEPT all callbacks. Callbacks are all at nil. This API can set that.
Prototype : fun [L2D_BUTTON] L2D_BUTTON
L2D_BUTTON | : the model to copy |
lib2d_butSetFile | ( | strBut | , |
szPath | |||
) |
Set a bitmap file to a button object.
Prototype : fun [L2D_BUTTON S] I
L2D_BUTTON | : a button object |
S | : a bitmap filename. Can be nil, in this case, the old bitmap is destroyed). |
lib2d_butSetBitmap | ( | strBut | , |
bmp | |||
) |
Set a bitmap object to a button object.
Prototype : fun [L2D_BUTTON ObjBitmap] I
L2D_BUTTON | : a button object |
ObjBitmap | : a bitmap object. Can be nil, in this case, the old bitmap is destroyed). |
lib2d_butGetBitmap | ( | strBut | ) |
Return the bitmap object to a button object.
Prototype : fun [L2D_BUTTON] ObjBitmap
L2D_BUTTON | : a button object |
lib2d_butSetTitle | ( | strBut | , |
szTitle | |||
) |
Set a title to a button object.
Prototype : fun [L2D_BUTTON S] I
L2D_BUTTON | : a button object |
S | : a title. Can be nil, if no title needed. |
lib2d_butGetTitle | ( | strBut | ) |
Return the title to a button object.
Prototype : fun [L2D_BUTTON] S
L2D_BUTTON | : a button object |
lib2d_butSetMother | ( | strBut | , |
mother | |||
) |
Set the mother window to a button object.
If the mother is not nil, the button will be built inside it. If the mother is nil, the type of button must be L2D_BUTTON_WINDOW.
Prototype : fun [L2D_BUTTON ObjWin] I
L2D_BUTTON | : a button object |
ObjWin | : a mother window object. Can be nil, if you know really what you do. |
lib2d_butSetType | ( | strBut | , |
iType | |||
) |
Set the type to a button object.
Prototype : fun [L2D_BUTTON I] I
L2D_BUTTON | : a button object |
I | : a type, one of these values :
|
lib2d_butGetType | ( | strBut | ) |
Return the type of a button object.
Prototype : fun [L2D_BUTTON] I
L2D_BUTTON | : a button object |
lib2d_butSetFont | ( | strBut | , |
oFont | |||
) |
Set the used font to a button object.
Prototype : fun [L2D_BUTTON ObjFont] I
L2D_BUTTON | : a button object |
ObjFont | : a font. If nil, a default font will be set. |
lib2d_butGetFont | ( | strBut | ) |
Return the useed font of a button object.
Prototype : fun [L2D_BUTTON] ObjFont
L2D_BUTTON | : a button object |
lib2d_butSetCbDrop | ( | strBut | , |
cb | |||
) |
Define the "drop files" callback to a button object.
Prototype : fun [L2D_BUTTON fun [L2D_BUTTON [P r1]] I] I
L2D_BUTTON | : a button object |
fun | [L2D_BUTTON [P r1]] I : callback. Can be nil (in this case, the event will be ignored). |
lib2d_butGetCbDrop | ( | strBut | ) |
Get the "drop files" callback to a button object.
Prototype : fun [L2D_BUTTON] fun [L2D_BUTTON [P r1] I
L2D_BUTTON | : a button object |
lib2d_butSetSize | ( | strBut | , |
width | , | ||
height | |||
) |
Set the size of a button object.
Prototype : fun [L2D_BUTTON I I] I
L2D_BUTTON | : a button object |
I | : the width. Can be nil, in this case, the old value is kept. |
I | : the height. Can be nil, in this case, the old value is kept. |
lib2d_butGetSize | ( | strBut | ) |
Get the size of a button object.
Prototype : fun [L2D_BUTTON] [I I]
L2D_BUTTON | : a button object |
lib2d_butSetPos | ( | strBut | , |
x | , | ||
y | |||
) |
Set the position of a button object.
Prototype : fun [L2D_BUTTON I I] I
L2D_BUTTON | : a button object |
I | : the x coordinate. Can be nil, in this case, the old value is kept. |
I | : the y coordinate. Can be nil, in this case, the old value is kept. |
lib2d_butGetPos | ( | strBut | ) |
Get the position of a button object.
Prototype : fun [L2D_BUTTON] [I I]
L2D_BUTTON | : a button object |
lib2d_butSetBitmapSize | ( | strBut | , |
width | , | ||
height | |||
) |
Set the bitmap size of a button object.
Prototype : fun [L2D_BUTTON I I] I
L2D_BUTTON | : a button object |
I | : the width. Can be nil, in this case, the old value is kept. |
I | : the height. Can be nil, in this case, the old value is kept. |
lib2d_butGetBitmapSize | ( | strBut | ) |
Get the bitmap size of a button object.
Prototype : fun [L2D_BUTTON] [I I]
L2D_BUTTON | : a button object |
lib2d_butSetBitmapPos | ( | strBut | , |
x | , | ||
y | |||
) |
Set the bitmap position of a button object.
Prototype : fun [L2D_BUTTON I I] I
L2D_BUTTON | : a button object |
I | : the x coordinate. Can be nil, in this case, the old value is kept. |
I | : the y coordinate. Can be nil, in this case, the old value is kept. |
lib2d_butGetBitmapPos | ( | strBut | ) |
Get the bitmap position of a button object.
Prototype : fun [L2D_BUTTON] [I I]
L2D_BUTTON | : a button object |
lib2s_butSetTextPos | ( | strBut | , |
pos | , | ||
ref | |||
) |
From the bitmap, set the text position of a button object. If it is no bitmap, the position is from the edge of the window.
Prototype : fun [L2D_BUTTON I I] I
L2D_BUTTON | : a button object |
I | : the position :
|
I | : the position from the bitmap, if any :
|
lib2s_butGetTextPos | ( | strBut | ) |
Get the text position of a button object.
Prototype : fun [L2D_BUTTON] [I I]
L2D_BUTTON | : a button object |
lib2s_butSetSpacing | ( | strBut | , |
spacing | |||
) |
Set the spacing between the graphical elements.
Prototype : fun [L2D_BUTTON I] I
L2D_BUTTON | : a button object |
I | : the spacing to set, in pixels. |
lib2s_butGetSpacing | ( | strBut | ) |
Get the spacing between the graphical elements.
Prototype : fun [L2D_BUTTON] I
L2D_BUTTON | : a button object |
lib2d_butSetCbClick | ( | strBut | , |
cb | |||
) |
Set the callback when a 'Click' event occurs.
Prototype : fun [L2D_BUTTON fun [L2D_BUTTON I I I I] I] I
L2D_BUTTON | : a button object |
fun | [L2D_BUTTON I I I I] I : the callback. Supplemental arguments are :
|
lib2d_butSetCbDropfiles | ( | strBut | , |
cb | |||
) |
Set the callback when a 'Drop files' event occurs.
Prototype : fun [L2D_BUTTON fun [L2D_BUTTON [P r1] I I] I] I
L2D_BUTTON | : a button object |
fun | [L2D_BUTTON [P r1] I I] I : the callback. Supplemental arguments are :
|
lib2d_butSetCbClose | ( | strBut | , |
cb | |||
) |
Set the callback when a 'Close' event occurs.
Prototype : fun [L2D_BUTTON fun [L2D_BUTTON I] I] I
L2D_BUTTON | : a button object |
fun | [L2D_BUTTON I] I : the callback. Supplemental argument is :
|
lib2d_butSetCbDestroy | ( | strBut | , |
cb | |||
) |
Set the callback when a 'Destroy' event occurs.
Prototype : fun [L2D_BUTTON fun [I] I] I
L2D_BUTTON | : a button object |
fun | [I] I : the callback. The argument is :
|
lib2d_butGetCbClick | ( | strBut | ) |
Get the "Click" event callback to a button object.
Prototype : fun [L2D_BUTTON] fun [L2D_BUTTON I I I I] I
L2D_BUTTON | : a button object |
lib2d_butGetCbDropfiles | ( | strBut | ) |
Get the "Drop files" event callback to a button object.
Prototype : fun [L2D_BUTTON] fun [L2D_BUTTON [P r1] I I] I
L2D_BUTTON | : a button object |
lib2d_butGetCbClose | ( | strBut | ) |
Get the "Close" event callback to a button object.
Prototype : fun [L2D_BUTTON] fun [L2D_BUTTON I] I
L2D_BUTTON | : a button object |
lib2d_butGetCbDestroy | ( | strBut | ) |
Get the "Destroy" event callback to a button object.
Prototype : fun [L2D_BUTTON] fun [I] I
L2D_BUTTON | : a button object |
lib2d_butGetMother | ( | strBut | ) |
Get the mother window.
Prototype : fun [L2D_BUTTON] ObjWin
L2D_BUTTON | : a button object |
lib2d_butSetBgColor | ( | strBut | , |
color | |||
) |
Set the background color.
Prototype : fun [L2D_BUTTON I] I
L2D_BUTTON | : a button object |
I | : the 24-bits color (0 (black) -> 0xFFFFFF (white)) |
lib2d_butGetBgColor | ( | strBut | ) |
Retreive the background color.
Prototype : fun [L2D_BUTTON] I
L2D_BUTTON | : a button object |
lib2d_butSetFoColor | ( | strBut | , |
color | |||
) |
Set the foreground color, i.e. the title color.
Prototype : fun [L2D_BUTTON I] I
L2D_BUTTON | : a button object |
I | : the 24-bits color (0 (black) -> 0xFFFFFF (white)) |
lib2d_butGetFoColor | ( | strBut | ) |
Retreive the foreground (title) color.
Prototype : fun [L2D_BUTTON] I
L2D_BUTTON | : a button object |
lib2d_butSetBgParams | ( | strBut | , |
b | , | ||
fullbg | , | ||
border | , | ||
sizeborder | |||
) |
Set the background parameters of the button.
Prototype : fun [L2D_BUTTON I I I I] I
L2D_BUTTON | : a button object |
I | : define if the background must be drawn :
|
I | : define if the background (except the border) must be drawn :
|
I | : define if the border must be drawn :
|
I | : define the size of the border, in pixels (>= 0, 1 is the default value) |
lib2d_butGetBgParams | ( | strBut | ) |
Get the background parameters of the button.
Prototype : fun [L2D_BUTTON] [I I I I]
L2D_BUTTON | : a button object |
lib2d_butSetWinFlag | ( | strBut | , |
flags | |||
) |
Set the flags of the window button.
Prototype : fun [L2D_BUTTON I] I
This has an effect with L2D_BUTTON_WINDOW type only (see 'lib2d_butSetType'). For another type, these flags are ignored.
When the build step is, if a mother window is defined (this case is the mostly current), the flag 'WN_CHILDINSIDE' is automatically added. If no mother window set, the flags 'WN_NOCAPTION|WN_MENU' are automatically added.
L2D_BUTTON | : a button object |
I | : a flag or a combination of flags. The available values are the same than _CRwindow ( http://www.scolring.org/files/doc_html/_crwindow.html ). Example : WN_DOWN |
lib2d_butGetWinFlag | ( | strBut | ) |
Get the flags of the window button.
Prototype : fun [L2D_BUTTON] I
L2D_BUTTON | : a button object |
lib2d_butEnable | ( | strBut | ) |
Enable (show) a button.
Prototype : fun [L2D_BUTTON] I
L2D_BUTTON | : a button object |
lib2d_butDisable | ( | strBut | ) |
Disable (hide) a button.
Prototype : fun [L2D_BUTTON] I
L2D_BUTTON | : a button object |
lib2d_butIsEnabled | ( | strBut | ) |
Return if a button is shown or hidden (enabled / disabled).
Prototype : fun [L2D_BUTTON] I
L2D_BUTTON | : a button object |
lib2d_butBuild | ( | strBut | ) |
Build the button.
Prototype : fun [L2D_BUTTON] I
L2D_BUTTON | : a button object. It should be set before use this function. |
lib2d_butClose | ( | strBut | ) |
Close a button.
Prototype : fun [L2D_BUTTON] I
When this function is called, the button (window or button) is destroyed itself but the structure is kept. The structure can be reused to build the same object or it can be modified to build another object. If a full destruction is needed, see lib2d_butDestroy.
The 'Close' callback will be ran.
L2D_BUTTON | : a button object. |
lib2d_butDestroy | ( | strBut | ) |
Destroy a button.
Prototype : fun [L2D_BUTTON] I
When this function is called, the button is destroyed and and its structure is at nil (all parameters are nil). To close the button only, see lib2d_butClose.
The 'Destroy' callback will be ran.
L2D_BUTTON | : a button object. |