| 1 | // SPDX-FileCopyrightText: 2009 Ingo Ruhnke <[email protected]>cxx . . $ `<file>/src/throttle_widget.cpp`/ |
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 3 | |
| 4 | #include "throttle_widget.hpp"cxx . . $ `<file>/src/throttle_widget.hpp`/ |
| 5 | |
| 6 | ThrottleWidgetcxx . . $ ThrottleWidget#::ThrottleWidgetcxx . . $ ThrottleWidget#ThrottleWidget(6908015b96d379c0).(int width, int height, bool invert_) |
| 7 | : invertcxx . . $ ThrottleWidget#invert.(invert_), |
| 8 | poscxx . . $ ThrottleWidget#pos.(0.0) |
| 9 | { |
| 10 | set_size_requestcxx . . $ Gtk/Widget#set_size_request(3e454b8ccf442868).(width, height); |
| 11 | //modify_bg(Gtk::STATE_NORMAL , Gdk::Color("white")); |
| 12 | //modify_fg(Gtk::STATE_NORMAL , Gdk::Color("black")); |
| 13 | } |
| 14 | |
| 15 | bool |
| 16 | ThrottleWidgetcxx . . $ ThrottleWidget#::on_drawcxx . . $ ThrottleWidget#on_draw(ed24c027e6bf5d39).(const ::Cairocxx . . $ Cairo/::RefPtrcxx . . $ Cairo/RefPtr#< ::Cairocxx . . $ Cairo/::Contextcxx . . $ Cairo/Context#>& cr) |
| 17 | { |
| 18 | double p = 1.0 - (poscxx . . $ ThrottleWidget#pos. + 1.0) / 2.0; |
| 19 | |
| 20 | int w = get_allocationcxx . . $ Gtk/Widget#get_allocation(e6dc81a2332b2162).().get_widthcxx . . $ Gdk/Rectangle#get_width(455f465bc33b4cdf).()-10; |
| 21 | int h = get_allocationcxx . . $ Gtk/Widget#get_allocation(e6dc81a2332b2162).().get_heightcxx . . $ Gdk/Rectangle#get_height(455f465bc33b4cdf).()-10; |
| 22 | |
| 23 | cr->cxx . . $ Cairo/RefPtr#`operator->`(5a2a78a048fb49a8).translatecxx . . $ Cairo/Context#translate(bc12c9ec15586e6a).(5, 5); |
| 24 | |
| 25 | // Outer Rectangle |
| 26 | cr->cxx . . $ Cairo/RefPtr#`operator->`(5a2a78a048fb49a8).set_source_rgbcxx . . $ Cairo/Context#set_source_rgb(98dd472ac7e5c3d4).(0.0, 0.0, 0.0); |
| 27 | cr->cxx . . $ Cairo/RefPtr#`operator->`(5a2a78a048fb49a8).set_line_widthcxx . . $ Cairo/Context#set_line_width(ba8836b59fb42830).(1.0); |
| 28 | cr->cxx . . $ Cairo/RefPtr#`operator->`(5a2a78a048fb49a8).rectanglecxx . . $ Cairo/Context#rectangle(52a61fa14d44b641).(0, 0, w, h); |
| 29 | cr->cxx . . $ Cairo/RefPtr#`operator->`(5a2a78a048fb49a8).strokecxx . . $ Cairo/Context#stroke(49f6e7a06ebc5aa8).(); |
| 30 | |
| 31 | int dh = h*p; |
| 32 | cr->cxx . . $ Cairo/RefPtr#`operator->`(5a2a78a048fb49a8).rectanglecxx . . $ Cairo/Context#rectangle(52a61fa14d44b641).(0, h - dh, w, dh); |
| 33 | cr->cxx . . $ Cairo/RefPtr#`operator->`(5a2a78a048fb49a8).fillcxx . . $ Cairo/Context#fill(49f6e7a06ebc5aa8).(); |
| 34 | |
| 35 | return true; |
| 36 | } |
| 37 | |
| 38 | void |
| 39 | ThrottleWidgetcxx . . $ ThrottleWidget#::set_poscxx . . $ ThrottleWidget#set_pos(ba8836b59fb42830).(double p) |
| 40 | { |
| 41 | if (invertcxx . . $ ThrottleWidget#invert.) |
| 42 | poscxx . . $ ThrottleWidget#pos. = -p; |
| 43 | else |
| 44 | poscxx . . $ ThrottleWidget#pos. = p; |
| 45 | queue_drawcxx . . $ Gtk/Widget#queue_draw(49f6e7a06ebc5aa8).(); |
| 46 | } |
| 47 | |
| 48 | /* EOF */ |