File: wxstatus.h

package info (click to toggle)
golly 3.3-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 20,176 kB
  • sloc: cpp: 72,638; ansic: 25,919; python: 7,921; sh: 4,245; objc: 3,721; java: 2,781; xml: 1,362; makefile: 530; javascript: 279; perl: 69
file content (82 lines) | stat: -rwxr-xr-x 2,902 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// This file is part of Golly.
// See docs/License.html for the copyright notice.

#ifndef _WXSTATUS_H_
#define _WXSTATUS_H_

#include "bigint.h"     // for bigint

// Define a child window for status bar at top of main frame:

class StatusBar : public wxWindow
{
public:
    StatusBar(wxWindow* parent, wxCoord xorg, wxCoord yorg, int wd, int ht);
    ~StatusBar();
    
    void ClearMessage();
    // erase bottom line of status bar
    
    void DisplayMessage(const wxString& s);
    // display message on bottom line of status bar
    
    void ErrorMessage(const wxString& s);
    // beep and display message on bottom line of status bar
    
    void SetMessage(const wxString& s);
    // set message string without displaying it (until next update)
    
    void UpdateXYLocation();
    // XY location needs to be updated
    
    void CheckMouseLocation(bool active);
    // check location of mouse and update XY location if necessary
    
    wxString Stringify(const bigint& b);
    // convert given number to string suitable for display
    
    int GetCurrentDelay();
    // return current delay (in millisecs)
    
    wxFont* GetStatusFont() { return &statusfont; }
    int GetTextAscent() { return textascent; }
    
    int statusht;   // status bar height (0 if not visible, else STATUS_HT or STATUS_EXHT)
    
private:
    // any class wishing to process wxWidgets events must use this macro
    DECLARE_EVENT_TABLE()
    
    // event handlers
    void OnPaint(wxPaintEvent& event);
    void OnMouseDown(wxMouseEvent& event);
    void OnEraseBackground(wxEraseEvent& event);
    
    bool ClickInGenBox(int x, int y);
    bool ClickInPopBox(int x, int y);
    bool ClickInScaleBox(int x, int y);
    bool ClickInStepBox(int x, int y);
    void SetStatusFont(wxDC& dc);
    void DisplayText(wxDC& dc, const wxString& s, wxCoord x, wxCoord y);
    void DrawStatusBar(wxDC& dc, wxRect& updaterect);
    
    wxBitmap* statbitmap;       // status bar bitmap
    int statbitmapwd;           // width of status bar bitmap
    int statbitmapht;           // height of status bar bitmap
    
    int h_gen;                  // horizontal position of "Generation"
    int h_pop;                  // horizontal position of "Population"
    int h_scale;                // horizontal position of "Scale"
    int h_step;                 // horizontal position of "Step"
    int h_xy;                   // horizontal position of "XY"
    int textascent;             // vertical adjustment used in DrawText calls
    wxString statusmsg;         // for messages on bottom line
    bigint currx, curry;        // cursor location in cell coords
    bool showxy;                // show cursor's XY location?
    wxFont statusfont;          // status bar font
};

extern const int STATUS_HT;     // normal status bar height
extern const int STATUS_EXHT;   // height when showing exact numbers

#endif