Drawing shapes and controls

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
greekfellows
Earned a small fee
Earned a small fee
Posts: 20
Joined: Fri May 23, 2014 5:01 pm

Drawing shapes and controls

Post by greekfellows » Fri Sep 19, 2014 4:46 pm

I want to draw shapes with fill and stroke colors which I can specify, and within those shapes I want to draw controls like check boxes.

I know shapes are usually drawn with wxDC-derived classes, but is there such a way I can integrate controls in it?

Manolo
Can't get richer than this
Can't get richer than this
Posts: 713
Joined: Mon Apr 30, 2012 11:07 pm

Re: Drawing shapes and controls

Post by Manolo » Fri Sep 19, 2014 5:15 pm

wxNonOwnedWindow::SetShape() is used for some windows, most of them have no parent.
http://docs.wxwidgets.org/trunk/classwx ... indow.html

The frame may be shaped. You can add wxFRAME_SHAPED to your frame derived from wxFrame.

Normal widgets, by now, can't be shaped. If you want it, that's a really really true big coding effort.

greekfellows
Earned a small fee
Earned a small fee
Posts: 20
Joined: Fri May 23, 2014 5:01 pm

Re: Drawing shapes and controls

Post by greekfellows » Mon Sep 22, 2014 7:24 am

@Manolo thanks! I'm trying this out.

What I want is essentially to draw shapes in a wxPanel (like how we usually do with wxDC and have a wxPanel handle the wxEVT_PAINT);
and at the same time, draw controls like buttons and check boxes in the shapes.

I guess this is really going to be a huge effort because wxWidgets doesn't let me place controls by specifying coordinates.

User avatar
doublemax
Moderator
Moderator
Posts: 15263
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Drawing shapes and controls

Post by doublemax » Mon Sep 22, 2014 11:04 am

If you don't use sizers, you can place controls wherever you want. You will have to draw the shapes on a background panel and then place the controls on top. I don't know what exactly you're trying to do, but i doubt it will look good. Mixing native controls with custom drawings usually looks bad.
Use the source, Luke!

Post Reply