-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathLine.cpp
More file actions
35 lines (29 loc) · 1.37 KB
/
Line.cpp
File metadata and controls
35 lines (29 loc) · 1.37 KB
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
#include <wx/wx.h>
#include <wx/settings.h>
namespace LineExample {
class wxColouredLine : public wxPanel {
public:
wxColouredLine(wxWindow* parent, const wxColour& colour, const wxPoint& position = wxDefaultPosition, const wxSize& size = wxDefaultSize) : wxPanel {parent, wxID_ANY, position, size} {
SetColour(colour);
}
void SetColour(const wxColour& colour) {SetBackgroundColour(colour);}
wxColour GetColour() const {return GetBackgroundColour();}
};
class Frame : public wxFrame {
public:
Frame() : wxFrame {nullptr, wxID_ANY, "Lines example"} {
SetClientSize(300, 300);
}
private:
wxPanel* panel = new wxPanel {this};
wxColouredLine* lineSeparator = new wxColouredLine {panel, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW), {10, 10}, {280, 2}};
wxColouredLine* lineRed = new wxColouredLine {panel, {255, 0, 0}, {10, 20}, {2, 250}};
wxColouredLine* lineGreen = new wxColouredLine {panel, {0, 143, 0}, {149, 20}, {2, 250}};
wxColouredLine* lineBlue = new wxColouredLine {panel, {0, 0, 255}, {288, 20}, {2, 250}};
wxColouredLine* lineSeparator2 = new wxColouredLine {panel, wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT), {10, 278}, {280, 2}};
};
class Application : public wxApp {
auto OnInit() -> bool override {return (new Frame)->Show();}
};
}
wxIMPLEMENT_APP(LineExample::Application);