1 #ifndef SL_TOASTERBOX_HH 2 #define SL_TOASTERBOX_HH 3 4 #include "ToasterBoxWindow.h" 5 #include "ToasterBoxWindowList.h" 6 #include "../utils/mixins.hh" 7 /* 8 The toasterbox class should stay resident in memory. 9 It creates and displays popups and handles the 10 "stacking". 11 */ 12 13 class ToasterNotification; 14 15 class ToasterBox : public wxTimer 16 { 17 public: 18 ~ToasterBox(); 19 void SetPopupText(wxString _text, bool /*_shrink*/ = false){popupText = _text;} SetPopupSize(int x,int y)20 void SetPopupSize(int x, int y){popupSize = wxSize(x, y);} 21 void SetPopupPosition(int x, int y); 22 void SetPopupPosition(int pos); SetPopupPauseTime(int milliseconds)23 void SetPopupPauseTime(int milliseconds){pauseTime = milliseconds;} SetPopupBitmap(wxString _bitmapFile)24 void SetPopupBitmap(wxString _bitmapFile){bitmapFile = _bitmapFile;} SetPopupBitmap(const wxBitmap & bitmap)25 void SetPopupBitmap(const wxBitmap& bitmap){ m_bitmap = bitmap; } 26 void SetPopupBackgroundColor(int r, int g, int b); 27 void SetPopupTextColor(int r, int g, int b); SetPopupScrollSpeed(int _sleepTime)28 void SetPopupScrollSpeed(int _sleepTime){sleepTime = _sleepTime;} 29 void MoveAbove(ToasterBoxWindow *tb); GetPopupText()30 wxString GetPopupText(){return popupText;} 31 void Play(); 32 bool DoesTextFit(); 33 void Notify(); 34 void CleanList(); 35 void StartAll(bool start = true); 36 enum StackDirection { 37 StackUp = -1, 38 StackDown = 1 39 }; 40 void SetStackDirection( StackDirection dir ); 41 42 protected: 43 friend class ToasterNotification; 44 ToasterBox(wxWindow* _parent=(wxWindow *)NULL); 45 46 private: 47 wxWindow *parent; 48 int sleepTime; 49 //how long the box hangs around for 50 int pauseTime; 51 wxString popupText; 52 wxPoint bottomRight, popupTop, popupPosition; 53 wxSize popupSize; 54 wxStaticBitmap sbm; 55 wxColour colFg, colBg; 56 wxString bitmapFile; 57 ToasterBoxWindowList *winList; 58 wxBitmap m_bitmap; 59 //should we attempt to shrink the text 60 //if it's too big for the popup? 61 // bool shrink; 62 StackDirection m_stack_direction; 63 }; 64 65 #endif //SL_TOASTERBOX_HH 66