Non-Rectangular buttons Topic is solved

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
priyank_bolia
wxWorld Domination!
wxWorld Domination!
Posts: 1339
Joined: Wed Aug 03, 2005 8:10 am
Location: BANGALORE, INDIA
Contact:

Non-Rectangular buttons

Post by priyank_bolia »

How to have elliptical buttons?
ssigala
Earned some good credits
Earned some good credits
Posts: 109
Joined: Fri Sep 03, 2004 9:30 am
Location: Brescia, Italy

Re: Non-Rectangular buttons

Post by ssigala »

priyank_bolia wrote:How to have elliptical buttons?
You have to write your own button class, deriving from wxControl, drawing the button in the pressed/released states and handle mouse/keyboard events.

But I'm sure you find something already done, this was a common question.
Sandro Sigala - Kynosoft, Brescia
User avatar
T-Rex
Moderator
Moderator
Posts: 1248
Joined: Sat Oct 23, 2004 9:58 am
Location: Zaporizhzhya, Ukraine
Contact:

Post by T-Rex »

I had the same problem some time ago.
I managed how to implement round buttons using ::SetWindowRgn WinAPI function but I have no idea how to do it under GTK and it seems that noone could help me (all GTK samples with round buttons that I found in Internet don't work correctly with wx :().
At least you can use the source of wxTopLevelWindowMSW::SetShape to do this under Windows
priyank_bolia
wxWorld Domination!
wxWorld Domination!
Posts: 1339
Joined: Wed Aug 03, 2005 8:10 am
Location: BANGALORE, INDIA
Contact:

Post by priyank_bolia »

Well I don't have linux and didn't seen MAC & Unix in my life and no hope in the future also, but the client requirement is cross portability. So, I would like something from wxWidgets or its derivative. Also, as the whole GUI has to be custom one, I would like a already written and tested thing to do my work quickly.
priyank_bolia
wxWorld Domination!
wxWorld Domination!
Posts: 1339
Joined: Wed Aug 03, 2005 8:10 am
Location: BANGALORE, INDIA
Contact:

Post by priyank_bolia »

I just have a mask image and in the left button down of the derived class from wxBitmapButton:

Code: Select all

void wxCustomButton::OnLeftDown(wxMouseEvent& evt)
{
	wxPoint pt = evt.GetPosition();
	if(m_maskBitmap.GetRed(pt.x, pt.y))
		evt.Skip();
}
Its done.
Post Reply