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

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

Add Set_Enabled subprogram.

  • Property svn:keywords set to Author Date Revision
File size: 5.5 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: 5721 $ $Date: 2017-01-24 17:25:14 +0000 (Tue, 24 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 Step_Down
60 (Self : in out Abstract_Spin_Box) is abstract;
61
62 function Step_Down_Slot
63 (Self : in out Abstract_Spin_Box'Class)
64 return Core.Slots_0.Slot'Class;
65
66 not overriding procedure Step_Up
67 (Self : in out Abstract_Spin_Box) is abstract;
68
69 function Step_Up_Slot
70 (Self : in out Abstract_Spin_Box'Class)
71 return Core.Slots_0.Slot'Class;
72
73 not overriding procedure Input_Event
74 (Self : in out Abstract_Spin_Box) is abstract;
75
76 procedure Set_Enabled
77 (Self : in out Abstract_Spin_Box'Class;
78 Enabled : Boolean);
79
80 package Constructors is
81
82 procedure Initialize
83 (Self : in out Abstract_Spin_Box'Class;
84 Element :
85 not null WebAPI.HTML.Input_Elements.HTML_Input_Element_Access);
86
87 end Constructors;
88
89private
90
91 type Input_Dispatcher
92 (Owner : not null access Abstract_Spin_Box'Class) is
93 limited new WebAPI.DOM.Event_Listeners.Event_Listener with null record;
94
95 overriding procedure Handle_Event
96 (Self : not null access Input_Dispatcher;
97 Event : access WebAPI.DOM.Events.Event'Class);
98
99 type Abstract_Spin_Box is
100 abstract new WUI.Widgets.Abstract_Widget with
101 record
102 Input : aliased
103 Input_Dispatcher (Abstract_Spin_Box'Unchecked_Access);
104 Editing_Finished : aliased
105 Core.Slots_0.Emitters.Emitter (Abstract_Spin_Box'Unchecked_Access);
106 end record;
107
108 package Step_Down_Slots is
109 new Core.Slots_0.Generic_Slots (Abstract_Spin_Box, Step_Down);
110
111 function Step_Down_Slot
112 (Self : in out Abstract_Spin_Box'Class) return Core.Slots_0.Slot'Class
113 renames Step_Down_Slots.To_Slot;
114
115 package Step_Up_Slots is
116 new Core.Slots_0.Generic_Slots (Abstract_Spin_Box, Step_Up);
117
118 function Step_Up_Slot
119 (Self : in out Abstract_Spin_Box'Class) return Core.Slots_0.Slot'Class
120 renames Step_Down_Slots.To_Slot;
121
122end WUI.Widgets.Spin_Boxes;
Note: See TracBrowser for help on using the repository browser.