diff options
| author | Mirco Müller <mirco.mueller@ubuntu.com> | 2010-08-26 16:27:59 +0200 |
|---|---|---|
| committer | Mirco Müller <mirco.mueller@ubuntu.com> | 2010-08-26 16:27:59 +0200 |
| commit | 6d31353d833ccd7d60ee214a333875e2899f943e (patch) | |
| tree | d4ce2e42224bc2eef694c43b1939eedb48d9554a /unity-private | |
| parent | a42ac84842e506bef6e229caf32ea0e160c1d2f8 (diff) | |
| parent | 8ad44d4411d42739ee9d69e84a88956c157c3e96 (diff) | |
modified:
unity-private/places/places-default-renderer.vala Merged branch unity.fix-608124 into trunk after review and approval from Jason. Fixes LP: #608124. (bzr r462)
Diffstat (limited to 'unity-private')
| -rw-r--r-- | unity-private/places/places-default-renderer.vala | 101 |
1 files changed, 97 insertions, 4 deletions
diff --git a/unity-private/places/places-default-renderer.vala b/unity-private/places/places-default-renderer.vala index 8794aaf48..f55f0bf2c 100644 --- a/unity-private/places/places-default-renderer.vala +++ b/unity-private/places/places-default-renderer.vala @@ -27,23 +27,116 @@ namespace Unity.Places private EmptySearchGroup search_empty; private EmptySectionGroup section_empty; - private Ctk.ScrollView scroll; - private Ctk.VBox box; - private Dee.Model groups_model; - private Dee.Model results_model; + private Ctk.ScrollView scroll; + private Unity.CairoCanvas trough; + private Unity.CairoCanvas slider; + private Ctk.VBox box; + private Dee.Model groups_model; + private Dee.Model results_model; public DefaultRenderer () { Object (); } + private static double + _align (double val) + { + double fract = val - (int) val; + + if (fract != 0.5f) + return (double) ((int) val + 0.5f); + else + return val; + } + + private void + trough_paint (Cairo.Context cr, + int width, + int height) + { + double radius = (double) width / 2.0f; + + cr.set_operator (Cairo.Operator.CLEAR); + cr.paint (); + + cr.set_line_width (1.0f); + cr.set_operator (Cairo.Operator.OVER); + cr.set_source_rgba (1.0f, 1.0f, 1.0f, 0.25f); + + cr.move_to (0.5f, radius - 0.5f); + cr.arc (radius, radius, + radius - 0.5f, + 180.0f * GLib.Math.PI / 180.0f, + 0.0f * GLib.Math.PI / 180.0f); + cr.line_to ((double) width - 0.5f, (double) height - radius - 0.5f); + cr.arc (radius, (double) height - radius - 0.5f, + radius - 0.5f, + 0.0f * GLib.Math.PI / 180.0f, + 180.0f * GLib.Math.PI / 180.0f); + cr.close_path (); + cr.set_source_rgba (1.0f, 1.0f, 1.0f, 0.1f); + cr.fill_preserve (); + cr.set_source_rgba (1.0f, 1.0f, 1.0f, 0.35f); + cr.stroke (); + } + + private void + slider_paint (Cairo.Context cr, + int width, + int height) + { + double radius = (double) width / 2.0f; + double half = (double) width / 2.0f; + double half_height = (double) height / 2.0f; + + cr.set_operator (Cairo.Operator.CLEAR); + cr.paint (); + + cr.set_line_width (1.0f); + cr.set_operator (Cairo.Operator.OVER); + cr.set_source_rgba (1.0f, 1.0f, 1.0f, 0.75f); + + cr.move_to (0.5f, radius - 0.5f); + cr.arc (radius, radius, + radius - 0.5f, + 180.0f * GLib.Math.PI / 180.0f, + 0.0f * GLib.Math.PI / 180.0f); + cr.line_to ((double) width - 0.5f, (double) height - radius - 0.5f); + cr.arc (radius, (double) height - radius - 0.5f, + radius - 0.5f, + 0.0f * GLib.Math.PI / 180.0f, + 180.0f * GLib.Math.PI / 180.0f); + cr.close_path (); + cr.set_source_rgba (0.0f, 0.0f, 0.0f, 0.15f); + cr.fill_preserve (); + cr.set_source_rgba (1.0f, 1.0f, 1.0f, 0.5f); + cr.stroke (); + + cr.set_source_rgba (1.0f, 1.0f, 1.0f, 0.75f); + cr.move_to (_align (1.0f), _align (half_height - 2.0f)); + cr.line_to (_align ((double) width - 2.0f), _align (half_height - 2.0f)); + cr.move_to (_align (1.0f), _align (half_height)); + cr.line_to (_align ((double) width - 2.0f), _align (half_height)); + cr.move_to (_align (1.0f), _align (half_height + 2.0f)); + cr.line_to (_align ((double) width - 2.0f), _align (half_height + 2.0f)); + cr.stroke (); + } + construct { padding = { 0.0f, 0.0f, 0.0f, 0.0f }; + trough = new Unity.CairoCanvas (trough_paint); + slider = new Unity.CairoCanvas (slider_paint); + scroll = new Ctk.ScrollView (); + scroll.set_scroll_bar (trough, slider); + //slider.reactive = true; add_actor (scroll); scroll.show (); + trough.show (); + slider.show (); box = new Ctk.VBox (SPACING); box.padding = { 0.0f, PADDING, 0.0f, PADDING}; |
