1 | /* |
2 | * $Id: MSG.java,v 1.3 2006/03/07 17:51:46 hastings Exp $ |
3 | * |
4 | * (c) Copyright, Moebius Solutions, Inc., 2004 |
5 | * |
6 | * All Rights Reserved |
7 | * |
8 | * This material may be reproduced by or for the U. S. Government |
9 | * pursuant to the copyright license under the clause at |
10 | * DFARS 252.227-7014 (OCT 2001). |
11 | */ |
12 | |
13 | package com.moesol.bindings.platform_sdk.windows_api; |
14 | |
15 | import java.nio.ByteBuffer; |
16 | import com.moesol.bindings.NativeStructure; |
17 | |
18 | /** |
19 | * @author Robert Hastings |
20 | */ |
21 | public class MSG extends NativeStructure { |
22 | // MSG |
23 | public MSG() { |
24 | super( new byte[sizeof()] ); |
25 | } |
26 | public MSG(ByteBuffer bb) { |
27 | super( bb ); |
28 | // set limit based on the dynamic size in byte in bb. |
29 | bb.limit(sizeof()); |
30 | } |
31 | public static int sizeof() { |
32 | return 28; |
33 | } |
34 | /** |
35 | * Represent a native array of these structures |
36 | */ |
37 | public static class Array extends com.moesol.bindings.NativeArrayOfStructs { |
38 | public Array(java.nio.ByteBuffer bb) { |
39 | super(bb); |
40 | } |
41 | public MSG get(int index) { |
42 | return new MSG(getElementSlice(index, MSG.sizeof())); |
43 | } |
44 | public void put(int index, MSG value) { |
45 | get(index).putStruct(0, MSG.sizeof(), value); |
46 | } |
47 | public int length() { |
48 | return _getByteBuffer().limit() / MSG.sizeof(); |
49 | } |
50 | public int getDynamicSize() { |
51 | return _getByteBuffer().limit(); |
52 | } |
53 | public String toString() { |
54 | StringBuffer sb = new StringBuffer(); |
55 | for (int i = 0; i < length(); i++) { |
56 | sb.append(get(i)); |
57 | } |
58 | return sb.toString(); |
59 | } |
60 | } |
61 | |
62 | public void set_hwnd(int v) { |
63 | putInt(0, v); |
64 | } |
65 | public int get_hwnd() { |
66 | return getInt(0); |
67 | } |
68 | public void set_message(int v) { |
69 | putInt(4, v); |
70 | } |
71 | public int get_message() { |
72 | return getInt(4); |
73 | } |
74 | public void set_wParam(int v) { |
75 | putInt(8, v); |
76 | } |
77 | public int get_wParam() { |
78 | return getInt(8); |
79 | } |
80 | public void set_lParam(int v) { |
81 | putInt(12, v); |
82 | } |
83 | public int get_lParam() { |
84 | return getInt(12); |
85 | } |
86 | public void set_time(int v) { |
87 | putInt(16, v); |
88 | } |
89 | public int get_time() { |
90 | return getInt(16); |
91 | } |
92 | public void set_pt(POINT v) { |
93 | System.arraycopy(v._getStructureBytes(), 0, _getStructureBytes(), 20, 8); |
94 | } |
95 | public POINT get_pt() { |
96 | POINT r = new POINT(); |
97 | System.arraycopy(_getStructureBytes(), 20, r._getStructureBytes(), 0, 8); |
98 | return r; |
99 | } |
100 | public POINT ref_pt() { |
101 | return new POINT( getSlice(20, 8) ); |
102 | } |
103 | public String toString() { |
104 | StringBuffer buf = new StringBuffer(); |
105 | buf.append(getClass().getName()); |
106 | buf.append("[time=").append(get_time()); |
107 | buf.append(",hwnd=").append(get_hwnd()); |
108 | buf.append(",message=0x").append(Integer.toHexString(get_message())); |
109 | buf.append(",wParam=").append(get_wParam()); |
110 | buf.append(",lParam=").append(get_lParam()); |
111 | buf.append(",pt=").append(get_pt()); |
112 | buf.append("]"); |
113 | return buf.toString(); |
114 | } |
115 | public static final int WM_KEYDOWN = 0x0100; |
116 | public static final int WM_KEYUP = 0x0101; |
117 | public static final int WM_CHAR = 0x0102; |
118 | public static final int WM_DEADCHAR = 0x0103; |
119 | public static final int WM_SYSKEYDOWN = 0x0104; |
120 | public static final int WM_SYSKEYUP = 0x0105; |
121 | public static final int WM_SYSCHAR = 0x0106; |
122 | public static final int WM_SYSDEADCHAR = 0x0107; |
123 | } |