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 read_window_geom($window, $prefix, $resize = false) { global $wb; if (!$window) { return; } $geom = $wb->settings["Settings"][$prefix . "_geom"]; $geom = preg_split("/\\s+/", $geom); $desk = wb_get_system_info('workarea'); $desk = preg_split("/\\s+/", $desk); wb_set_position($window, max(min((int) $desk[2] - $geom[2], $geom[0]), 0), max(min((int) $desk[3] - $geom[3], $geom[1]), 0)); if ($resize) { wb_set_size($window, min(max(MIN_WIDTH, (int) $geom[2]), (int) $desk[2]), min(max(MIN_HEIGHT, (int) $geom[3]), (int) $desk[3])); } }
function wb_gotWindow($Timer = 0, $Title = 'Привет! :)', $Text = array(), $Wdth = 220, $Rate = 0.75, $X = null, $Y = null) { //© roxblnfk ;) $wid = WB_FloatWindow; // window id $Wa = explode(' ', wb_get_system_info('workarea')); $W = intval(max($Wdth, 200)); $H = 150; WinAPI_USER::GetCursorPos($xx, $yy); if (is_array($Text)) { if (($j = count($Text)) > 5) { $H = 50 + $j * 20; } } else { $H = 200; } if (!isset($X)) { $X = $Wa[2] - $W; } elseif ($X === true) { $X = $xx; } if (!isset($Y)) { $Y = $Wa[3] - $H; } elseif ($Y === true) { $Y = $yy; } if (isset(self::$wb_windows[$wid])) { $NEW = false; /* if(wb_get_visible(self::$wb_windows[$wid])) wb_destroy_timer(self::$wb_windows[$wid],WB_FloatWindow_Timer); else wb_set_visible(self::$wb_windows[$wid],true); wb_set_position(self::$wb_windows[$wid],$X,$Y); wb_set_size(self::$wb_windows[$wid], $W, $H); wb_set_size(self::$wb_controls[$wid][WB_FloatWindow_Title],$W-4,20); wb_set_text(self::$wb_controls[$wid][WB_FloatWindow_Title],$Title); wb_set_position(self::$wb_controls[$wid][WB_FloatWindow_Title],2,2); */ $keys = array_keys(self::$wb_controls[$wid][WB_FloatWindow_Labels]); for ($i = 0, $j = count($keys); $i < $j; $i++) { wb_destroy_control(self::$wb_controls[$wid][WB_FloatWindow_Labels][$keys[$i]]); unset(self::$wb_controls[$wid][WB_FloatWindow_Labels][$keys[$i]]); // if(isset(self::$wb_controls[$wid][СКЕТЧ ЦЕННОСТЬ][$keys[$i]])){ // wb_destroy_control(self::$wb_controls[$wid][СКЕТЧ ЦЕННОСТЬ][$keys[$i]]); // unset(self::$wb_controls[$wid][СКЕТЧ ЦЕННОСТЬ][$keys[$i]]); // } } } else { $NEW = true; self::$wb_windows[$wid] = wb_create_window(null, NakedWindow, "ololo", $X, $Y, $W, $H, WBC_NOTIFY, WBC_MOUSEUP); //wb_set_visible(self::$wb_windows[$wid], false); //alert(self::$wb_windows[$wid]); self::$wb_controls[$wid] = array(); self::$wb_controls[$wid][WB_FloatWindow_Title] = wb_create_control(self::$wb_windows[$wid], Label, $Title, 2, 2, $W - 4, 20, WB_FloatWindow_Title, WBC_CENTER, 0, 0); } /* if(is_array($Text)){ $keys=array_keys($Text); $l1=intval(($W-15)*$Rate); for($i=0,$j=count($keys);$i<$j;$i++){ $k=$keys[$i]; if(!is_array($Text[$k]))$Text[$k]=array($Text[$k]); if(count($Text[$k])>=2){ self::$wb_controls[$wid][WB_FloatWindow_Labels][$i]= wb_create_control(self::$wb_windows[$wid],Label,$Text[$k][0],10,30+$i*20,$l1,20,0,WBC_RIGHT,0,0); // self::$wb_controls[$wid][СКЕТЧ ЦЕННОСТЬ][$i]= wb_create_control(self::$wb_windows[$wid],Label,$Text[$k][1],15+$l1,30+$i*20,$W-20-$l1,20,0,WBC_LEFT,0,0); continue; }else{ $Text[$k]=reset($Text[$k]); self::$wb_controls[$wid][WB_FloatWindow_Labels][$i]= wb_create_control(self::$wb_windows[$wid],Label,strval($Text[$k]),10,30+$i*20,$W-15,20,0,WBC_CENTER,0,0); } } }else self::$wb_controls[$wid][WB_FloatWindow_Labels][0]= wb_create_control(self::$wb_windows[$wid],RTFEditBox,strval($Text),2,25,$W-4,$H-40,WB_FloatWindow_Labels,WBC_READONLY,0,0); //*/ if ($Timer < 100) { $Timer = intval(2147483640); } wb_create_timer(self::$wb_windows[$wid], WB_FloatWindow_Timer, $Timer); if ($NEW) { self::$wb_controls[$wid][WB_FloatWindow_Font] = wb_create_font('Calibri', 12, BLACK, FTA_BOLD); wb_set_font(self::$wb_controls[$wid][WB_FloatWindow_Title], self::$wb_controls[$wid][WB_FloatWindow_Font]); wb_set_handler(self::$wb_windows[$wid], 'dsSpy::wb_procWindow'); } wb_set_size(self::$wb_windows[$wid], WBC_NORMAL); //self::showWindow(self::$wb_windows[$wid],500); //WinAPI_USER::CloseWindow(wb_get_id(self::$wb_windows[$wid])); }