tilde~
Puredata Qt-based GUI
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Properties | List of all members
Color_Wheel Class Reference

Display an analog widget that allows the selection of a HSV color. More...

#include <color_wheel.hpp>

Inheritance diagram for Color_Wheel:

Classes

class  Private
 

Public Types

enum  Display_Enum {
  SHAPE_DEFAULT = 0x000, SHAPE_TRIANGLE = 0x001, SHAPE_SQUARE = 0x002, SHAPE_FLAGS = 0x00f,
  ANGLE_DEFAULT = 0x000, ANGLE_FIXED = 0x010, ANGLE_ROTATING = 0x020, ANGLE_FLAGS = 0x0f0,
  COLOR_DEFAULT = 0x000, COLOR_HSV = 0x100, COLOR_HSL = 0x200, COLOR_LCH = 0x400,
  COLOR_FLAGS = 0xf00, FLAGS_DEFAULT = 0x000, FLAGS_ALL = 0xfff
}
 

Public Slots

void setColor (QColor c)
 Set current color. More...
 
void setHue (qreal h)
 
void setSaturation (qreal s)
 
void setValue (qreal v)
 
void setDisplayFlags (Color_Wheel::Display_Flags flags)
 Set the display flags. More...
 

Signals

void colorChanged (QColor)
 
void colorSelected (QColor)
 
void displayFlagsChanged (Color_Wheel::Display_Flags flags)
 

Public Member Functions

 Color_Wheel (QWidget *parent=0)
 
 ~Color_Wheel ()
 
QColor color () const
 Get current color. More...
 
QSize sizeHint () const
 
qreal hue () const
 Get current hue in the range [0-1]. More...
 
qreal saturation () const
 Get current saturation in the range [0-1]. More...
 
qreal value () const
 Get current value in the range [0-1]. More...
 
unsigned int wheelWidth () const
 Get the width in pixels of the outer wheel. More...
 
void setWheelWidth (unsigned int w)
 Set the width in pixels of the outer wheel. More...
 
Display_Flags displayFlags (Display_Flags mask=FLAGS_ALL) const
 Get display flags. More...
 
void setDisplayFlag (Display_Flags flag, Display_Flags mask)
 Set a specific display flag. More...
 

Static Public Member Functions

static void setDefaultDisplayFlags (Display_Flags flags)
 Set the default display flags. More...
 
static Display_Flags defaultDisplayFlags (Display_Flags mask=FLAGS_ALL)
 Get default display flags. More...
 

Protected Member Functions

void paintEvent (QPaintEvent *)
 
void mouseMoveEvent (QMouseEvent *)
 
void mousePressEvent (QMouseEvent *)
 
void mouseReleaseEvent (QMouseEvent *)
 
void resizeEvent (QResizeEvent *)
 

Properties

QColor color
 
qreal hue
 
qreal saturation
 
qreal value
 
unsigned wheelWidth READ
 
Display_Flags displayFlags
 

Detailed Description

Display an analog widget that allows the selection of a HSV color.

Author
Mattia Basaglia

License

Copyright (C) 2013-2015 Mattia Basaglia

This software is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This software is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Color Widgets.  If not, see <http://www.gnu.org/licenses/>.

It has an outer wheel to select the Hue and an intenal square to select Saturation and Lightness.

Member Enumeration Documentation

Enumerator
SHAPE_DEFAULT 

Use the default shape.

SHAPE_TRIANGLE 

A triangle.

SHAPE_SQUARE 

A square.

SHAPE_FLAGS 

Mask for the shape flags.

ANGLE_DEFAULT 

Use the default rotation style.

ANGLE_FIXED 

The inner part doesn't rotate.

ANGLE_ROTATING 

The inner part follows the hue selector.

ANGLE_FLAGS 

Mask for the angle flags.

COLOR_DEFAULT 

Use the default colorspace.

COLOR_HSV 

Use the HSV color space.

COLOR_HSL 

Use the HSL color space.

COLOR_LCH 

Use Luma Chroma Hue (Y_601')

COLOR_FLAGS 

Mask for the color space flags.

FLAGS_DEFAULT 

Use all defaults.

FLAGS_ALL 

Mask matching all flags.

Constructor & Destructor Documentation

Color_Wheel::Color_Wheel ( QWidget *  parent = 0)
explicit
Color_Wheel::~Color_Wheel ( )

Member Function Documentation

QColor Color_Wheel::color ( ) const

Get current color.

void Color_Wheel::colorChanged ( QColor  )
signal

Emitted when the user selects a color or setColor is called

void Color_Wheel::colorSelected ( QColor  )
signal

Emitted when the user selects a color

Color_Wheel::Display_Flags Color_Wheel::defaultDisplayFlags ( Display_Flags  mask = FLAGS_ALL)
static

Get default display flags.

Color_Wheel::Display_Flags Color_Wheel::displayFlags ( Display_Flags  mask = FLAGS_ALL) const

Get display flags.

void Color_Wheel::displayFlagsChanged ( Color_Wheel::Display_Flags  flags)
signal
qreal Color_Wheel::hue ( ) const

Get current hue in the range [0-1].

void Color_Wheel::mouseMoveEvent ( QMouseEvent *  ev)
protected
void Color_Wheel::mousePressEvent ( QMouseEvent *  ev)
protected
Todo:
if click inside with distance from the selector indicator

selector_radius => place it there directly

(without the need to drag)
void Color_Wheel::mouseReleaseEvent ( QMouseEvent *  ev)
protected
void Color_Wheel::paintEvent ( QPaintEvent *  )
protected
void Color_Wheel::resizeEvent ( QResizeEvent *  )
protected
qreal Color_Wheel::saturation ( ) const

Get current saturation in the range [0-1].

void Color_Wheel::setColor ( QColor  c)
slot

Set current color.

void Color_Wheel::setDefaultDisplayFlags ( Display_Flags  flags)
static

Set the default display flags.

void Color_Wheel::setDisplayFlag ( Display_Flags  flag,
Display_Flags  mask 
)

Set a specific display flag.

Parameters
flagFlag replacing the mask
maskMask to be cleared
void Color_Wheel::setDisplayFlags ( Color_Wheel::Display_Flags  flags)
slot

Set the display flags.

Parameters
flagswhich will replace the current ones
void Color_Wheel::setHue ( qreal  h)
slot
Parameters
hHue [0-1]
void Color_Wheel::setSaturation ( qreal  s)
slot
Parameters
sSaturation [0-1]
void Color_Wheel::setValue ( qreal  v)
slot
Parameters
vValue [0-1]
void Color_Wheel::setWheelWidth ( unsigned int  w)

Set the width in pixels of the outer wheel.

QSize Color_Wheel::sizeHint ( ) const
qreal Color_Wheel::value ( ) const

Get current value in the range [0-1].

unsigned int Color_Wheel::wheelWidth ( ) const

Get the width in pixels of the outer wheel.

Property Documentation

QColor Color_Wheel::color
readwrite
Display_Flags Color_Wheel::displayFlags
readwrite
qreal Color_Wheel::hue
readwrite
unsigned wheelWidth Color_Wheel::READ
write
qreal Color_Wheel::saturation
readwrite
qreal Color_Wheel::value
readwrite

The documentation for this class was generated from the following files: