1 // This file is part of Golly. 2 // See docs/License.html for the copyright notice. 3 4 #ifndef _WXSTATUS_H_ 5 #define _WXSTATUS_H_ 6 7 #include "bigint.h" // for bigint 8 9 // Define a child window for status bar at top of main frame: 10 11 class StatusBar : public wxWindow 12 { 13 public: 14 StatusBar(wxWindow* parent, wxCoord xorg, wxCoord yorg, int wd, int ht); 15 ~StatusBar(); 16 17 void ClearMessage(); 18 // erase bottom line of status bar 19 20 void DisplayMessage(const wxString& s); 21 // display message on bottom line of status bar 22 23 void ErrorMessage(const wxString& s); 24 // beep and display message on bottom line of status bar 25 26 void SetMessage(const wxString& s); 27 // set message string without displaying it (until next update) 28 29 void UpdateXYLocation(); 30 // XY location needs to be updated 31 32 void CheckMouseLocation(bool active); 33 // check location of mouse and update XY location if necessary 34 35 wxString Stringify(const bigint& b); 36 // convert given number to string suitable for display 37 38 int GetCurrentDelay(); 39 // return current delay (in millisecs) 40 GetStatusFont()41 wxFont* GetStatusFont() { return &statusfont; } GetTextAscent()42 int GetTextAscent() { return textascent; } 43 44 int statusht; // status bar height (0 if not visible, else STATUS_HT or STATUS_EXHT) 45 46 private: 47 // any class wishing to process wxWidgets events must use this macro 48 DECLARE_EVENT_TABLE() 49 50 // event handlers 51 void OnPaint(wxPaintEvent& event); 52 void OnMouseDown(wxMouseEvent& event); 53 void OnEraseBackground(wxEraseEvent& event); 54 55 bool ClickInGenBox(int x, int y); 56 bool ClickInPopBox(int x, int y); 57 bool ClickInScaleBox(int x, int y); 58 bool ClickInStepBox(int x, int y); 59 void SetStatusFont(wxDC& dc); 60 void DisplayText(wxDC& dc, const wxString& s, wxCoord x, wxCoord y); 61 void DrawStatusBar(wxDC& dc, wxRect& updaterect); 62 63 wxBitmap* statbitmap; // status bar bitmap 64 int statbitmapwd; // width of status bar bitmap 65 int statbitmapht; // height of status bar bitmap 66 67 int h_gen; // horizontal position of "Generation" 68 int h_pop; // horizontal position of "Population" 69 int h_scale; // horizontal position of "Scale" 70 int h_step; // horizontal position of "Step" 71 int h_xy; // horizontal position of "XY" 72 int textascent; // vertical adjustment used in DrawText calls 73 wxString statusmsg; // for messages on bottom line 74 bigint currx, curry; // cursor location in cell coords 75 bool showxy; // show cursor's XY location? 76 wxFont statusfont; // status bar font 77 }; 78 79 extern const int STATUS_HT; // normal status bar height 80 extern const int STATUS_EXHT; // height when showing exact numbers 81 82 #endif 83