[927] | 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 |
|
---|
[922] | 15 | package de.ugoe.cs.autoquest.plugin.mfc;
|
---|
[1] | 16 |
|
---|
[1006] | 17 | import de.ugoe.cs.autoquest.eventcore.guimodel.GUIElementTree;
|
---|
[1] | 18 |
|
---|
[171] | 19 | /**
|
---|
| 20 | * <p>
|
---|
[1008] | 21 | * Handler for {@code WM_DESTROY} message. The handler maintains the {@link GUIElementTree}.
|
---|
[171] | 22 | * </p>
|
---|
| 23 | *
|
---|
| 24 | * @author Steffen Herbold
|
---|
[1006] | 25 | * @author Fabian Glaser
|
---|
[171] | 26 | * @version 1.0
|
---|
| 27 | */
|
---|
[1] | 28 | public class HandlerDestroy extends MessageHandler {
|
---|
| 29 |
|
---|
[619] | 30 | /**
|
---|
| 31 | * <p>
|
---|
| 32 | * Constructor. Creates a new HandlerDestroy.
|
---|
| 33 | * </p>
|
---|
| 34 | *
|
---|
[1006] | 35 | * @param guiElementTree
|
---|
[619] | 36 | * the tree of GUI element specifications to be created and adapted during parsing
|
---|
| 37 | */
|
---|
[1028] | 38 | public HandlerDestroy(GUIElementTree<Long> guiElementTree) {
|
---|
[1006] | 39 | super(guiElementTree);
|
---|
[619] | 40 | }
|
---|
[1] | 41 |
|
---|
[619] | 42 | /**
|
---|
| 43 | * <p>
|
---|
[1008] | 44 | * HWND of the GUI element that is destroyed.
|
---|
[619] | 45 | * </p>
|
---|
| 46 | */
|
---|
| 47 | private long hwnd;
|
---|
[171] | 48 |
|
---|
[619] | 49 | /*
|
---|
| 50 | * (non-Javadoc)
|
---|
| 51 | *
|
---|
[922] | 52 | * @see de.ugoe.cs.autoquest.plugin.mfc.MessageHandler#onEndElement()
|
---|
[619] | 53 | */
|
---|
| 54 | @Override
|
---|
| 55 | public void onEndElement() {
|
---|
| 56 | if (hwnd != 0) {
|
---|
[1006] | 57 | super.getGUIElementTree().remove(hwnd);
|
---|
[619] | 58 | }
|
---|
| 59 | }
|
---|
[1] | 60 |
|
---|
[619] | 61 | /*
|
---|
| 62 | * (non-Javadoc)
|
---|
| 63 | *
|
---|
[922] | 64 | * @see de.ugoe.cs.autoquest.plugin.mfc.MessageHandler#onParameter(java.lang.String ,
|
---|
[619] | 65 | * java.lang.String)
|
---|
| 66 | */
|
---|
| 67 | @Override
|
---|
| 68 | public void onParameter(String name, String value) {
|
---|
| 69 | if (name.equals("window.hwnd")) {
|
---|
| 70 | hwnd = Long.parseLong(value);
|
---|
| 71 | }
|
---|
| 72 | }
|
---|
[1] | 73 |
|
---|
[619] | 74 | /*
|
---|
| 75 | * (non-Javadoc)
|
---|
| 76 | *
|
---|
[922] | 77 | * @see de.ugoe.cs.autoquest.plugin.mfc.MessageHandler#onStartElement()
|
---|
[619] | 78 | */
|
---|
| 79 | @Override
|
---|
| 80 | public void onStartElement() {
|
---|
| 81 | hwnd = 0;
|
---|
| 82 | }
|
---|
[1] | 83 |
|
---|
| 84 | }
|
---|