function create_classes_dlg($parent) { global $wb, $classes_table; $nclasses = count($wb->classes); // Create window $pos = wb_get_position($parent); $width = 88; $height = 23 + 26 * ceil($nclasses / 3); $wb->classdlg = wb_create_window($parent, ToolDialog, "Controls", max(0, $pos[0] - $width), max(0, $pos[1]), $width, $height); wb_set_handler($wb->classdlg, "process_classes"); // Create buttons, one for each control for ($i = 0; $i < $nclasses; $i++) { $const = "IDC_" . strtoupper($wb->classes[$i][1]); $c = wb_create_control($wb->classdlg, ImageButton, $wb->classes[$i][1], 4 + 25 * ($i % 3), 4 + 25 * (int) ($i / 3), 24, 24, constant($const), 0); $img = wb_load_image(PATH_RESPVT . "ctrl_{$wb->classes[$i][1]}3.bmp"); wb_set_image($c, $img, 0, 0, 3); wb_destroy_image($img); } }
function reset_form($class, $parent, $title, $width, $height, $style = 0, $value = 0) { global $wb; $wb->currentform = 0; $wb->proj_filename = null; if (!isset($wb->form[$wb->currentform])) { $wb->form[$wb->currentform] = new stdclass(); } // Reset form data with fixed attributes $wb->form[$wb->currentform]->ct = array(); $wb->form[$wb->currentform]->numcontrols = 0; $wb->form[$wb->currentform]->ncurrindex = 0; $wb->form[$wb->currentform]->nselcontrol = -1; $wb->form[$wb->currentform]->treenode = 0; foreach ($wb->project_array as $var) { $wb->form[$wb->currentform]->{$var} = constant("DEFAULT_" . strtoupper($var)); } // Variable attributes $wb->form[$wb->currentform]->width = $width; $wb->form[$wb->currentform]->height = $height; $wb->form[$wb->currentform]->caption = $title; $wb->form[$wb->currentform]->cclass = $class; $wb->form[$wb->currentform]->style = (int) $style; $wb->form[$wb->currentform]->value = (int) $value; // Resize, reposition and show form $pos = wb_get_position($parent); wb_set_position($wb->formwin, $pos[0] + 180, $pos[1] + 76); wb_set_size($wb->formwin, $width, $height); wb_set_text($wb->formwin, $title); wb_set_visible($wb->formwin, true); // Create a treeview item for this form wb_delete_items($wb->tree, $wb->form[$wb->currentform]->treenode); $root = $wb->rootnode; $node = wb_create_items($wb->tree, array(array($title, $wb->currentform, $root, 8, 9, 2))); $wb->form[$wb->currentform]->treenode = $node; // numforms is always set to 1 $wb->numforms = 1; // Expand the root and select the new node wb_set_state($wb->tree, $root, 1); wb_set_selected($wb->tree, $node); }
function save_window_geom($window, $prefix, $resize = false) { global $wb; if (!$window) { return; } $pos = wb_get_position($window); $size = wb_get_size($window); if ($resize) { $wb->settings["Settings"][$prefix . "_geom"] = "{$pos[0]} {$pos[1]} {$size[0]} {$size[1]}"; } else { $wb->settings["Settings"][$prefix . "_geom"] = "{$pos[0]} {$pos[1]}"; } }