2010-05-07 04:47:10 -05:00
|
|
|
/*
|
|
|
|
BitmapListItem.h: A BMenuItem with an optional picture
|
|
|
|
Written by DarkWyrm <darkwyrm@earthlink.net>, Copyright 2007
|
|
|
|
Released under the MIT license.
|
|
|
|
*/
|
|
|
|
#ifndef BITMAP_MENU_ITEM_H
|
|
|
|
#define BITMAP_MENU_ITEM_H
|
|
|
|
|
|
|
|
#include <MenuItem.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
BitmapMenuItems are simple little items, really. They provide the
|
|
|
|
ability to show a menu item with some text, a picture, or both. The item
|
2021-08-03 10:15:04 -05:00
|
|
|
optionally takes ownership of the BBitmap given to it.
|
2010-05-07 04:47:10 -05:00
|
|
|
Note that it is still possible to see the checkmark on marked
|
|
|
|
BitmapMenuItems -- the bitmap does not obscure the checkmark.
|
|
|
|
*/
|
|
|
|
|
2013-01-04 07:52:14 -06:00
|
|
|
class BitmapMenuItem : public BMenuItem {
|
2010-05-07 04:47:10 -05:00
|
|
|
public:
|
2021-08-03 10:15:04 -05:00
|
|
|
BitmapMenuItem(const char* label, BMessage* msg,
|
|
|
|
BBitmap* bitmap, char shortcut = 0,
|
|
|
|
uint32 modifiers = 0, bool ownership = true);
|
|
|
|
BitmapMenuItem(BMessage* data);
|
|
|
|
virtual ~BitmapMenuItem(void);
|
|
|
|
|
|
|
|
virtual status_t Archive(BMessage* data, bool deep = true) const;
|
2010-05-07 04:47:10 -05:00
|
|
|
|
2021-08-03 10:15:04 -05:00
|
|
|
virtual void GetContentSize(float* width, float* height);
|
2010-05-07 04:47:10 -05:00
|
|
|
virtual void DrawContent(void);
|
|
|
|
|
2021-08-03 10:15:04 -05:00
|
|
|
virtual void SetBitmap(BBitmap* bitmap);
|
|
|
|
BBitmap* Bitmap(void) const { return fBitmap; }
|
2010-05-07 04:47:10 -05:00
|
|
|
|
|
|
|
private:
|
2021-08-03 10:15:04 -05:00
|
|
|
BBitmap* fBitmap;
|
2013-01-04 07:52:14 -06:00
|
|
|
float fBaselineOffset;
|
2021-08-03 10:15:04 -05:00
|
|
|
bool fOwnership;
|
2010-05-07 04:47:10 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|