| 113 | FXIMPLEMENT(MainWindow, FXMainWindow, MainWindowMap, ARRAYNUMBER(MainWindowMap)); |
| 114 | |
| 115 | MainWindow::MainWindow(FXApp *app) |
| 116 | : FXMainWindow(app, "HIDAPI Test Application", NULL, NULL, DECOR_ALL, 200,100, 425,700) |
| 117 | { |
| 118 | devices = NULL; |
| 119 | connected_device = NULL; |
| 120 | |
| 121 | FXVerticalFrame *vf = new FXVerticalFrame(this, LAYOUT_FILL_Y|LAYOUT_FILL_X); |
| 122 | |
| 123 | FXLabel *label = new FXLabel(vf, "HIDAPI Test Tool"); |
| 124 | title_font = new FXFont(getApp(), "Arial", 14, FXFont::Bold); |
| 125 | label->setFont(title_font); |
| 126 | |
| 127 | new FXLabel(vf, |
| 128 | "Select a device and press Connect.", NULL, JUSTIFY_LEFT); |
| 129 | new FXLabel(vf, |
| 130 | "Output data bytes can be entered in the Output section, \n" |
| 131 | "separated by space, comma or brackets. Data starting with 0x\n" |
| 132 | "is treated as hex. Data beginning with a 0 is treated as \n" |
| 133 | "octal. All other data is treated as decimal.", NULL, JUSTIFY_LEFT); |
| 134 | new FXLabel(vf, |
| 135 | "Data received from the device appears in the Input section.", |
| 136 | NULL, JUSTIFY_LEFT); |
| 137 | new FXLabel(vf, |
| 138 | "Optionally, a report length may be specified. Extra bytes are\n" |
| 139 | "padded with zeros. If no length is specified, the length is \n" |
| 140 | "inferred from the data.", |
| 141 | NULL, JUSTIFY_LEFT); |
| 142 | new FXLabel(vf, ""); |
| 143 | |
| 144 | // Device List and Connect/Disconnect buttons |
| 145 | FXHorizontalFrame *hf = new FXHorizontalFrame(vf, LAYOUT_FILL_X); |
| 146 | //device_list = new FXList(new FXHorizontalFrame(hf,FRAME_SUNKEN|FRAME_THICK, 0,0,0,0, 0,0,0,0), NULL, 0, LISTBOX_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT, 0,0,300,200); |
| 147 | device_list = new FXList(new FXHorizontalFrame(hf,FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0,0,0,0, 0,0,0,0), NULL, 0, LISTBOX_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0,0,300,200); |
| 148 | FXVerticalFrame *buttonVF = new FXVerticalFrame(hf); |
| 149 | connect_button = new FXButton(buttonVF, "Connect", NULL, this, ID_CONNECT, BUTTON_NORMAL|LAYOUT_FILL_X); |
| 150 | disconnect_button = new FXButton(buttonVF, "Disconnect", NULL, this, ID_DISCONNECT, BUTTON_NORMAL|LAYOUT_FILL_X); |
| 151 | disconnect_button->disable(); |
| 152 | rescan_button = new FXButton(buttonVF, "Re-Scan devices", NULL, this, ID_RESCAN, BUTTON_NORMAL|LAYOUT_FILL_X); |
| 153 | new FXHorizontalFrame(buttonVF, 0, 0,0,0,0, 0,0,50,0); |
| 154 | |
| 155 | connected_label = new FXLabel(vf, "Disconnected"); |
| 156 | |
| 157 | new FXHorizontalFrame(vf); |
| 158 | |
| 159 | // Output Group Box |
| 160 | FXGroupBox *gb = new FXGroupBox(vf, "Output", FRAME_GROOVE|LAYOUT_FILL_X); |
| 161 | FXMatrix *matrix = new FXMatrix(gb, 3, MATRIX_BY_COLUMNS|LAYOUT_FILL_X); |
| 162 | new FXLabel(matrix, "Data"); |
| 163 | new FXLabel(matrix, "Length"); |
| 164 | new FXLabel(matrix, ""); |
| 165 | |
| 166 | //hf = new FXHorizontalFrame(gb, LAYOUT_FILL_X); |
| 167 | output_text = new FXTextField(matrix, 30, NULL, 0, TEXTFIELD_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN); |
| 168 | output_text->setText("1 0x81 0"); |
| 169 | output_len = new FXTextField(matrix, 5, NULL, 0, TEXTFIELD_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN); |
| 170 | output_button = new FXButton(matrix, "Send Output Report", NULL, this, ID_SEND_OUTPUT_REPORT, BUTTON_NORMAL|LAYOUT_FILL_X); |
| 171 | output_button->disable(); |
| 172 | //new FXHorizontalFrame(matrix, LAYOUT_FILL_X); |