RosterItem.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright 2009, Andrea Anzani. All rights reserved.
  3. * Distributed under the terms of the MIT License.
  4. */
  5. #ifndef _ROSTER_ITEM_H
  6. #define _ROSTER_ITEM_H
  7. #include <Bitmap.h>
  8. #include <GradientLinear.h>
  9. #include <ListItem.h>
  10. #include <View.h>
  11. #include <String.h>
  12. #include "AppConstants.h"
  13. #include "Contact.h"
  14. #include "Observer.h"
  15. class RosterItem : public BStringItem, public Observer {
  16. public:
  17. RosterItem(const char* name, Contact* contact);
  18. ~RosterItem();
  19. bool IsVisible() const { return fVisible; }
  20. void SetVisible(bool visible);
  21. void DrawItem(BView *owner, BRect frame,
  22. bool complete = false);
  23. void Update(BView *owner, const BFont *font);
  24. Contact* GetContact() { return fContact;}
  25. UserStatus Status() const { return fStatus; }
  26. void SetStatus(UserStatus status);
  27. BString PersonalStatus() const { return fPersonalStatus; }
  28. void SetPersonalStatus(BString str) { fPersonalStatus = str; }
  29. BBitmap* Bitmap() const { return fBitmap; }
  30. void SetBitmap(BBitmap *);
  31. protected:
  32. void ObserveString(int32 what, BString str);
  33. void ObservePointer(int32 what, void* ptr);
  34. void ObserveInteger(int32 what, int32 val);
  35. private:
  36. Contact* fContact;
  37. float fBaselineOffset;
  38. BString fPersonalStatus;
  39. UserStatus fStatus;
  40. BBitmap* fBitmap;
  41. bool fVisible;
  42. BGradientLinear fGradient;
  43. };
  44. #endif // _ROSTER_ITEM_H