PageRenderTime 10ms CodeModel.GetById 5ms app.highlight 4ms RepoModel.GetById 0ms app.codeStats 0ms

/src/cupcake-primitives.adb

http://github.com/skordal/cupcake
Ada | 45 lines | 26 code | 9 blank | 10 comment | 0 complexity | 1acb3b17e91b336ee7f16e38273190c0 MD5 | raw file
Possible License(s): LGPL-2.0
 1--  The Cupcake GUI Toolkit
 2--  (c) Kristian Klomsten Skordal 2012 <kristian.skordal@gmail.com>
 3--  Report bugs and issues on <http://github.com/skordal/cupcake/issues>
 4--  vim:ts=3:sw=3:et:si:sta
 5
 6package body Cupcake.Primitives is
 7
 8   --  Adds two points together:
 9   function "+" (Left, Right : in Point) return Point is
10   begin
11      return ((Left.X + Right.X), (Left.Y + Right.Y));
12   end "+";
13
14   --  Subtracts two points:
15   function "-" (Left, Right : in Point) return Point is
16   begin
17      return ((Left.X - Right.X), (Left.Y - Right.Y));
18   end "-";
19
20   --  Compares two points for equality:
21   function "=" (Left, Right : in Point) return Boolean is
22   begin
23      return ((Left.X = Right.X) and (Left.Y = Right.Y));
24   end "=";
25
26   --  Compares two dimensions:
27   function "<" (Left, Right : in Dimension) return Boolean is
28   begin
29      return (Left.Width * Left.Height) < (Right.Width * Right.Height);
30   end "<";
31
32   --  Compares two dimensions:
33   function ">" (Left, Right : in Dimension) return Boolean is
34   begin
35      return (Left.Width * Left.Height) > (Right.Width * Right.Height);
36   end ">";
37
38   --  Compares two dimensions:
39   function "=" (Left, Right : in Dimension) return Boolean is
40   begin
41      return (Left.Width * Left.Height) = (Right.Width * Right.Height);
42   end "=";
43
44end Cupcake.Primitives;
45