//////////////////////////////////////////////////////////////////////////////////////////////////// // NoesisGUI - http://www.noesisengine.com // Copyright (c) 2013 Noesis Technologies S.L. All Rights Reserved. //////////////////////////////////////////////////////////////////////////////////////////////////// #ifndef __GUI_PATH_H__ #define __GUI_PATH_H__ #include #include #include namespace Noesis { class Geometry; class GeometryGroup; NS_WARNING_PUSH NS_MSVC_WARNING_DISABLE(4251 4275) //////////////////////////////////////////////////////////////////////////////////////////////////// /// Draws a series of connected lines and curves. /// /// The Path object can draw closed or open shapes, multiple shapes, and even curved shapes. Unlike /// the Line and Polyline objects, you can use this object to draw curves. /// /// The following example shows how to create a Path element and set its properties by using code. /// /// .. code-block:: c++ /// :caption: C++ /// /// // Geometry /// Ptr geometry = MakePtr; /// /// StreamGeometryContext context = geometry->Open(); /// context.BeginFigure(Point(260.0f, 200.0f), true); /// context.ArcTo(Point(140.0f, 200.0f), Size(60.0f, 60.0f), 0, false, true); /// context.ArcTo(Point(260.0f, 200.0f), Size(60.0f, 60.0f), 0, false, true); /// context.Close(); /// /// // Path /// Ptr path = MakePtr(); /// Ptr red = MakePtr(Color::Red); /// path->SetFill(red); /// path->SetData(geometry); /// /// // Root canvas /// Ptr root = MakePtr; /// Ptr gray = MakePtr(Color::LightGray); /// root->SetBackground(gray); /// root->GetChildren()->Add(path); /// /// .. code-block:: xml /// :caption: XAML /// /// /// /// /// /// http://msdn.microsoft.com/en-us/library/system.windows.shapes.path.aspx //////////////////////////////////////////////////////////////////////////////////////////////////// class NS_GUI_CORE_API Path final: public Shape { public: Path(); ~Path(); /// Gets or sets the geometry that specifies the shape to be drawn //@{ Geometry* GetData() const; void SetData(Geometry* data); //@} public: /// Dependency properties //@{ static const DependencyProperty* DataProperty; //@} protected: /// From DependencyObject //@{ bool OnPropertyChanged(const DependencyPropertyChangedEventArgs& args) override; //@} /// From UIElement //@{ void OnRender(DrawingContext* context) override; //@} /// From FrameworkElement //@{ Size MeasureOverride(const Size& availableSize) override; Size ArrangeOverride(const Size& finalSize) override; //@} /// From Shape //@{ Geometry* GetRenderGeometry() const override; //@} private: Size GetMinimumSize() const; private: MatrixTransform mStretchMatrix; Ptr mRenderGeometry; NS_DECLARE_REFLECTION(Path, Shape) }; NS_WARNING_POP } #endif