[haiku-development] Re: How to create BPictureButton
- From: "Stefano Ceccherini" <stefano.ceccherini@xxxxxxxxx>
- To: haiku-development@xxxxxxxxxxxxx
- Date: Wed, 27 Aug 2008 09:35:11 +0200
2008/8/27 James Kim <jkim202@xxxxxxxxxxxxxxxxx>:
> Hi!
>
> It looks like recent discussions are all to do with Haiku alpha, but I
> really need help on creating BPictureButtons. I couldn't find any useful
> examples online or in the src directory.
>
> Could anyone please give me a quick help on creating buttons with an
> image (gif, jpeg) on the background? And possibly allow the image on the
> button to automatically scale to the button, even when it resizes.
Creating a BPictureButton is just a matter of passing an already
recorded picture to the constructor.
Recording a BPicture is just like drawing on a BView (you need to use
a BView, in fact), just that you call BeginPicture() before starting,
and call EndPicture() when you're done.
IOW:
BeginPicture(new BPicture);
here you call all your drawing methods (in your case, just DrawBitmap)
BPicture *picture = EndPicture();
picture will contain all the recorded drawing instructions. You can
pass it to the BPictureButton.
Check src/tests/kits/interface/picture/PictureTest.cpp for more details.
HTH.
- References:
- [haiku-development] Re: GCC 2 x GCC 4
- From: Mat Hounsell
- [haiku-development] How to create BPictureButton
- From: James Kim
Other related posts:
- » [haiku-development] How to create BPictureButton
- » [haiku-development] Re: How to create BPictureButton
- [haiku-development] Re: GCC 2 x GCC 4
- From: Mat Hounsell
- [haiku-development] How to create BPictureButton
- From: James Kim