Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Friends | List of all members
hdi::core::Layer Class Reference

Allows for layer metadata access, visibility manipulation, locking, etc. More...

#include <hdicoreLayer.h>

Classes

class  Iterator
 Allows for iteration through the siblings of a layer, a la std::vector iteration. More...
 

Public Types

typedef std::unique_ptr< IteratorIteratorUP
 
typedef std::shared_ptr< IteratorIteratorSP
 
typedef std::weak_ptr< IteratorIteratorWP
 
typedef Color ColorType
 

Public Member Functions

 Layer ()
 Constructs an empty Layer object.
 
 Layer (const Layer &layer_)
 Constructs a Layer object from an existing Layer object (copy constructor)
 
 Layer (const AILayerHandle aiLayer_)
 Constructs a new Layer object from an AILayerHandle.
 
 Layer (const PaintOrder order_, const Layer *const prep_=NULL)
 Inserts a new layer at a given position in the layer list in the current document.
 
virtual ~Layer ()
 Layer destructor.
 
virtual Layeroperator= (const Layer &rhs_)
 Assigns one Layer object to another.
 
virtual AILayerHandle aiLayerHandle () const
 Gets the layer handle around which the target object is wrapped.
 
virtual bool isEmpty () const
 Gets whether the target Layer object is empty (constructed with the default ctor)
 
virtual bool dispose ()
 Removes the layer from the document.
 
virtual bool editable () const
 Gets whether the target layer is editable.
 
virtual void setEditable (const bool editable_)
 Sets whether the target layer is editable.
 
virtual bool locked () const
 Gets whether the target layer is locked.
 
virtual void setLocked (const bool locked_)
 Sets whether the target layer is locked.
 
virtual bool hasArt () const
 Gets whether the target layer has any art.
 
virtual bool hasSelectedArt () const
 Gets whether any of the target layer's art is selected.
 
virtual void deselectArt () const
 Deselects all of the target layer's art.
 
virtual std::unique_ptr< Artgroup () const
 Gets the first (invisible) art group inside the layer.
 
virtual std::unique_ptr< Layerparent () const
 Gets the parent layer object for the target layer.
 
virtual std::unique_ptr< LayerfirstChild () const
 Gets the first child layer object for the target layer.
 
virtual std::unique_ptr< Layersibling () const
 Gets the next sibling layer object for the target layer.
 
virtual std::unique_ptr< LayerpriorSibling () const
 Gets the previous sibling layer object for the target layer.
 
virtual std::unique_ptr< LayernextPreorderLayer () const
 Gets the next layer in preorder traversal, which returns descendents first.
 
virtual bool preview () const
 Gets the target layer's preview or outline mode setting.
 
virtual void setPreview (const bool preview_)
 Sets the target layer to preview or outline mode.
 
virtual bool printed () const
 Gets whether the target layer is considered printable when printing the document.
 
virtual void setPrinted (const bool printed_)
 Sets whether the target layer is considered printable when printing the document.
 
virtual bool dimsPlacedImages () const
 Gets whether images in the target layer are automatically dimmed.
 
virtual void setDimsPlacedImages (const bool dim_)
 Sets whether images in the target layer are automatically dimmed.
 
virtual bool convertToGroup ()
 Converts the target layer to an artwork group.
 
Iterator begin () const
 Gets an iterator for the layer in the target's parent layer, starting with the target.
 
virtual std::string name () const
 Gets the name for the target layer.
 
virtual void setName (const std::string &name_)
 Sets the name for the target layer.
 
virtual void show ()
 Shows the layer.
 
virtual void hide ()
 Hides the layer.
 
virtual bool visible () const
 Gets whether the target layer is visible.
 
virtual void setVisible (const bool visible_)
 Sets whether the target layer is visible.
 
virtual bool active () const
 Gets whether the target Layer object is the active (current) layer.
 
virtual ColorType color () const
 Gets the color of the layer in the layer list.
 
virtual void setColor (const ColorType color_)
 Sets the color of the layer in the layer list.
 
virtual bool operator== (const Layer &rhs_) const
 Tests whether a given Layer object is the same as another.
 
virtual bool operator!= (const Layer &rhs_) const
 Tests whether a given Layer object is not the same as another.
 
virtual bool valid () const
 Tests the validity of the target layer by checking its topmost "invisible" group.
 

Friends

class CurrentDocument
 
aip::Layer * __accessImpl (const Layer &)
 
Layer __accessCtor (aip::Layer *&)
 

Detailed Description

Allows for layer metadata access, visibility manipulation, locking, etc.

Constructor & Destructor Documentation

◆ Layer() [1/4]

hdi::core::Layer::Layer ( )

Constructs an empty Layer object.

Author
GW
Date
08/2013
Note
To test if a Layer object is empty, call isEmpty() on it
Empty Layer objects do not relate to any layer in the current document; they are designed to be "receivers" of some other Layer object via the overloaded assignment operator. Empty Layer objects are useless until such time (though it is safe to call any of their methods).

◆ Layer() [2/4]

hdi::core::Layer::Layer ( const Layer layer_)

Constructs a Layer object from an existing Layer object (copy constructor)

Author
GW
Date
08/2013
Parameters
layer_Existing Layer object

◆ Layer() [3/4]

hdi::core::Layer::Layer ( const AILayerHandle  aiLayer_)

Constructs a new Layer object from an AILayerHandle.

Author
GW
Date
08/2015
Parameters
aiLayer_Raw Illustrator AILayerHandle

◆ Layer() [4/4]

hdi::core::Layer::Layer ( const PaintOrder  order_,
const Layer *const  prep_ = NULL 
)

Inserts a new layer at a given position in the layer list in the current document.

Author
GW
Date
08/2013
Parameters
order_Order in which to create the layer
prep_Prepositional layer to which order_ will apply
Warning
This method does not assume responsibility of the memory for the prep_ argument.

◆ ~Layer()

virtual hdi::core::Layer::~Layer ( )
virtual

Layer destructor.

Author
GW
Date
08/2013

Member Function Documentation

◆ active()

virtual bool hdi::core::Layer::active ( ) const
virtual

Gets whether the target Layer object is the active (current) layer.

Author
GW
Date
08/2013
Returns
true if the layer is active, false otherwise

◆ aiLayerHandle()

virtual AILayerHandle hdi::core::Layer::aiLayerHandle ( ) const
virtual

Gets the layer handle around which the target object is wrapped.

Author
GW
Date
11/2013
Returns
AILayerHandle for this object
Note
Generally, you shouldn't need to call this method. Only use it if you know what you're doing. If a specific piece of functionality provided by Illustrator is not handled by this class (or related classes), then it should probably be added to the hdi_core library.

◆ begin()

Iterator hdi::core::Layer::begin ( ) const

Gets an iterator for the layer in the target's parent layer, starting with the target.

Author
GW
Date
08/2013
Returns
An Iterator object, for iterating through the target's siblings
// Here's an example, iterating through all top-level layers of a document:
HDI_CORE_ILLUSTRATOR->currentDocument()->firstLayer(layer0);
for(hdi::core::Layer::Iterator iter = layer0.begin(); !iter.atEnd(); ++iter)
{
// Do stuff with iter.layer() ...
}
// Here's another example, reverse iterating through all top-level layers of a document:
HDI_CORE_ILLUSTRATOR->currentDocument()->lastLayer(layerN);
for(hdi::core::Layer::Iterator iter = layerN.begin(); !iter.atEnd(); --iter)
{
// Do more stuff with iter.layer() ...
}
Allows for iteration through the siblings of a layer, a la std::vector iteration.
Definition: hdicoreLayer.h:62
bool atEnd() const
Determines whether iteration should stop; works well as the conditional in a for() loop.
Allows for layer metadata access, visibility manipulation, locking, etc.
Definition: hdicoreLayer.h:39
Iterator begin() const
Gets an iterator for the layer in the target's parent layer, starting with the target.
#define HDI_CORE_ILLUSTRATOR
Slightly shorter way to access the Illustrator instance, but still utilizing a non-colliding name sch...
Definition: hdicoreIllustrator.h:21

◆ color()

virtual ColorType hdi::core::Layer::color ( ) const
virtual

Gets the color of the layer in the layer list.

Author
GW
Date
08/2013
Returns
A Color object representing the RGB color of the layer in the app Layers panel

◆ convertToGroup()

virtual bool hdi::core::Layer::convertToGroup ( )
virtual

Converts the target layer to an artwork group.

Author
GW
Date
02/2016
Returns
true if the conversion was successful, false otherwise
Warning
Conversion is a destructive process. Once the target layer has been converted, the Layer object will become empty (i.e. its isEmpty() method will return true).
Note
Top-level layers cannot be converted; only sublayers.
Sublayers that themselves contain sublayers cannot be converted.

◆ deselectArt()

virtual void hdi::core::Layer::deselectArt ( ) const
virtual

Deselects all of the target layer's art.

Author
GW
Date
08/2013
Note
This method can be called whether or not any art is actually selected.

◆ dimsPlacedImages()

virtual bool hdi::core::Layer::dimsPlacedImages ( ) const
virtual

Gets whether images in the target layer are automatically dimmed.

Author
GW
Date
08/2013
Returns
true for dimming images, false otherwise

◆ dispose()

virtual bool hdi::core::Layer::dispose ( )
virtual

Removes the layer from the document.

Author
GW
Date
08/2013
Returns
true for successful disposal, false otherwise
Note
After calling dispose(), this object is basically useless! The actual layer is gone, so obviously none of these methods will work after that.

◆ editable()

virtual bool hdi::core::Layer::editable ( ) const
virtual

Gets whether the target layer is editable.

Author
GW
Date
08/2013
Returns
true for the layer being editable (unlocked), false otherwise
Note
This method always returns the opposite of locked() method.

◆ firstChild()

virtual std::unique_ptr< Layer > hdi::core::Layer::firstChild ( ) const
virtual

Gets the first child layer object for the target layer.

Author
GW
Date
08/2013
Returns
A Layer object for the container's first child, or NULL if none

◆ group()

virtual std::unique_ptr< Art > hdi::core::Layer::group ( ) const
virtual

Gets the first (invisible) art group inside the layer.

Author
GW
Date
08/2013
Returns
The Art object representing the layer group (layers are merely art groups with a little "sugar" added)

◆ hasArt()

virtual bool hdi::core::Layer::hasArt ( ) const
virtual

Gets whether the target layer has any art.

Author
GW
Date
08/2013
Returns
true if the layer contains art, false otherwise

◆ hasSelectedArt()

virtual bool hdi::core::Layer::hasSelectedArt ( ) const
virtual

Gets whether any of the target layer's art is selected.

Author
GW
Date
08/2013
Returns
true if the layer has any art selected, false otherwise

◆ hide()

virtual void hdi::core::Layer::hide ( )
virtual

Hides the layer.

Author
GW
Date
08/2013

◆ isEmpty()

virtual bool hdi::core::Layer::isEmpty ( ) const
virtual

Gets whether the target Layer object is empty (constructed with the default ctor)

Author
GW
Date
08/2013
Returns
true if the target Layer object is empty, false otherwise

◆ locked()

virtual bool hdi::core::Layer::locked ( ) const
virtual

Gets whether the target layer is locked.

Author
GW
Date
08/2013
Returns
true for the layer being locked (uneditable), false otherwise
Note
Always returns the opposite of editable() method.

◆ name()

virtual std::string hdi::core::Layer::name ( ) const
virtual

Gets the name for the target layer.

Author
GW
Date
08/2013
Returns
The name of the layer, as UTF-8

◆ nextPreorderLayer()

virtual std::unique_ptr< Layer > hdi::core::Layer::nextPreorderLayer ( ) const
virtual

Gets the next layer in preorder traversal, which returns descendents first.

Author
GW
Date
08/2013
Returns
A Layer object for the target's next preorder child or sibling (for recursive looping), or NULL if none

◆ operator!=()

virtual bool hdi::core::Layer::operator!= ( const Layer rhs_) const
virtual

Tests whether a given Layer object is not the same as another.

Author
GW
Date
08/2013
Parameters
rhs_Layer to compare against (righthand side of inequality operator)
Returns
true for the target and rhs_ being different layers, false otherwise

◆ operator=()

virtual Layer & hdi::core::Layer::operator= ( const Layer rhs_)
virtual

Assigns one Layer object to another.

Author
GW
Date
08/2013
Parameters
rhs_Existing Layer object to copy values from
Returns
The target Layer object, but with its values updated to match that of the rhs_ argument

◆ operator==()

virtual bool hdi::core::Layer::operator== ( const Layer rhs_) const
virtual

Tests whether a given Layer object is the same as another.

Author
GW
Date
08/2013
Parameters
rhs_Layer to compare against (righthand side of equality operator)
Returns
true for the target and rhs_ being the same layer, false otherwise

◆ parent()

virtual std::unique_ptr< Layer > hdi::core::Layer::parent ( ) const
virtual

Gets the parent layer object for the target layer.

Author
GW
Date
08/2013
Returns
The parent layer object, or NULL for none

◆ preview()

virtual bool hdi::core::Layer::preview ( ) const
virtual

Gets the target layer's preview or outline mode setting.

Author
GW
Date
08/2013
Returns
true for preview, false for outline

◆ printed()

virtual bool hdi::core::Layer::printed ( ) const
virtual

Gets whether the target layer is considered printable when printing the document.

Author
GW
Date
08/2013
Returns
true for printable, false otherwise

◆ priorSibling()

virtual std::unique_ptr< Layer > hdi::core::Layer::priorSibling ( ) const
virtual

Gets the previous sibling layer object for the target layer.

Author
GW
Date
08/2013
Returns
A Layer object for the target's previous sibling, or NULL if none

◆ setColor()

virtual void hdi::core::Layer::setColor ( const ColorType  color_)
virtual

Sets the color of the layer in the layer list.

Author
GW
Date
08/2013
Parameters
color_New layer color

◆ setDimsPlacedImages()

virtual void hdi::core::Layer::setDimsPlacedImages ( const bool  dim_)
virtual

Sets whether images in the target layer are automatically dimmed.

Author
GW
Date
08/2013
Parameters
dim_true to dim images, false otherwise

◆ setEditable()

virtual void hdi::core::Layer::setEditable ( const bool  editable_)
virtual

Sets whether the target layer is editable.

Author
GW
Date
08/2013
Parameters
editable_true to allow editing, false otherwise
Note
Always sets the layer to be locked.

◆ setLocked()

virtual void hdi::core::Layer::setLocked ( const bool  locked_)
virtual

Sets whether the target layer is locked.

Author
GW
Date
08/2013
Parameters
locked_true to lock, false otherwise
Note
Always makes the layer uneditable.

◆ setName()

virtual void hdi::core::Layer::setName ( const std::string &  name_)
virtual

Sets the name for the target layer.

Author
GW
Date
08/2013
Parameters
name_New layer name, as UTF-8

◆ setPreview()

virtual void hdi::core::Layer::setPreview ( const bool  preview_)
virtual

Sets the target layer to preview or outline mode.

Author
GW
Date
08/2013
Parameters
preview_true for preview, false for outline

◆ setPrinted()

virtual void hdi::core::Layer::setPrinted ( const bool  printed_)
virtual

Sets whether the target layer is considered printable when printing the document.

Author
GW
Date
08/2013
Parameters
printed_true for printable, false otherwise

◆ setVisible()

virtual void hdi::core::Layer::setVisible ( const bool  visible_)
virtual

Sets whether the target layer is visible.

Author
GW
Date
08/2013
Parameters
visible_true to make visible, false to hide
Note
This method simply calls show() or hide() as appropriate

◆ show()

virtual void hdi::core::Layer::show ( )
virtual

Shows the layer.

Author
GW
Date
08/2013

◆ sibling()

virtual std::unique_ptr< Layer > hdi::core::Layer::sibling ( ) const
virtual

Gets the next sibling layer object for the target layer.

Author
GW
Date
08/2013
Returns
A Layer object for the target's sibling, or NULL if none

◆ valid()

virtual bool hdi::core::Layer::valid ( ) const
virtual

Tests the validity of the target layer by checking its topmost "invisible" group.

Author
GW
Date
08/2013
Returns
true if the layer's group is valid, false otherwise

◆ visible()

virtual bool hdi::core::Layer::visible ( ) const
virtual

Gets whether the target layer is visible.

Author
GW
Date
08/2013
Returns
true for visible, false for hidden