Mercurial > projects > mde
annotate mde/content/ServiceContent.d @ 171:7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Moved WMScreen.createRootWidget to WidgetManager.createWidgets.
Put childContext under a popupHandler widget.
TODO: implement IChildWidget.setContent(Content) (see AParentWidget.d:237).
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Sun, 26 Jul 2009 11:04:17 +0200 |
parents | e45226d3deae |
children | a1ba9157510e |
rev | line source |
---|---|
61
7cab2af4ba21
A little bit of progress on the content handling system (relevent code is likely to be revised).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
1 /* LICENSE BLOCK |
7cab2af4ba21
A little bit of progress on the content handling system (relevent code is likely to be revised).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
2 Part of mde: a Modular D game-oriented Engine |
170
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
3 Copyright © 2007-2009 Diggory Hardy |
61
7cab2af4ba21
A little bit of progress on the content handling system (relevent code is likely to be revised).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
4 |
7cab2af4ba21
A little bit of progress on the content handling system (relevent code is likely to be revised).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
5 This program is free software: you can redistribute it and/or modify it under the terms |
7cab2af4ba21
A little bit of progress on the content handling system (relevent code is likely to be revised).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
6 of the GNU General Public License as published by the Free Software Foundation, either |
7cab2af4ba21
A little bit of progress on the content handling system (relevent code is likely to be revised).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
7 version 2 of the License, or (at your option) any later version. |
7cab2af4ba21
A little bit of progress on the content handling system (relevent code is likely to be revised).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
8 |
7cab2af4ba21
A little bit of progress on the content handling system (relevent code is likely to be revised).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
9 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
7cab2af4ba21
A little bit of progress on the content handling system (relevent code is likely to be revised).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
10 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
7cab2af4ba21
A little bit of progress on the content handling system (relevent code is likely to be revised).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
11 See the GNU General Public License for more details. |
7cab2af4ba21
A little bit of progress on the content handling system (relevent code is likely to be revised).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
12 |
7cab2af4ba21
A little bit of progress on the content handling system (relevent code is likely to be revised).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
13 You should have received a copy of the GNU General Public License |
7cab2af4ba21
A little bit of progress on the content handling system (relevent code is likely to be revised).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
14 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
7cab2af4ba21
A little bit of progress on the content handling system (relevent code is likely to be revised).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
15 |
7cab2af4ba21
A little bit of progress on the content handling system (relevent code is likely to be revised).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
16 /** Content services. |
7cab2af4ba21
A little bit of progress on the content handling system (relevent code is likely to be revised).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
17 * |
170
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
18 * Each is a Content, so it can be used in a menu. Since the content being |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
19 * acted on is not passed when functions are called like this, it is set when |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
20 * a context menu is opened, which also allows the services to specify their |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
21 * compatibility with the content (type) passed (via BoolContent value and |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
22 * callbacks). |
61
7cab2af4ba21
A little bit of progress on the content handling system (relevent code is likely to be revised).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
23 */ |
170
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
24 module mde.content.ServiceContent; |
61
7cab2af4ba21
A little bit of progress on the content handling system (relevent code is likely to be revised).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
25 |
149
1125ba603af6
Some ideas for content service menus.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
105
diff
changeset
|
26 import mde.content.AStringContent; |
1125ba603af6
Some ideas for content service menus.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
105
diff
changeset
|
27 |
170
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
28 /** Interface for ServiceContent and ServiceContentList. */ |
171
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
29 interface IServiceContent : IContent { |
170
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
30 void setContent (Content cont); |
61
7cab2af4ba21
A little bit of progress on the content handling system (relevent code is likely to be revised).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
31 } |
7cab2af4ba21
A little bit of progress on the content handling system (relevent code is likely to be revised).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
32 |
170
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
33 /** A class for services acting on content. |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
34 * |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
35 * Provides services for any content usable as type T, where T is some content |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
36 * type. |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
37 * |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
38 * The (boolean) value is true to indicate this service can act on the passed |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
39 * content type, false if not. */ |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
40 class ServiceContent(T : Content = AStringContent) : Content, IServiceContent, IBoolContent, IEventContent { |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
41 this (char[] symbol) { |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
42 super (symbol); |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
43 } |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
44 |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
45 /** Pass the content this service should prepare for. |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
46 * |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
47 * Stores the reference, because it won't be passed later. */ |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
48 override void setContent (Content cont) { |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
49 activeCont = cast(T)cont; |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
50 } |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
51 |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
52 override bool opCall () { |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
53 return activeCont is null; |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
54 } |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
55 // Doesn't support directly setting the value |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
56 override void opAssign (bool val) {} |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
57 |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
58 package: |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
59 T activeCont; |
61
7cab2af4ba21
A little bit of progress on the content handling system (relevent code is likely to be revised).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
60 } |
7cab2af4ba21
A little bit of progress on the content handling system (relevent code is likely to be revised).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
61 |
170
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
62 /** Aliases for common types */ |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
63 alias ServiceContent!(AStringContent) AStringService; |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
64 alias ServiceContent!(IntContent) IntService; ///ditto |
149
1125ba603af6
Some ideas for content service menus.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
105
diff
changeset
|
65 |
170
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
66 /** A generic way to handle a list of type IContent. */ |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
67 class ServiceContentList : ContentList, IServiceContent, IBoolContent |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
68 { |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
69 this (char[] symbol) { |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
70 super (symbol); |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
71 } |
149
1125ba603af6
Some ideas for content service menus.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
105
diff
changeset
|
72 |
170
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
73 void setContent (Content cont) { |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
74 foreach (child; list_) { |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
75 debug assert (cast(IServiceContent)child !is null); |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
76 (cast(IServiceContent)child).setContent (cont); |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
77 } |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
78 } |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
79 |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
80 override bool opCall () { |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
81 foreach (child; list_) { |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
82 debug assert (cast(IBoolContent)child !is null); |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
83 if (!(cast(IBoolContent)child)()) |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
84 return false; |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
85 } |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
86 return true; |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
87 } |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
88 // Doesn't support directly setting the value |
e45226d3deae
Context menu services not applicable to the current type can now be hidden.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
149
diff
changeset
|
89 override void opAssign (bool val) {} |
171
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
90 |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
91 |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
92 /** Create all services. |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
93 * |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
94 * Each WidgetManager has it's own instance, but these share one clipboard, etc. |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
95 * |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
96 * Currently all clipboard operations convert to/from a string. |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
97 * TODO: Possible extensions: multi-item clipboard displaying value in menu, |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
98 * copying without converting everything to/from a string. */ |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
99 static ServiceContentList createItems (char[] name) { |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
100 char[] lName = "menus.services."~name; |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
101 auto ret = new ServiceContentList (lName); |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
102 |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
103 // Many use callbacks on a generic class type. For this, we should be sure of the type. |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
104 (new AStringService(lName~".copy")).addCallback ((IContent c) { |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
105 debug assert (cast(AStringService)c); |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
106 with (cast(AStringService)c) { |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
107 if (activeCont !is null) |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
108 clipboard = activeCont.toString(0); |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
109 } |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
110 }); |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
111 (new AStringService(lName~".paste")).addCallback ((IContent c) { |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
112 debug assert (cast(AStringService)c); |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
113 with (cast(AStringService)c) { |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
114 if (activeCont !is null) |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
115 activeCont = clipboard; |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
116 } |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
117 }); |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
118 |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
119 new ServiceContentList(lName~".calculator"); |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
120 (new IntService(lName~".calculator.increment")).addCallback ((IContent c) { |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
121 debug assert (cast(IntService)c); |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
122 with (cast(IntService)c) { |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
123 if (activeCont !is null) |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
124 activeCont = activeCont()+1; |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
125 } |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
126 }); |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
127 (new IntService(lName~".calculator.decrement")).addCallback ((IContent c) { |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
128 debug assert (cast(IntService)c); |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
129 with (cast(IntService)c) { |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
130 if (activeCont !is null) |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
131 activeCont = activeCont()-1; |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
132 } |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
133 }); |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
134 return ret; |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
135 } |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
136 |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
137 private: |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
138 static char[] clipboard; |
7f7b2011b759
Partially complete commit: code runs but context menus don't work.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
170
diff
changeset
|
139 //TODO: lock on clipboard: static Mutex mutex; |
61
7cab2af4ba21
A little bit of progress on the content handling system (relevent code is likely to be revised).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
140 } |