Changeset 619 for trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/HandlerCreate.java
- Timestamp:
- 08/27/12 11:45:09 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/HandlerCreate.java
r581 r619 1 1 2 package de.ugoe.cs.quest.plugin.mfc; 2 3 3 import de.ugoe.cs.quest.plugin.mfc. eventcore.WindowTree;4 import de.ugoe.cs.quest.plugin.mfc.guimodel.WindowTree; 4 5 5 6 /** 6 7 * <p> 7 * Message handler for {@code WM_CREATE} messages. The handler maintains the 8 * {@link WindowTree}. 8 * Message handler for {@code WM_CREATE} messages. The handler maintains the {@link WindowTree}. 9 9 * </p> 10 10 * … … 14 14 public class HandlerCreate extends MessageHandler { 15 15 16 /** 17 * <p> 18 * Constructor. Creates a new HandlerCreate. 19 * </p> 20 */ 21 public HandlerCreate() { 22 super(); 23 } 16 /** 17 * <p> 18 * Constructor. Creates a new HandlerCreate. 19 * </p> 20 * 21 * @param windowTree the tree of GUI element specifications to be created and adapted during 22 * parsing 23 */ 24 public HandlerCreate(WindowTree windowTree) { 25 super(windowTree); 26 } 24 27 25 26 27 28 29 30 28 /** 29 * <p> 30 * Name of the created window. 31 * </p> 32 */ 33 private String windowName; 31 34 32 33 34 35 36 37 private inthwnd;35 /** 36 * <p> 37 * HWND of the created window. 38 * </p> 39 */ 40 private long hwnd; 38 41 39 40 41 42 43 44 private intparentHwnd;42 /** 43 * <p> 44 * HWND of the created window's parent. 45 * </p> 46 */ 47 private long parentHwnd; 45 48 46 47 48 49 50 51 49 /** 50 * <p> 51 * Resource Id of the created window. 52 * </p> 53 */ 54 private int resourceId; 52 55 53 54 55 56 57 58 56 /** 57 * <p> 58 * Window class of the created window. 59 * </p> 60 */ 61 private String className; 59 62 60 61 62 63 64 65 63 /** 64 * <p> 65 * Modality of the created window. 66 * </p> 67 */ 68 private boolean isModal; 66 69 67 /* 68 * (non-Javadoc) 69 * 70 * @see de.ugoe.cs.quest.plugin.mfc.MessageHandler#onEndElement() 71 */ 72 @Override 73 public void onEndElement() { 74 if (hwnd != 0) { 75 WindowTree.getInstance().add(parentHwnd, hwnd, windowName, 76 resourceId, className, isModal); 77 } 78 } 70 /* 71 * (non-Javadoc) 72 * 73 * @see de.ugoe.cs.quest.plugin.mfc.MessageHandler#onEndElement() 74 */ 75 @Override 76 public void onEndElement() { 77 if (hwnd != 0) { 78 super.getWindowTree().add(parentHwnd, hwnd, windowName, resourceId, className, isModal); 79 } 80 } 79 81 80 /* 81 * (non-Javadoc) 82 * 83 * @see 84 * de.ugoe.cs.quest.plugin.mfc.MessageHandler#onParameter(java.lang.String 85 * , java.lang.String) 86 */ 87 @Override 88 public void onParameter(String name, String value) { 89 if (name.equals("window.hwnd")) { 90 hwnd = Integer.parseInt(value); 91 } else if (name.equals("window.name")) { 92 windowName = value; 93 } else if (name.equals("window.parent.hwnd")) { 94 parentHwnd = Integer.parseInt(value); 95 } else if (name.equals("window.resourceId")) { 96 resourceId = Integer.parseInt(value); 97 } else if (name.equals("window.class")) { 98 if (value.startsWith("Afx:")) { 99 className = "Afx:"; 100 } else { 101 className = value; 102 } 103 } else if (name.equals("window.ismodal")) { 104 if (value.equals("true") || value.equals("1")) { 105 isModal = true; 106 } 107 } 108 } 82 /* 83 * (non-Javadoc) 84 * 85 * @see de.ugoe.cs.quest.plugin.mfc.MessageHandler#onParameter(java.lang.String , 86 * java.lang.String) 87 */ 88 @Override 89 public void onParameter(String name, String value) { 90 if (name.equals("window.hwnd")) { 91 hwnd = Long.parseLong(value); 92 } 93 else if (name.equals("window.name")) { 94 windowName = value; 95 } 96 else if (name.equals("window.parent.hwnd")) { 97 parentHwnd = Long.parseLong(value); 98 } 99 else if (name.equals("window.resourceId")) { 100 resourceId = Integer.parseInt(value); 101 } 102 else if (name.equals("window.class")) { 103 if (value.startsWith("Afx:")) { 104 className = "Afx:"; 105 } 106 else { 107 className = value; 108 } 109 } 110 else if (name.equals("window.ismodal")) { 111 if (value.equals("true") || value.equals("1")) { 112 isModal = true; 113 } 114 } 115 } 109 116 110 111 112 113 114 115 116 117 118 119 120 121 122 123 117 /* 118 * (non-Javadoc) 119 * 120 * @see de.ugoe.cs.quest.plugin.mfc.MessageHandler#onStartElement() 121 */ 122 @Override 123 public void onStartElement() { 124 windowName = ""; 125 hwnd = 0; 126 parentHwnd = 0; 127 resourceId = 0; 128 className = ""; 129 isModal = false; 130 } 124 131 125 132 }
Note: See TracChangeset
for help on using the changeset viewer.