| 33 | IMPLEMENT_CLASS(RulerPanel, wxPanelWrapper) |
| 34 | |
| 35 | RulerPanel::RulerPanel(wxWindow* parent, wxWindowID id, |
| 36 | wxOrientation orientation, |
| 37 | const wxSize& bounds, |
| 38 | const Range& range, |
| 39 | const RulerFormat &format, |
| 40 | const TranslatableString& units, |
| 41 | const Options& options, |
| 42 | const wxPoint& pos /*= wxDefaultPosition*/, |
| 43 | const wxSize& size /*= wxDefaultSize*/ |
| 44 | ) |
| 45 | : wxPanelWrapper(parent, id, pos, size) |
| 46 | , ruler{ |
| 47 | [&]() -> const RulerUpdater& { |
| 48 | if (options.log) |
| 49 | return LogarithmicUpdater::Instance(); |
| 50 | else |
| 51 | return LinearUpdater::Instance(); |
| 52 | }(), |
| 53 | format |
| 54 | } |
| 55 | { |
| 56 | ruler.SetBounds( 0, 0, bounds.x, bounds.y ); |
| 57 | ruler.SetOrientation(orientation); |
| 58 | ruler.SetRange( range.first, range.second ); |
| 59 | ruler.SetUnits(units); |
| 60 | ruler.SetFlip(options.flip); |
| 61 | ruler.SetLabelEdges(options.labelEdges); |
| 62 | ruler.mbTicksAtExtremes = options.ticksAtExtremes; |
| 63 | if (orientation == wxVERTICAL) { |
| 64 | wxCoord w; |
| 65 | ruler.GetMaxSize(&w, NULL); |
| 66 | SetMinSize(wxSize(w, 150)); // height needed for wxGTK |
| 67 | } |
| 68 | else if (orientation == wxHORIZONTAL) { |
| 69 | wxCoord h; |
| 70 | ruler.GetMaxSize(NULL, &h); |
| 71 | SetMinSize(wxSize(wxDefaultCoord, h)); |
| 72 | } |
| 73 | if (options.hasTickColour) |
| 74 | ruler.SetTickColour( options.tickColour ); |
| 75 | } |
| 76 | |
| 77 | RulerPanel::~RulerPanel() |
| 78 | { |
nothing calls this directly
no test coverage detected