Re: Create Window (not rectangle)
HalloUlrich wrote:
How can I create a window not as an rectangle. e.g. as a circle or
polygon.
class Shape
{
public:
virtual void Draw() = 0;
// ...
};
class Circle : public Shape
{
public:
virtual void Draw() { /*...*/ }
// ...
};
class Polygon : public Shape
{
public:
virtual void Draw() { /*...*/ }
// ...
};
class Window
{
public:
Window( std::auto_ptr<Shape> windowShape )
: windowShape_( windowShape )
{}
virtual void Draw() { /*... use windowShape_ ... */ }
// ...
private:
std::tr1::scoped_ptr<Shape> windowShape_;
};
std::auto_ptr<Window> CreateCircularWindow()
{
std::auto_ptr<Shape> windowShape( new Circle( /*...*/ ) );
return std::auto_ptr<Window>( new Window( windowShape ) );
}
void Foo()
{
std::auto_ptr<Window> window( CreateCircularWindow() );
// ... Now a circular window has been created. Q.E.D.
}
Can I use the function CreateWindow from windows-API?
Unlike the standard C++ question above, this is off-topic here. See the
FAQ for what is on-topic and for some suggestions of where you can post
to get an answer to your question:
http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.9
Cheers! --M