2024.8.23
Loading...
Searching...
No Matches
wb_windows.inc.php File Reference

Go to the source code of this file.

Functions

 _make_file_filter ($filter)
 
 wb_create_control ($parent, $class, $caption="", $xpos=0, $ypos=0, $width=0, $height=0, $id=null, $style=0, $lparam=null, $ntab=0)
 
 wb_create_items ($ctrl, $items, $clear=false, $param=null)
 
 wb_get_text ($ctrl, $item=null, $subitem=null)
 
 wb_set_selected ($ctrl, $selitems, $selected=TRUE)
 
 wb_set_text ($ctrl, $text, $item=null, $subitem=null)
 
 wb_set_value ($ctrl, $value, $item=null)
 
 wb_sys_dlg_open ($parent=null, $title=null, $filter=null, $path=null, $filename=null, $flags=null)
 
 wb_sys_dlg_save ($parent=null, $title=null, $filter=null, $path=null, $filename=null, $defext=null)
 

Variables

const BM_SETCHECK 241
 
const CB_FINDSTRINGEXACT 344
 
const CB_SETCURSEL 334
 
const LB_FINDSTRINGEXACT 418
 
const LB_SETCURSEL 390
 
const LVIS_SELECTED 2
 
const LVM_DELETEALLITEMS (LVM_FIRST+9)
 
const LVM_FIRST 0x1000
 
const LVM_GETITEMCOUNT (LVM_FIRST+4)
 
const LVM_GETITEMSTATE (LVM_FIRST+44)
 
const LVM_GETSELECTEDCOUNT (LVM_FIRST+50)
 
const TCM_GETCURSEL 4875
 
const TCM_SETCURSEL 4876
 
const WM_SETTEXT 12
 

Function Documentation

◆ _make_file_filter()

_make_file_filter ( $filter)

Definition at line 495 of file wb_windows.inc.php.

496{
497 if(!$filter)
498 return "All Files (*.*)\0*.*\0\0";
499
500 if(is_array($filter)) {
501 $result = "";
502 foreach($filter as $line)
503 $result .= "$line[0] ($line[1])\0$line[1]\0";
504 $result .= "\0";
505 return $result;
506 } else
507 return $filter;
508}
$result

References $result.

Referenced by wb_sys_dlg_open(), and wb_sys_dlg_save().

+ Here is the caller graph for this function:

◆ wb_create_control()

wb_create_control ( $parent,
$class,
$caption = "",
$xpos = 0,
$ypos = 0,
$width = 0,
$height = 0,
$id = null,
$style = 0,
$lparam = null,
$ntab = 0 )

Definition at line 43 of file wb_windows.inc.php.

44{
45 switch($class) {
46
47 case Accel:
48 return wbtemp_set_accel_table($parent, $caption);
49
50 case ToolBar:
51 return wbtemp_create_toolbar($parent, $caption, $width, $height, $lparam);
52
53 case Menu:
54 return wbtemp_create_menu($parent, $caption);
55
56 case HyperLink:
57 return wbtemp_create_control($parent, $class, $caption, $xpos, $ypos, $width, $height, $id, $style,
58 is_null($lparam) ? NOCOLOR : $lparam, $ntab);
59
60 case ComboBox:
61 case ListBox:
62 case ListView:
63 $ctrl = wbtemp_create_control($parent, $class, $caption, $xpos, $ypos, $width, $height, $id, $style, $lparam, $ntab);
64 if(is_array($caption))
65 wb_set_text($ctrl, $caption[0]);
66 return $ctrl;
67
68 case TreeView:
69 $ctrl = wbtemp_create_control($parent, $class, $caption, $xpos, $ypos, $width, $height, $id, $style, $lparam, $ntab);
70 if(is_array($caption))
71 wb_set_text($ctrl, $caption[0]);
72 return $ctrl;
73
74 case Gauge:
75 case Slider:
76 case ScrollBar:
77 $ctrl = wbtemp_create_control($parent, $class, $caption, $xpos, $ypos, $width, $height, $id, $style, $lparam, $ntab);
78 if($lparam)
79 wb_set_value($ctrl, $lparam);
80 return $ctrl;
81
82 default:
83 return wbtemp_create_control($parent, $class, $caption, $xpos, $ypos, $width, $height, $id, $style, $lparam, $ntab);
84 }
85}
wb_set_text($ctrl, $text, $item=null, $subitem=null)
wb_set_value($ctrl, $value, $item=null)

References wb_set_text(), and wb_set_value().

◆ wb_create_items()

wb_create_items ( $ctrl,
$items,
$clear = false,
$param = null )

Definition at line 386 of file wb_windows.inc.php.

387{
388 switch(wb_get_class($ctrl)) {
389
390 case ListView:
391
392 if($clear)
393 wb_send_message($ctrl, LVM_DELETEALLITEMS, 0, 0);
394
395 $last = -1;
396
397 // For each row
398
399 for($i = 0; $i < count($items); $i++) {
400 if(!is_scalar($items[$i]))
401 $last = wbtemp_create_listview_item(
402 $ctrl, -1, -1, (string)$items[$i][0]);
403 else
404 $last = wbtemp_create_listview_item(
405 $ctrl, -1, -1, (string)$items[$i]);
406 wbtemp_set_listview_item_text($ctrl, -1, 0, (string)$items[$i][0]);
407
408 // For each column except the first
409
410 for($sub = 0; $sub < count($items[$i]) - 1; $sub++) {
411 if($param) {
412 $result = call_user_func($param, // Callback function
413 $items[$i][$sub + 1], // Item value
414 $i, // Row
415 $sub // Column
416 );
417 wbtemp_set_listview_item_text($ctrl, $last, $sub + 1, $result);
418 } else
419 wbtemp_set_listview_item_text($ctrl, $last, $sub + 1, (string)$items[$i][$sub + 1]);
420 }
421 }
422 return $last;
423 break;
424
425 case TreeView:
426
427 if($clear)
428 $handle = wb_delete_items($ctrl); // Empty the treeview
429
430 if(!$items)
431 break;
432 $ret = array();
433 for($i = 0; $i < count($items); $i++) {
434 $ret[] = wbtemp_create_treeview_item($ctrl,
435 (string)$items[$i][0], // Name
436 isset($items[$i][1]) ? $items[$i][1] : 0, // Value
437 isset($items[$i][2]) ? $items[$i][2] : 0, // Where
438 isset($items[$i][3]) ? $items[$i][3] : -1, // ImageIndex
439 isset($items[$i][4]) ? $items[$i][4] : -1, // SelectedImageIndex
440 isset($items[$i][5]) ? $items[$i][5] : 0 // InsertionType
441 );
442 }
443 return (count($ret) > 1 ? $ret : $ret[0]);
444 break;
445
446 case StatusBar:
447 wbtemp_create_statusbar_items($ctrl, $items, $clear, $param);
448 return true;
449
450 default:
451
452 if(is_array($items)) {
453 foreach($items as $item)
454 wbtemp_create_item($ctrl, $item);
455 return true;
456 } else
457 return wbtemp_create_item($ctrl, $items);
458 break;
459 }
460}
const LVM_DELETEALLITEMS

References $result, and LVM_DELETEALLITEMS.

Referenced by wb_set_text().

+ Here is the caller graph for this function:

◆ wb_get_text()

wb_get_text ( $ctrl,
$item = null,
$subitem = null )

Definition at line 136 of file wb_windows.inc.php.

137{
138 if(!$ctrl)
139 return null;
140
141 if(wb_get_class($ctrl) == ListView) {
142
143 if($item !== null) { // Valid item
144
145 $line = wbtemp_get_listview_text($ctrl, $item);
146 if($subitem === null)
147 return $line;
148 else
149 return $line[$subitem];
150
151 } else { // NULL item
152
153 $sel = wb_get_selected($ctrl);
154 if($sel === null) { // Returns the entire table
155 $items = array();
156 for($i = 0;;$i++) {
157 $item = wbtemp_get_listview_text($ctrl, $i);
158 $all = '';
159 foreach($item as $col)
160 $all .= $col;
161 if($all == '')
162 break;
163 $items[] = $item;
164 }
165 return $items ? $items : null;
166 } else {
167 $items = array();
168 foreach($sel as $row)
169 $items[] = wbtemp_get_listview_text($ctrl, $row);
170 return $items ? $items : null;
171 }
172 }
173
174 } elseif(wb_get_class($ctrl) == TreeView) {
175
176 if($item) {
177 return wbtemp_get_treeview_item_text($ctrl, $item);
178 } else {
179 $sel = wb_get_selected($ctrl);
180 if($sel === null)
181 return null;
182 else {
183 return wbtemp_get_text($ctrl);
184 }
185 }
186
187 } elseif(wb_get_class($ctrl) == ComboBox) {
188
189 return wbtemp_get_text($ctrl, $item === null ? -1 : $item);
190
191 } elseif(wb_get_class($ctrl) == ListBox) {
192
193 return wbtemp_get_text($ctrl, $item === null ? -1 : $item);
194
195 } else {
196
197 return wbtemp_get_text($ctrl, $item);
198
199 }
200}

◆ wb_set_selected()

wb_set_selected ( $ctrl,
$selitems,
$selected = TRUE )

Definition at line 339 of file wb_windows.inc.php.

340{
341 switch(wb_get_class($ctrl)) {
342
343 case ComboBox:
344 wb_send_message($ctrl, CB_SETCURSEL, (int)$selitems, 0);
345 break;
346
347 case ListBox:
348 wb_send_message($ctrl, LB_SETCURSEL, (int)$selitems, 0);
349 break;
350
351 case ListView:
352
353 if(is_null($selitems)) {
354 return wbtemp_select_all_listview_items($ctrl, false);
355 } elseif(is_array($selitems)) {
356 foreach($selitems as $item)
357 wbtemp_select_listview_item($ctrl, $item, $selected);
358 return TRUE;
359 } else
360 return wbtemp_select_listview_item($ctrl, $selitems, $selected);
361 break;
362
363 case Menu:
364 return wbtemp_set_menu_item_checked($ctrl, $selitems, $selected);
365
366 case TabControl:
367 wbtemp_select_tab($ctrl, (int)$selitems);
368 break;
369
370 case TreeView:
371 wbtemp_set_treeview_item_selected($ctrl, $selitems);
372 break;
373
374 default:
375 return false;
376 }
377 return true;
378}
const LB_SETCURSEL
const CB_SETCURSEL

References CB_SETCURSEL, and LB_SETCURSEL.

◆ wb_set_text()

wb_set_text ( $ctrl,
$text,
$item = null,
$subitem = null )

Definition at line 211 of file wb_windows.inc.php.

212{
213 if(!$ctrl)
214 return null;
215
216 switch(wb_get_class($ctrl)) {
217
218 case ListView:
219
220 if($item !== null) {
221
222 if(!is_array($text) && $subitem !== null) {
223
224 // Set text of a ListView cell according to $item and $subitem
225
226 wbtemp_set_listview_item_text($ctrl, $item, $subitem, $text);
227
228 } else {
229
230 // Set text of several ListView cells, ignoring $subitem
231
232 for($sub = 0; $sub < count($text); $sub++) {
233 if($text) {
234 if(($text[$sub] !== null)) {
235 wbtemp_set_listview_item_text($ctrl, $item, $sub, (string)$text[$sub]);
236 }
237 } else {
238 wbtemp_set_listview_item_text($ctrl, $item, $sub, "");
239 }
240 }
241 }
242
243 } else {
244
245 if(!is_array($text))
246 $text = explode(",", $text);
247
248 wb_delete_items($ctrl, null);
249
250 if(!$item) {
251 wbtemp_clear_listview_columns($ctrl);
252
253 // Create column headers
254 // In the loop below, passing -1 as the 'width' argument of wbtemp_create_listview_column()
255 // makes it calculate the column width automatically
256
257 for($i = 0; $i < count($text); $i++) {
258 if(is_array($text[$i]))
259 wbtemp_create_listview_column($ctrl, $i,
260 (string)$text[$i][0],
261 isset($text[$i][1]) ? (int)$text[$i][1] : -1,
262 isset($text[$i][2]) ? (int)$text[$i][2] : WBC_LEFT
263 );
264 else
265 wbtemp_create_listview_column($ctrl, $i,
266 (string)$text[$i], -1, 0);
267 }
268 }
269 }
270 break;
271
272 case ListBox:
273
274 if(!$text) {
275 wb_delete_items($ctrl);
276 } elseif(is_string($text)) {
277 if(strchr($text, "\r") || strchr($text, "\n")) {
278 $text = preg_split("/[\r\n,]/", $text);
279 wb_delete_items($ctrl);
280 foreach($text as $str)
281 wbtemp_create_item($ctrl, (string)$str);
282 } else {
283 $index = wb_send_message($ctrl, LB_FINDSTRINGEXACT, -1, wb_get_address($text));
284 wb_send_message($ctrl, LB_SETCURSEL, $index, 0);
285 }
286 } elseif(is_array($text)) {
287 wb_delete_items($ctrl);
288 foreach($text as $str)
289 wbtemp_create_item($ctrl, (string)$str);
290 }
291 return;
292
293 case ComboBox:
294
295 if(!$text)
296 wb_delete_items($ctrl);
297 elseif(is_string($text)) {
298 if(strchr($text, "\r") || strchr($text, "\n")) {
299 $text = preg_split("/[\r\n,]/", $text);
300 wb_delete_items($ctrl);
301 foreach($text as $str)
302 wbtemp_create_item($ctrl, (string)$str);
303 } else {
304 $index = wb_send_message($ctrl, CB_FINDSTRINGEXACT, -1, wb_get_address($text));
305 wb_send_message($ctrl, CB_SETCURSEL, $index, 0);
306 if($index == -1)
307 wb_send_message($ctrl, WM_SETTEXT, 0, wb_get_address($text));
308 }
309 } elseif(is_array($text)) {
310 wb_delete_items($ctrl);
311 foreach($text as $str)
312 wbtemp_create_item($ctrl, (string)$str);
313 }
314 return;
315
316 case TreeView:
317
318 if($item)
319 return wbtemp_set_treeview_item_text($ctrl, $item, $text);
320 else
321 return wb_create_items($ctrl, $text, true);
322
323 default:
324 // The (string) cast below works well but is a temporary fix, must be
325 // removed when wbtemp_set_text() accepts numeric types correctly
326 if(is_array($text))
327 return wbtemp_set_text($ctrl, $text, $item);
328 else
329 return wbtemp_set_text($ctrl, (string)$text, $item);
330 }
331}
const CB_FINDSTRINGEXACT
wb_create_items($ctrl, $items, $clear=false, $param=null)
const LB_FINDSTRINGEXACT
const WM_SETTEXT

References CB_FINDSTRINGEXACT, CB_SETCURSEL, LB_FINDSTRINGEXACT, LB_SETCURSEL, wb_create_items(), and WM_SETTEXT.

Referenced by wb_create_control().

+ Here is the caller graph for this function:

◆ wb_set_value()

wb_set_value ( $ctrl,
$value,
$item = null )

Definition at line 93 of file wb_windows.inc.php.

94{
95 if(!$ctrl)
96 return null;
97
98 $class = wb_get_class($ctrl);
99 switch($class) {
100
101 case ListView: // Array with items to be checked
102
103 if($value === null)
104 break;
105 elseif(is_string($value) && strstr($value, ","))
106 $values = explode(",", $value);
107 elseif(!is_array($value))
108 $values = array($value);
109 else
110 $values = $value;
111 foreach($values as $index)
112 wbtemp_set_listview_item_checked($ctrl, $index, 1);
113 break;
114
115 case TreeView: // Array with items to be checked
116
117 if($item === null)
118 $item = wb_get_selected($ctrl);
119 return wbtemp_set_treeview_item_value($ctrl, $item, $value);
120
121 default:
122
123 if($value !== null) {
124 return wbtemp_set_value($ctrl, $value, $item);
125 }
126 }
127}
foreach( $bearsamppBins->getApache() ->getModulesFromConf() as $moduleName=> $moduleStatus) foreach($bearsamppBins->getApache() ->getAlias() as $alias) foreach( $bearsamppBins->getApache() ->getWwwDirectories() as $wwwDirectory) foreach( $bearsamppBins->getApache() ->getVhostsUrl() as $vhost=> $enabled)
if(in_array($proc, $procs)) else
Definition ajax.php:58
if(!defined("APPPREFIX")) define("APPPREFIX"

Referenced by wb_create_control().

+ Here is the caller graph for this function:

◆ wb_sys_dlg_open()

wb_sys_dlg_open ( $parent = null,
$title = null,
$filter = null,
$path = null,
$filename = null,
$flags = null )

Definition at line 468 of file wb_windows.inc.php.

469{
470 $filter = _make_file_filter($filter ? $filter : $filename);
471 return wbtemp_sys_dlg_open($parent, $title, $filter, $path, $flags);
472}
_make_file_filter($filter)

References _make_file_filter().

◆ wb_sys_dlg_save()

wb_sys_dlg_save ( $parent = null,
$title = null,
$filter = null,
$path = null,
$filename = null,
$defext = null )

Definition at line 480 of file wb_windows.inc.php.

481{
482 $filter = _make_file_filter($filter ? $filter : $filename);
483
484 return wbtemp_sys_dlg_save($parent, $title, $filter, $path, $filename, $defext);
485}

References _make_file_filter().

Variable Documentation

◆ BM_SETCHECK

const BM_SETCHECK 241

Definition at line 20 of file wb_windows.inc.php.

◆ CB_FINDSTRINGEXACT

const CB_FINDSTRINGEXACT 344

Definition at line 28 of file wb_windows.inc.php.

Referenced by wb_set_text().

◆ CB_SETCURSEL

const CB_SETCURSEL 334

Definition at line 29 of file wb_windows.inc.php.

Referenced by wb_set_selected(), and wb_set_text().

◆ LB_FINDSTRINGEXACT

const LB_FINDSTRINGEXACT 418

Definition at line 30 of file wb_windows.inc.php.

Referenced by wb_set_text().

◆ LB_SETCURSEL

const LB_SETCURSEL 390

Definition at line 31 of file wb_windows.inc.php.

Referenced by wb_set_selected(), and wb_set_text().

◆ LVIS_SELECTED

const LVIS_SELECTED 2

Definition at line 26 of file wb_windows.inc.php.

◆ LVM_DELETEALLITEMS

const LVM_DELETEALLITEMS (LVM_FIRST+9)

Definition at line 22 of file wb_windows.inc.php.

Referenced by wb_create_items().

◆ LVM_FIRST

const LVM_FIRST 0x1000

Definition at line 21 of file wb_windows.inc.php.

◆ LVM_GETITEMCOUNT

const LVM_GETITEMCOUNT (LVM_FIRST+4)

Definition at line 23 of file wb_windows.inc.php.

◆ LVM_GETITEMSTATE

const LVM_GETITEMSTATE (LVM_FIRST+44)

Definition at line 24 of file wb_windows.inc.php.

◆ LVM_GETSELECTEDCOUNT

const LVM_GETSELECTEDCOUNT (LVM_FIRST+50)

Definition at line 25 of file wb_windows.inc.php.

◆ TCM_GETCURSEL

const TCM_GETCURSEL 4875

Definition at line 27 of file wb_windows.inc.php.

◆ TCM_SETCURSEL

const TCM_SETCURSEL 4876

Definition at line 32 of file wb_windows.inc.php.

◆ WM_SETTEXT

const WM_SETTEXT 12

Definition at line 33 of file wb_windows.inc.php.

Referenced by wb_set_text().