source: trunk/design/ui/source/wui-widgets-spin_boxes.ads

Last change on this file was 5743, checked in by vadim.godunko, 3 years ago

Move dispatchers of 'change' and 'input' events to Abstract_Widget.

  • Property svn:keywords set to Author Date Revision
File size: 6.1 KB
Line 
1------------------------------------------------------------------------------
2-- --
3-- Matreshka Project --
4-- --
5-- Web Framework --
6-- --
7-- Runtime Library Component --
8-- --
9------------------------------------------------------------------------------
10-- --
11-- Copyright © 2016-2017, Vadim Godunko <vgodunko@gmail.com> --
12-- All rights reserved. --
13-- --
14-- Redistribution and use in source and binary forms, with or without --
15-- modification, are permitted provided that the following conditions --
16-- are met: --
17-- --
18-- * Redistributions of source code must retain the above copyright --
19-- notice, this list of conditions and the following disclaimer. --
20-- --
21-- * Redistributions in binary form must reproduce the above copyright --
22-- notice, this list of conditions and the following disclaimer in the --
23-- documentation and/or other materials provided with the distribution. --
24-- --
25-- * Neither the name of the Vadim Godunko, IE nor the names of its --
26-- contributors may be used to endorse or promote products derived from --
27-- this software without specific prior written permission. --
28-- --
29-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
30-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
31-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
32-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
33-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
34-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
35-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
36-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
37-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
38-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
39-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
40-- --
41------------------------------------------------------------------------------
42-- $Revision: 5743 $ $Date: 2017-01-29 09:06:05 +0000 (Sun, 29 Jan 2017) $
43------------------------------------------------------------------------------
44with WebAPI.HTML.Input_Elements;
45
46with Core.Slots_0;
47private with Core.Slots_0.Generic_Slots;
48private with Core.Slots_0.Emitters;
49
50package WUI.Widgets.Spin_Boxes is
51
52 type Abstract_Spin_Box is
53 abstract new WUI.Widgets.Abstract_Widget with private;
54
55 not overriding function Editing_Finished_Signal
56 (Self : in out Abstract_Spin_Box)
57 return not null access Core.Slots_0.Signal'Class;
58
59 not overriding procedure Set_Disabled
60 (Self : in out Abstract_Spin_Box;
61 Disabled : Boolean);
62 -- Available as slot.
63
64 not overriding procedure Set_Enabled
65 (Self : in out Abstract_Spin_Box;
66 Enabled : Boolean);
67 -- Available as slot.
68
69 not overriding procedure Step_Down
70 (Self : in out Abstract_Spin_Box) is abstract;
71 -- Available as slot.
72
73 not overriding procedure Step_Up
74 (Self : in out Abstract_Spin_Box) is abstract;
75 -- Available as slot.
76
77 -----------
78 -- Slots --
79 -----------
80
81 function Set_Disabled_Slot
82 (Self : in out Abstract_Spin_Box'Class)
83 return WUI.Boolean_Slots.Slot'Class;
84
85 function Set_Enabled_Slot
86 (Self : in out Abstract_Spin_Box'Class)
87 return WUI.Boolean_Slots.Slot'Class;
88
89 function Step_Down_Slot
90 (Self : in out Abstract_Spin_Box'Class)
91 return Core.Slots_0.Slot'Class;
92
93 function Step_Up_Slot
94 (Self : in out Abstract_Spin_Box'Class)
95 return Core.Slots_0.Slot'Class;
96
97 package Constructors is
98
99 procedure Initialize
100 (Self : in out Abstract_Spin_Box'Class;
101 Element :
102 not null WebAPI.HTML.Input_Elements.HTML_Input_Element_Access);
103
104 end Constructors;
105
106private
107
108 type Abstract_Spin_Box is
109 abstract new WUI.Widgets.Abstract_Widget with
110 record
111 Editing_Finished : aliased
112 Core.Slots_0.Emitters.Emitter (Abstract_Spin_Box'Unchecked_Access);
113 end record;
114
115 -----------
116 -- Slots --
117 -----------
118
119 package Set_Disabled_Slots is
120 new WUI.Boolean_Slots.Generic_Slots (Abstract_Spin_Box, Set_Disabled);
121
122 function Set_Disabled_Slot
123 (Self : in out Abstract_Spin_Box'Class)
124 return WUI.Boolean_Slots.Slot'Class
125 renames Set_Disabled_Slots.To_Slot;
126
127 package Set_Enabled_Slots is
128 new WUI.Boolean_Slots.Generic_Slots (Abstract_Spin_Box, Set_Enabled);
129
130 function Set_Enabled_Slot
131 (Self : in out Abstract_Spin_Box'Class)
132 return WUI.Boolean_Slots.Slot'Class
133 renames Set_Enabled_Slots.To_Slot;
134
135 package Step_Down_Slots is
136 new Core.Slots_0.Generic_Slots (Abstract_Spin_Box, Step_Down);
137
138 function Step_Down_Slot
139 (Self : in out Abstract_Spin_Box'Class) return Core.Slots_0.Slot'Class
140 renames Step_Down_Slots.To_Slot;
141
142 package Step_Up_Slots is
143 new Core.Slots_0.Generic_Slots (Abstract_Spin_Box, Step_Up);
144
145 function Step_Up_Slot
146 (Self : in out Abstract_Spin_Box'Class) return Core.Slots_0.Slot'Class
147 renames Step_Down_Slots.To_Slot;
148
149end WUI.Widgets.Spin_Boxes;
Note: See TracBrowser for help on using the repository browser.