Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
hdicoreLabel.h
Go to the documentation of this file.
1
7#ifndef __HDI_CORE_LABEL__
8#define __HDI_CORE_LABEL__
9
10#include "hdicoreWidget.h"
11
12namespace hdi
13{
14 namespace core
15 {
16 class Callback;
17 class Color;
18 class TextField;
19 class TextView;
20
21 #if defined(HDI_CORE_AIP_MODE)
22 class Panel;
23 #endif
24
28 class Label : public Widget
29 {
30 public:
31 friend class TextField;
32 friend class TextView;
33
38 {
39 UnknownAlignment = 0,
40 LeftAlignment = 10,
41 CenterAlignment = 20,
42 RightAlignment = 30
43 };
44
49 {
50 NoFrameShape = 0,
51 RectangleFrameShape = 10,
52 RoundedRectFrameShape = 20,
53 CapsuleFrameShape = 30
54 };
55
67
75 Label(const Label& label_);
76
91 Label(const Point& loc_, const std::string& title_, const WindowType containerType_);
92
102 Label(const Point& loc_, const std::string& title_, const double width_);
103
112 Label(const Rect& frame_, const ImageWithRolloverIDs& imageIDs_);
113
124 Label(const Rect& frame_, const SVGWithRolloverIDs& svgIDs_, const Size& dims_ = Size());
125
131 virtual ~Label();
132
141 virtual Label& operator=(const Label& rhs_);
142
156 virtual Label* clone() const;
157
168 virtual Label* duplicate() const;
169
179 virtual std::string text() const;
180
190 virtual void setText(const std::string& text_);
191
199 virtual Alignment alignment() const;
200
208 virtual void setAlignment(const Alignment alignment_);
209
217 virtual bool bold() const;
218
228 virtual void setBold(const bool bold_);
229
237 virtual bool italic() const;
238
248 virtual void setItalic(const bool italic_);
249
259 virtual FrameShape frameShape() const;
260
270 virtual void setFrameShape(const FrameShape shape_);
271
282 virtual void frameColors(Color& light__, Color& dark__) const;
283
295 virtual void setFrameColors(const Color& light_, const Color& dark_);
296
309 virtual bool textColors(Color& light__, Color& dark__) const;
310
321 virtual void setTextColors(const Color& light_, const Color& dark_);
322
330 virtual std::unique_ptr<TextField> textField() const;
331
341 virtual void setTextField(TextField& field_);
342
348 virtual void removeTextField();
349
357 virtual std::unique_ptr<TextView> textView() const;
358
368 virtual void setTextView(TextView& view_);
369
375 virtual void removeTextView();
376
377 #if defined(HDI_CORE_AIP_MODE)
385 virtual std::unique_ptr<Panel> linkedPanel() const;
386
396 virtual void setLinkedPanel(const Panel& p_);
397
403 virtual void removeLinkedPanel();
404 #endif
405 // HDI_CORE_AIP_MODE
406
412 virtual void click();
413
421 virtual Callback* const clickCallback() const;
422
430 virtual void setClickCallback(const Callback& callback_);
431
437 virtual void doubleClick();
438
446 virtual Callback* const doubleClickCallback() const;
447
455 virtual void setDoubleClickCallback(const Callback& callback_);
456
465
473 virtual void setImageIDs(const ImageWithRolloverIDs& ids_);
474
482 virtual SVGWithRolloverIDs svgIDs() const;
483
491 virtual void setSVGIDs(const SVGWithRolloverIDs& ids_);
492
500 virtual bool backgroundRollover() const;
501
509 virtual void setBackgroundRollover(const bool ro_);
510
518 virtual bool draggable() const;
519
527 virtual void setDraggable(const bool enable_);
528
539 virtual std::string dragData() const;
540
551 virtual void setDragData(const std::string& data_);
552
560 virtual bool droppable() const;
561
569 virtual void setDroppable(const bool enable_);
570
578 virtual Callback* const dropCallback() const;
579
587 virtual void setDropCallback(const Callback& callback_);
588
598 virtual std::string droppedData() const;
599
609 virtual Point droppedPoint() const;
610
621 static double idealHeight(const std::string& text_, const double width_, const WindowType containerType_);
622
633 static double idealWidth(const std::string& text_, const double height_, const WindowType containerType_);
634 };
635
636 typedef std::unique_ptr<Label> LabelUP;
637 typedef std::shared_ptr<Label> LabelSP;
638 typedef std::weak_ptr<Label> LabelWP;
639 }
640}
641
642#endif
643// __HDI_CORE_LABEL__
Base class for templated __Callback class.
Definition: hdicoreCallback.h:68
Describes an RGB color, with opacity, typically for UI purposes.
Definition: hdicoreColor.h:32
Allows for image rollover support.
Definition: hdicoreImageIDs.h:220
Label widget, for simply displaying text or images inside a window.
Definition: hdicoreLabel.h:29
virtual void setTextColors(const Color &light_, const Color &dark_)
Sets the colors for the text of the label.
virtual void setDropCallback(const Callback &callback_)
Sets the drop callback for the widget.
virtual bool bold() const
Gets whether the text is bold.
virtual void setBold(const bool bold_)
Sets the font weight.
virtual void setClickCallback(const Callback &callback_)
Sets the click callback for the label.
virtual std::string text() const
Gets the current text value of the label.
virtual SVGWithRolloverIDs svgIDs() const
Gets the SVG resource IDs of the widget.
virtual void setItalic(const bool italic_)
Sets the font style.
virtual void frameColors(Color &light__, Color &dark__) const
Gets the colors for the background of the label frame.
virtual void setFrameShape(const FrameShape shape_)
Sets the shape for the background of the label frame.
virtual void setDroppable(const bool enable_)
Sets whether dropping support for this particular widget is enabled.
virtual void setText(const std::string &text_)
Sets the current text value of the label.
static double idealHeight(const std::string &text_, const double width_, const WindowType containerType_)
Gets the ideal height for a label, given its value and a known width.
virtual void setSVGIDs(const SVGWithRolloverIDs &ids_)
Sets the SVG resource IDs of the widget.
virtual bool droppable() const
Gets whether dropping support for this particular widget is enabled.
virtual void setFrameColors(const Color &light_, const Color &dark_)
Sets the colors for the background of the label frame.
virtual void setImageIDs(const ImageWithRolloverIDs &ids_)
Sets the PNGI resource IDs of the widget.
virtual Callback *const clickCallback() const
Gets the current click callback for the label.
Label(const Rect &frame_, const SVGWithRolloverIDs &svgIDs_, const Size &dims_=Size())
Constructs a static image label.
virtual ImageWithRolloverIDs imageIDs() const
Gets the PNGI resource IDs of the widget.
virtual FrameShape frameShape() const
Gets the shape for the background of the label frame.
virtual Callback *const dropCallback() const
Gets the current drop callback for the widget.
virtual void setBackgroundRollover(const bool ro_)
Sets whether the background of the label should change in appearance upon mouse-over.
virtual ~Label()
Label destructor.
virtual Point droppedPoint() const
Gets the point at which the drop occurred, in the widget's coordinate system.
virtual std::string dragData() const
Gets the data that will be passed when the widget is dropped on a receiver.
virtual std::string droppedData() const
Gets the data that was passed when the widget received a drop.
virtual void removeLinkedPanel()
Removes the panel that should be shown when the label is clicked.
virtual void click()
Simulates a click on the label.
virtual bool backgroundRollover() const
Gets whether the background of the label should change in appearance upon mouse-over.
virtual std::unique_ptr< Panel > linkedPanel() const
Gets the panel that the target label has been associated with.
Label(const Point &loc_, const std::string &title_, const WindowType containerType_)
Constructs a static text label.
Alignment
Text alignment options.
Definition: hdicoreLabel.h:38
virtual Alignment alignment() const
Gets the current alignment of the label.
virtual void removeTextField()
Removes the text field that should be focused when the label is clicked.
Label(const Rect &frame_, const ImageWithRolloverIDs &imageIDs_)
Constructs a static image label.
static double idealWidth(const std::string &text_, const double height_, const WindowType containerType_)
Gets the ideal width for a label, given its value and a known height.
virtual void setDoubleClickCallback(const Callback &callback_)
Sets the double-click callback for the label.
Label(const Point &loc_, const std::string &title_, const double width_)
Constructs a static text label.
virtual bool textColors(Color &light__, Color &dark__) const
Gets the colors for the text of the label.
Label()
Constructs an empty Label object.
virtual void setAlignment(const Alignment alignment_)
Sets the current alignment of the label.
virtual std::unique_ptr< TextView > textView() const
Gets the text view that the target label has been associated with.
virtual void setTextView(TextView &view_)
Sets the text view that should be focused when the label is clicked.
Label(const Label &label_)
Constructs a new Label object from an existing Label object (copy constructor)
virtual void setTextField(TextField &field_)
Sets the text field that should be focused when the label is clicked.
virtual Label * duplicate() const
Convenience method to duplicate a Label object, creating a new and identical UI element to the target...
virtual void setLinkedPanel(const Panel &p_)
Sets the panel that should be shown when the label is clicked.
FrameShape
Background frame shape drawing options.
Definition: hdicoreLabel.h:49
virtual std::unique_ptr< TextField > textField() const
Gets the text field that the target label has been associated with.
virtual void setDraggable(const bool enable_)
Sets whether dragging support for this particular widget is enabled.
virtual Label * clone() const
Convenience method to clone a Label object on the heap.
virtual Label & operator=(const Label &rhs_)
Allows one Label object to be assigned from another.
virtual Callback *const doubleClickCallback() const
Gets the current double-click callback for the label.
virtual void setDragData(const std::string &data_)
Sets the data that will be passed when the widget is dropped on a receiver.
virtual bool italic() const
Gets whether the text is italicized.
virtual bool draggable() const
Gets whether dragging support for this particular widget is enabled.
virtual void doubleClick()
Simulates a double-click on the label.
virtual void removeTextView()
Removes the text view that should be focused when the label is clicked.
Used to add a panel to Illustrator's UI and contain various UI widgets.
Definition: hdicorePanel.h:36
Describes a point in the 2-dimensional (x,y) coordinate system, typically in an Illustrator document ...
Definition: hdicorePoint.h:38
Contains Point and Size objects to describe a rectangle that exists at a specific point of given dime...
Definition: hdicoreRect.h:34
Allows for image rollover support.
Definition: hdicoreSVGIDs.h:120
Contains a width and height for a rectangular shape.
Definition: hdicoreSize.h:25
Text field widget, which allows the user to enter arbitrary text values.
Definition: hdicoreTextField.h:23
Text view widget, which allows the user to enter a large amount of arbitrary text (also useful for di...
Definition: hdicoreTextView.h:24
Base class for all interface widgets; handles many common needs, e.g. text, position,...
Definition: hdicoreWidget.h:30
WindowType
Describes the type of a Window object, allowing for proper casting to its subclass.
Definition: hdicoreTypes.h:822
Header file for plugin user interface widgets.