include('wintools') include('wincontrolworks') include('includes') func _create(_data) var(ctrl) fvar(old, style_) addInclude('LinearRegulator.h',1) addIncludePath('../extras/kwxIC') addSource('../extras/kwxIC/LinearRegulator', 'cpp') beginStyle('wxBORDER_NONE') addStyle(isndef(Orientation), 'wxLR_'+code(upper(Orientation))) style_ = endStyle() println(lreg, ' = new kwxLinearRegulator(this, ID_', upper(lreg), ', _T("Focus me"), wxPoint(', Left, ', ', Top, '), wxSize(', Width, ', ', Height, '),', style_, ');') ctrl = lreg registerId(ctrl) println(lreg, '->SetRangeVal(', Minimum, ', ', Maximum, ');') println(lreg, '->SetNumTick(', NumTicks, ');') println(lreg, '->SetVal(', Value, ');') if (isndef(ActiveBarColor)) println(lreg, '->SetActiveBarColour(', lng.to_color(ActiveBarColor, '255'), ');') end if (isndef(PassiveBarColor)) println(lreg, '->SetPassiveBarColour(', lng.to_color(PassiveBarColor, '255'), ');') end if (isndef(BorderColor)) println(lreg, '->SetBorderColour(', lng.to_color(BorderColor, '255'), ');') end if (isndef(TxtLimitColor)) println(lreg, '->SetTxtLimitColour(', lng.to_color(TxtLimitColor, '255'), ');') end if (isndef(TxtValueColor)) println(lreg, '->SetTxtValueColour(', lng.to_color(TxtValueColor, '255'), ');') end if (isndef(TagsColor)) println(lreg, '->SetTagsColour(', lng.to_color(TagsColor, '255'), ');') end if(linked(onValueChanged)) createEventArg1(ctrl, 'EVT_LINEARREG_CHANGE', 'onValueChanged', lreg+'->GetVal()'@int) end end func doMaximum(_data) println(ctrl, '->SetRangeVal(', ctrl, '->GetMinimum(), ', _data@int, ');') end func doMinimum(_data) println(ctrl, '->SetRangeVal(', _data@int, ', ', ctrl, '->GetMaximum());') end func doValue(_data) println(ctrl, '->SetVal(', _data@int, ');') end func CurrentValue() return(ctrl + '->GetVal();') end func initFree() _create('') end func init() lng.decl_priv_var(lreg, 'kwxLinearRegulator*') if(not linked(doCreate)) fvar(old) old = block.select(BLK_BODY) _create('') block.select(old) end end func doCreate(_data) _create(_data) end