Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
UppHub
Status & Roadmap
FAQ
Authors & License
Forums
Funding U++
Search on this site











SourceForge.net Logo

SourceForge.net Logo

GitHub Logo

Discord Logo

WheelRampCtrl

 

WheelRampCtrl : public Ctrl

Implements either color ramp or color wheel. Base class of ColorWheelCtrl and ColorRampCtrl. Widget implements usual SetData / GetData protocol where Value is Color.

 

Public Member List

 

Event<> WhenLeftDouble

Invoked when user double clicks the widget.

 


 

WheelRampCtrl& DarkContent(bool b = true)

If active, colors are displayed converted through DarkTheme function. Default is false.

 


 

WheelRampCtrl& AllowDarkContent(bool b = true)

If active, colors are displayed converted through DarkTheme function, but only if dark mode is active.

 


 

bool IsDarkContent() const

Returns true if colors are currently displayed as converted with DarkTheme function.

 

ColorWheelCtrl

 

ColorWheelCtrl : public WheelRampCtrl

Color wheel widget.

 

ColorRampCtrl

 

ColorRampCtrl : public WheelRampCtrl

Color ramp widget.

 

ColorPopUp

 

class ColorPopUp : public Ctrl

This class implements pop-up window for color-selection.

 

 

ColorPopUp calls WhenAction Ctrl callback and sets modify flag whenever selected color changes (that is during selection).

 

Derived from Ctrl

 

 

Public Member List

 

void PopUp(Ctrl *owner, Color c = White)

Opens ColorPopUp as pop-up window.

owner

Owner Ctrl. ColorPopUp appears bellow or above this Ctrl.

c

Initial color for wheel and ramp selectors.

 


 

Color Get() const

Return value

Returns current color selected.

 


 

static void Hint(Color c)

Adds the color to the list of recently used colors (see Hints).

 


 

ColorPopUp& NotNull(bool b = true)

Setups whether Null (that is transparent) color choice is enabled. Constructor setting is NotNull(false).

b

true disables Null color choice.

Return value

*this.

 


 

ColorPopUp& SColors(bool b = true)

Setups whether choice of system colors is allowed. Constructor setting is SColors(false).

b

true enables choice of system colors.

Return value

*this.

 


 

ColorPopUp& NullText(const char *s)

Setups text for Null color choice. Constructor setting for en-us is "(transparent)".

s

New text for Null color choice.

Return value

*this.

 


 

ColorPopUp& WithVoid(bool b = true)

Enables special VoidColor() (labeled "(None)", unless the name is changed by VoidText).

 


 

ColorPopUp& VoidText(const char *s)

Changes the label of VoidColor().

 


 

ColorPopUp& NoRampWheel(bool b = true)

If active, there will be no color wheel nor ramp. Default is false.

 


 

ColorPopUp& Hints(bool b = true)

If active, widget will contain a global list of recently used colors. Default is false.

 


 

ColorPopUp& DarkContent(bool b = true)

If active, colors are displayed converted through DarkTheme function. Default is false.

 


 

ColorPopUp& AllowDarkContent(bool b = true)

If active, colors are displayed converted through DarkTheme function, but only if dark mode is active.

 


 

bool IsDarkContent() const

Returns true if colors are currently displayed as converted with DarkTheme function. .

 


 

Callback WhenCancel

This callback is invoked when ColorPopUp is canceled (e.g. by clicking outside).

 


 

Callback WhenSelect

This callback is invoked when color is chosen. Resulting color can be obtained by Get().

 

ColorPusher

 

class ColorPusher : public Ctrl

This class represents Ctrl with Color value. It uses ColorPopUp to edit this value.

 

 

 

As is U++ standard, Color value is set and get using SetData and GetData virtual method.

WhenAction callback and modify set behaviour depends on track mode. When track mode is enabled (Track(true)), WhenAction is called and modify set upon any change of color (including moving mouse through ColorPopUp). When track mode is off, it is called and set only after new Color is selected.

 

Derived from Ctrl

 

 

Public Member List

 

ColorPusher& NullText(const char *s)

Sets a text to be displayed if Color value is Null. Constructor setting for en-us is "(transparent)".

s

Text.

Return value

*this.

 


 

ColorPusher& NotNull(bool b = true)

Setups whether Null (that is transparent) color choice is enabled. Constructor setting is NotNull(false).

b

true disables Null color choice.

Return value

*this.

 


 

ColorPusher& WithVoid(bool b = true)

Enables special VoidColor() (labeled "(None)", unless the name is changed by VoidText).

 


 

ColorPusher& VoidText(const char *s)

Changes the label of VoidColor().

 


 

ColorPusher& SColors(bool b = true)

Setups whether choice of system colors is allowed. Constructor setting is SColors(false).

b

true enables choice of system colors.

Return value

*this.

 


 

ColorPusher& WithText(bool b = true)

ColorPusher will display text representation of color (either known name, or numbers).

 


 

ColorPusher& WithHex(bool b = true)

ColorPusher will hexadecimal representation of color.

 


 

ColorPusher& Track(bool b = true)

Setups track mode. Constructor setting is Track(false).

b

true enables track mode.

Return value

*this

 


 

ColorPusher& NoTrack()

Same as Track(false).

Return value

*this.

 


 

ColorPusher& NoRampWheel(bool b = true)

If active, there will be no color wheel nor ramp. Default is false.

 


 

ColorPusher& Hints(bool b = true)

If active, widget will contain a list of recently used colors. Default is true.

 


 

ColorPusher& DarkContent(bool b = true)

If active, colors are displayed converted through DarkTheme function. Default is false.

 


 

ColorPusher& AllowDarkContent(bool b = true)

If active, colors are displayed converted through DarkTheme function, but only if dark mode is active.

 

ColorButton

 

class ColorButton : public ColorPusher

 

 

This class is similar to ColorPusher, but intended to be used in ToolBar. It supports displaying color using Image too.

 

Derived from ColorPusher

 

 

Public Member List

 

ColorButton& ColorImage(const Image& img)

Sets image to display color. This image is drawn (in the center of ColorButton) with selected color.

img

Image.

Return value

*this.

 


 

ColorButton& NullImage(const Image& img)

Sets image to display null color.

img

Image.

Return value

*this.

 


 

ColorButton& StaticImage(const Image& img)

Sets static image that is always displayed with ColorImage and NullImage.

img

Image.

Return value

*this.

 

Utility Functions

 

String FormatColor(Color c)

Formats the color into readable form compatible with C++ syntax, using color names where possible.

 


 

Color ReadColor(CParser& p)

Converts text formatted with FormatColor to Color. Can throw CParser::Error.

 

 


 

const Display& StdColorDisplayNull()

Returns Display which paints text "(no color)" if value is Null or paints the rectangle with value color.

 

Do you want to contribute?