Project

General

Profile

Up

_CRcompSizeBar

Creates a size bar in an ObjContainer.

Prototype :

fun [Chn ObjContainer ObjNode [I I] I I I AlphaBitmap] CompSizeBar

  • Chn : a channel

  • ObjContainer : a container object

  • ObjNode : an optional node father (can be nil)

  • [I I] : x and y coordonnates (inside the ObjContainer)

  • I : flags. Can be a combination of following values :
    • OBJ_ENABLE : object is enabled
    • OBJ_DISABLE : object is disabled
    • OBJ_HIDE : object is hidden
    • OBJ_VISIBLE : object is visible
    • OBJ_CBNOPAINT : object is not repaint before user callbacks
    • OBJ_TABSTOP : object is in the "tab stop" list
    • OBJ_LW_FLEX : left margin from container border to object is flexible
    • OBJ_MW_FLEX : object width is flexible
    • OBJ_RW_FLEX : right margin from object to container border is flexible
    • OBJ_LH_FLEX : top margin from container to object is flexible
    • OBJ_MH_FLEX : object height is flexible
    • OBJ_RH_FLEX : bottom margin from object to container is flexible
    • SB_SHADOW : object has a shadowed state

  • I : filter flags. Defines how events are relayed to container, can be any combination of following values :
    • OBJ_CONTAINER_CLICK : mouse click event is relayed to container click callback
    • OBJ_CONTAINER_UNCLICK : mouse unclick event is relayed to container unclick callback
    • OBJ_CONTAINER_DBLCLICK : mouse double-click event is relayed to container double-click callback
    • OBJ_CONTAINER_KEYUP : keyup event is relayed to container keyup callback
    • OBJ_CONTAINER_KEYDOWN : keydown event is relayed to container keydown callback
    • OBJ_CONTAINER_MOUSEWHEEL : mouse wheel event is relayed to container mouse wheel callback
    • OBJ_CONTAINER_MOVE : mouse move event is relayed to container mouse move callback
    • OBJ_CONTAINER_ALLEVENTS : Activates all nodes' event forwardings: clicks, keys, wheel, move

  • I : direction. Can be one of the following values :
    • SLB_HORIZONTAL : horizontal sizebar
    • SLB_VERTICAL : vertical sizebar

  • AlphaBitmap : graphic resource

Return : CompSizeBar the new object or nil if error

See also :

Example :

typeof Win = ObjWin;;
typeof Abmp = AlphaBitmap;;
typeof Abmp2 = AlphaBitmap;;
typeof Cont = ObjContainer;;
typeof Cbmp = CompBitmap;;
typeof SizeBar = CompSizeBar;;

var Width = 500;;
var Height = 300;;

fun cbEnd (obj, user_parameter)=
	_DScompSizeBar SizeBar;
	_DScompBitmap Cbmp;
	_DScontainer Cont;
	_DSalphaBitmap Abmp;
	_DSalphaBitmap Abmp2;
	_closemachine;;
	
fun cbSize (obj, user_parameter, w, h)=
	_SIZEcontainer Cont 0 0 w h;
	_PAINTcontainer Cont;
	0;;

fun main ()=
	_showconsole;
	
	set Win = _CRwindow _channel nil 50 50 Width Height WN_NORMAL " Test CompSizeBar";
	_CBwinDestroy Win @cbEnd 0;
	_CBwinSize Win @cbSize 0;
	
	set Cont = _CRcontainerFromObjWin _channel Win 0 0 Width Height CO_CHILDINSIDE 0x777777 nil;
	
	set Abmp2 = _LDalphaBitmap _channel _checkpack "tests/scol2d/sizebar/0/test_2.png";
	let _GETalphaBitmapSize Abmp2 -> [w h] in
	set Cbmp = _CRcompBitmap _channel Cont nil [5 5] OBJ_ENABLE|OBJ_VISIBLE 0 Abmp2 0 0 w h;
	
	set Abmp = _LDalphaBitmap _channel _checkpack "tests/scol2d/sizebar/0/test.png";
	set SizeBar = _CRcompSizeBar _channel Cont nil [5 50] OBJ_ENABLE|OBJ_VISIBLE 0 SLB_VERTICAL Abmp;
	_SETcompSizeBarMinMax SizeBar (-30) 200;
	
	_PAINTcontainer Cont;
	0;;