1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany
|
---|
2 | //
|
---|
3 | // Licensed under the Apache License, Version 2.0 (the "License");
|
---|
4 | // you may not use this file except in compliance with the License.
|
---|
5 | // You may obtain a copy of the License at
|
---|
6 | //
|
---|
7 | // http://www.apache.org/licenses/LICENSE-2.0
|
---|
8 | //
|
---|
9 | // Unless required by applicable law or agreed to in writing, software
|
---|
10 | // distributed under the License is distributed on an "AS IS" BASIS,
|
---|
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
12 | // See the License for the specific language governing permissions and
|
---|
13 | // limitations under the License.
|
---|
14 |
|
---|
15 | package de.ugoe.cs.autoquest.plugin.mfc;
|
---|
16 |
|
---|
17 | import de.ugoe.cs.autoquest.plugin.mfc.guimodel.MFCWindowTree;
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * <p>
|
---|
21 | * Handler for {@code WM_DESTROY} message. The handler maintains the {@link MFCWindowTree}.
|
---|
22 | * </p>
|
---|
23 | *
|
---|
24 | * @author Steffen Herbold
|
---|
25 | * @version 1.0
|
---|
26 | */
|
---|
27 | public class HandlerDestroy extends MessageHandler {
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * <p>
|
---|
31 | * Constructor. Creates a new HandlerDestroy.
|
---|
32 | * </p>
|
---|
33 | *
|
---|
34 | * @param windowTree
|
---|
35 | * the tree of GUI element specifications to be created and adapted during parsing
|
---|
36 | */
|
---|
37 | public HandlerDestroy(MFCWindowTree windowTree) {
|
---|
38 | super(windowTree);
|
---|
39 | }
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * <p>
|
---|
43 | * HWND of the window that is destroyed.
|
---|
44 | * </p>
|
---|
45 | */
|
---|
46 | private long hwnd;
|
---|
47 |
|
---|
48 | /*
|
---|
49 | * (non-Javadoc)
|
---|
50 | *
|
---|
51 | * @see de.ugoe.cs.autoquest.plugin.mfc.MessageHandler#onEndElement()
|
---|
52 | */
|
---|
53 | @Override
|
---|
54 | public void onEndElement() {
|
---|
55 | if (hwnd != 0) {
|
---|
56 | super.getWindowTree().remove(hwnd);
|
---|
57 | }
|
---|
58 | }
|
---|
59 |
|
---|
60 | /*
|
---|
61 | * (non-Javadoc)
|
---|
62 | *
|
---|
63 | * @see de.ugoe.cs.autoquest.plugin.mfc.MessageHandler#onParameter(java.lang.String ,
|
---|
64 | * java.lang.String)
|
---|
65 | */
|
---|
66 | @Override
|
---|
67 | public void onParameter(String name, String value) {
|
---|
68 | if (name.equals("window.hwnd")) {
|
---|
69 | hwnd = Long.parseLong(value);
|
---|
70 | }
|
---|
71 | }
|
---|
72 |
|
---|
73 | /*
|
---|
74 | * (non-Javadoc)
|
---|
75 | *
|
---|
76 | * @see de.ugoe.cs.autoquest.plugin.mfc.MessageHandler#onStartElement()
|
---|
77 | */
|
---|
78 | @Override
|
---|
79 | public void onStartElement() {
|
---|
80 | hwnd = 0;
|
---|
81 | }
|
---|
82 |
|
---|
83 | }
|
---|