ATTRIB(VoretColorpickerString, image, string, SKINGFX_COLORPICKER)
ATTRIB(VoretColorpickerString, imagemargin, vector, SKINMARGIN_COLORPICKER)
ATTRIB(VoretColorpickerString, focusable, float, 1)
- METHOD(VoretColorpickerString, focusLeave, void(entity))
- METHOD(VoretColorpickerString, keyDown, float(entity, float, float, float))
METHOD(VoretColorpickerString, draw, void(entity))
+ ATTRIB(VoretColorpickerString, disabledAlpha, float, 0.3)
ENDCLASS(VoretColorpickerString)
entity makeVoretColorpickerString(string theCvar, string theDefaultCvar);
#endif
return 1;
}
-// must match hslimage.c
-
-
float mouseDragVoretColorpickerString(entity me, vector coords)
{
if(me.disabled)
return 1;
}
-void focusLeaveVoretColorpickerString(entity me)
-{
- me.controlledTextbox.saveCvars(me.controlledTextbox);
-}
-float keyDownVoretColorpickerString(entity me, float key, float ascii, float shift)
-{
- return me.controlledTextbox.keyDown(me.controlledTextbox, key, ascii, shift);
-}
void drawVoretColorpickerString(entity me)
{
- drawImage(me);
-
- float B, C, aC;
- C = cvar("r_textcontrast");
- B = cvar("r_textbrightness");
+ float save;
+ save = draw_alpha;
+ if(me.disabled)
+ draw_alpha *= me.disabledAlpha;
- // for this to work, C/(1-B) must be in 0..1
- // B must be < 1
- // C must be < 1-B
-
- B = bound(0, B, 1);
- C = bound(0, C, 1-B);
+ drawImage(me);
- aC = 1 - C / (1 - B);
+ vector sz;
+ sz = draw_PictureSize(strcat(me.src, "_selected"));
+ sz = globalToBoxSize(sz, draw_scale);
- draw_Picture(me.imgOrigin, strcat(me.src, "_m"), me.imgSize, '0 0 0', aC);
- draw_Picture(me.imgOrigin, strcat(me.src, "_m"), me.imgSize, me.color, B);
+ if(!me.disabled)
+ {
+ cvar_set(me.cvarName, sprintf("%v", hslimage_color(me.prevcoords, me.imagemargin)));
+ draw_Picture(me.imgOrigin + me.prevcoords - 0.5 * sz, strcat(me.src, "_selected"), sz, '1 0 1', 1);
+ }
+ draw_alpha = save;
}
#endif