Re: How to create round shape push buttons
- From: Maciej Katafiasz <ml mathrick org>
- To: abhijeet singh panwar <dearabhi gmail com>
- Cc: gtk-list gnome org
- Subject: Re: How to create round shape push buttons
- Date: Mon, 27 Dec 2004 00:31:37 +0100
Dnia 24-12-2004, pią o godzinie 10:40 +0530, abhijeet singh panwar
napisał:
> Hi,
>
> I am new to GTK. Is there any way to create round shaped push buttons
> with different colors. And on clicking on the button the color of the
> button should change.
You can first try (simpler approach) where you have two images, one
being the image you want to show on button, and second being the same
image with different colours you want to show in clicked state. Now, you
set pixmap as child of button in question, fill it with image1, and
catch "button-pressed" (or whatever's appropriate) signal, on which you
replace pixmap's contents with image2. On "button-release" you revert
pixmap back to image1. Advantages of this approach are simplicity and
non-intrusiveness, disadvantage will be that button will catch clicks on
entire rectangular area it has allocated, not only on visible pixels of
your image. If you don't want that, then you need to subclass GtkButton
and override appropriate methods and signal handlers so that it draws as
image and does whatever you want when clicked. You get more control
here, but also more work needs to be done.
HTH,
Maciej
--
Maciej Katafiasz <ml mathrick org>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]