00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef _BITMAP_BUTTON_H
00014 #define _BITMAP_BUTTON_H
00015
00016 #include <Button.h>
00017 #include <Bitmap.h>
00018
00019 namespace BExperimental {
00020
00021 class BBitmapButton : public BButton
00022 {
00023 public:
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 BBitmapButton(BRect frame, const char* name,
00036 const char* label,
00037 BMessage* message,
00038 const BBitmap* bmNormal = NULL,
00039 const BBitmap* bmOver = NULL,
00040 const BBitmap* bmPressed = NULL,
00041 const BBitmap* bmDisabled = NULL,
00042 const BBitmap* bmDisabledPressed = NULL,
00043 uint32 resizeMask = B_FOLLOW_LEFT | B_FOLLOW_TOP);
00044 virtual ~BBitmapButton();
00045
00046 virtual void AttachedToWindow();
00047 virtual void MouseDown(BPoint where);
00048 virtual void MouseMoved(BPoint where, uint32 transit, const BMessage *drag);
00049 virtual void MouseUp(BPoint where);
00050 virtual void Draw(BRect updateRect);
00051 virtual void GetPreferredSize(float* width, float* height);
00052
00053 virtual void MakeFocus(bool focusState = true);
00054 virtual void SetValue(int32 value);
00055 virtual void SetEnabled(bool on);
00056 virtual status_t Invoke(BMessage *msg = NULL);
00057
00058
00059
00060
00061
00062 const BBitmap* NormalBitmap(bool create=true) const;
00063 const BBitmap* OverBitmap(bool create=true) const;
00064 const BBitmap* PressedBitmap(bool create=true) const;
00065 const BBitmap* DisabledBitmap(bool create=true) const;
00066 const BBitmap* DisabledPressedBitmap(bool create=true) const;
00067
00068 void SetNormalBitmap(const BBitmap* bmap);
00069 void SetOverBitmap(const BBitmap* bmap);
00070 void SetPressedBitmap(const BBitmap* bmap);
00071 void SetDisabledBitmap(const BBitmap* bmap);
00072 void SetDisabledPressedBitmap(const BBitmap* bmap);
00073
00074
00075
00076
00077
00078 enum label_position {
00079 LABEL_LEFT = 0,
00080 LABEL_TOP,
00081 LABEL_RIGHT,
00082 LABEL_BOTTOM
00083 };
00084
00085 void SetLabelPosition(label_position pos);
00086 label_position LabelPosition() const;
00087
00088 private:
00089 typedef BButton inherited;
00090
00091 const BBitmap* RawBitmap() const;
00092
00093 const BBitmap* fRawBitmap;
00094 const BBitmap* fNormalBitmap;
00095 const BBitmap* fOverBitmap;
00096 const BBitmap* fPressedBitmap;
00097 const BBitmap* fDisabledBitmap;
00098 const BBitmap* fDisabledPressedBitmap;
00099
00100 bool fMadeNormal;
00101 bool fMadeOver;
00102 bool fMadePressed;
00103 bool fMadeDisabled;
00104 bool fMadeDisabledPressed;
00105
00106 label_position fLabelPosition;
00107
00108 bool fMousePressed;
00109 bool fMouseOver;
00110
00111 bool fSettingValue;
00112 };
00113
00114 }
00115
00116 #endif