[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] SCView-showEnabled

hi all,
after a little thread on the users list, i thought that adding a boolean SCView-showEnabled_(bool)
may be very helpful. it allows disabling the white shading of disabled views.

would it be possible for someone to check if this is correct implementation 
and in case there is no objection, commit this functionality?

(sorry - i don't know how to produce a diff yet...)


in SCView.h line 159, add;

bool mShowDisabled;

then in SCView.m 
line 269 add mShowDisabled(true)

mBackground(0), mVisible(true), mEnabled(true), mShowDisabled(true), // <----- add this

line 504 add this if statement

if (mShowDisabled) { // <----- add this line
    CGContextSetRGBFillColor(cgc, 1., 1., 1., 0.5);
    CGContextFillRect(cgc, rect);
} // <----- add this

line 706 add this:

if (strcmp(name, "showDisabled")==0) {
                bool showDisabled = IsTrue(slot);
                if (mShowDisabled != showDisabled) {
                    mShowDisabled = showDisabled;
                    if (!mShowDisabled) mTop->resetFocus();
return errNone;

then in SuperCollider:

in SCView-properties add symbol \showDisabled as follows:

properties {
^#[\bounds, \visible, \enabled, \showDisabled, \canFocus, \resize, \background,

and add these two messages

showDisabled {
showDisabled_ { arg bool;
this.setProperty(\showDisabled, bool)

recompile SC and try this:

w = SCWindow.new;
b = SCButton(w,Rect(20,20,340,30));
b.states = [[">",Color.black,Color.red]];
// turn vale on
// turn it off