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]}"; } }
function draw_frame($buffer, $caption, $xstart, $ystart, $width, $height, $style, $value) { global $cl, $wb; if ($width > $height && $height <= 8) { // Draw a horizontal line $xend = $xstart + $width; if ($wb->wireframe || $wb->ghoststate) { wb_draw_line($buffer, $xstart, $ystart + 0, $xend - 1, $ystart + 0, $cl->shade, 0, $wb->wirestyle); } else { wb_draw_line($buffer, $xstart, $ystart + 1, $xend - 1, $ystart + 1, $cl->hilite); wb_draw_line($buffer, $xstart, $ystart + 0, $xend - 1, $ystart + 0, $cl->shade); } } else { if ($width < $height && $width <= 8) { // Draw a vertical line $yend = $ystart + $height; if ($wb->wireframe || $wb->ghoststate) { wb_draw_line($buffer, $xstart, $ystart, $xstart, $yend - 1, $cl->shade, 0, $wb->wirestyle); } else { wb_draw_line($buffer, $xstart + 1, $ystart, $xstart + 1, $yend - 1, $cl->hilite); wb_draw_line($buffer, $xstart, $ystart, $xstart, $yend - 1, $cl->shade); } } else { // Draw the frame box $xend = $xstart + $width; $yend = $ystart + $height; if ($width <= 14) { $caption = ""; } else { $textsize = wb_get_size($caption, $cl->sysfont); } if ($wb->wireframe || $wb->ghoststate) { if ($caption) { wb_draw_line($buffer, $xstart, $ystart + 6, $xstart + 10, $ystart + 6, $cl->shade, 0, $wb->wirestyle); if ($width > 14 + $textsize[0]) { wb_draw_line($buffer, $xstart + 17 + $textsize[0], $ystart + 6, $xend - 1, $ystart + 6, $cl->shade, 0, $wb->wirestyle); } } else { wb_draw_line($buffer, $xstart, $ystart + 6, $xend - 1, $ystart + 6, $cl->shade, 0, $wb->wirestyle); } wb_draw_line($buffer, $xstart, $ystart + 6, $xstart, $yend - 1, $cl->shade, 0, $wb->wirestyle); wb_draw_line($buffer, $xend - 1, $ystart + 6, $xend - 1, $yend - 1, $cl->shade, 0, $wb->wirestyle); wb_draw_line($buffer, $xstart, $yend - 1, $xend - 1, $yend - 1, $cl->shade, 0, $wb->wirestyle); } else { if ($caption) { wb_draw_line($buffer, $xstart + 1, $ystart + 7, $xstart + 10, $ystart + 7, $cl->hilite); if ($width > 14 + $textsize[0]) { wb_draw_line($buffer, $xstart + 17 + $textsize[0], $ystart + 7, $xend, $ystart + 7, $cl->hilite); } } else { wb_draw_line($buffer, $xstart + 1, $ystart + 7, $xend - 1, $ystart + 7, $cl->hilite); } wb_draw_line($buffer, $xstart + 1, $ystart + 7, $xstart + 1, $yend, $cl->hilite); wb_draw_line($buffer, $xend, $ystart + 7, $xend, $yend, $cl->hilite); wb_draw_line($buffer, $xstart + 1, $yend, $xend, $yend, $cl->hilite); if ($caption) { wb_draw_line($buffer, $xstart, $ystart + 6, $xstart + 10, $ystart + 6, $cl->shade); if ($width > 14 + $textsize[0]) { wb_draw_line($buffer, $xstart + 17 + $textsize[0], $ystart + 6, $xend - 1, $ystart + 6, $cl->shade); } } else { wb_draw_line($buffer, $xstart, $ystart + 6, $xend - 1, $ystart + 6, $cl->shade); } wb_draw_line($buffer, $xstart, $ystart + 6, $xstart, $yend - 1, $cl->shade); wb_draw_line($buffer, $xend - 1, $ystart + 6, $xend - 1, $yend - 1, $cl->shade); wb_draw_line($buffer, $xstart, $yend - 1, $xend - 1, $yend - 1, $cl->shade); } // Draw frame text wb_draw_text($buffer, $caption, $xstart + 14, $ystart, $width - 14, $height, $style & WBC_DISABLED ? $cl->disabledfont : $cl->sysfont, WBC_LEFT | WBC_TOP); } } }
<?php /******************************************************************************* WINBINDER - form editor PHP file (generated automatically) *******************************************************************************/ // Control identifiers if (!defined('IDC_TREEVIEW')) { define('IDC_TREEVIEW', 1001); } // Create window $dim = explode(" ", wb_get_system_info("workarea")); $wb->mainwin = wb_create_window(null, AppWindow | ResizableWindow, $wb->vars["Lang"]["system_name"], 0, 0, $dim[2], $dim[3], 0x200 | WBC_NOTIFY, WBC_RESIZE | WBC_REDRAW | WBC_HEADERSEL); $dim = wb_get_size($wb->mainwin, true); $wb->winwidth = $dim[0]; $wb->winheight = $dim[1]; // Insert controls $wb->tree_view = wb_create_control($wb->mainwin, TreeView, 'TreeView1', 1, 2, 150, $wb->winheight - 40, IDC_TREEVIEW, WBC_LINES); wb_set_image($wb->tree_view, PATH_RES . "treeview.bmp", GREEN, 0, 10); $items = wb_create_items($wb->tree_view, array(array($wb->vars["Lang"]["lang_cust"] . $wb->vars["Lang"]["lang_manage"], 2001), array($wb->vars["Lang"]["lang_contact"], 2002, 1), array($wb->vars["Lang"]["lang_company"], 2003, 1), array($wb->vars["Lang"]["lang_product"], 2004, 1), array($wb->vars["Lang"]["lang_sale"] . $wb->vars["Lang"]["lang_manage"], 2005), array($wb->vars["Lang"]["lang_opportunity"], 2006, 1), array($wb->vars["Lang"]["lang_order"], 2007, 1), array($wb->vars["Lang"]["lang_agreement"], 2008, 1), array($wb->vars["Lang"]["lang_afterservice"] . $wb->vars["Lang"]["lang_manage"], 2009), array($wb->vars["Lang"]["lang_complaints"], 2010, 1), array($wb->vars["Lang"]["lang_refundment"], 2011, 1), array($wb->vars["Lang"]["lang_review"], 2012, 1))); // End controls
if (!defined('IDC_NAV_NEXT')) { define('IDC_NAV_NEXT', 2102); } if (!defined('IDC_NAV_FIRST')) { define('IDC_NAV_FIRST', 2103); } if (!defined('IDC_NAV_LAST')) { define('IDC_NAV_LAST', 2104); } if (!defined('IDC_CATEGORY_NAV_PRE')) { define('IDC_CATEGORY_NAV_PRE', 2105); } if (!defined('IDC_CATEGORY_NAV_NEXT')) { define('IDC_CATEGORY_NAV_NEXT', 2106); } if (!defined('IDC_CATEGORY_NAV_FIRST')) { define('IDC_CATEGORY_NAV_FIRST', 2107); } if (!defined('IDC_CATEGORY_NAV_LAST')) { define('IDC_CATEGORY_NAV_LAST', 2108); } // Insert controls $contact_tab = wb_create_control($wb->mainwin, TabControl, "{$wb->vars["Lang"]["lang_contact"]},{$wb->vars["Lang"]["lang_contact"]}{$wb->vars["Lang"]["lang_category"]}", 160, 30, $wb->winwidth - 160, $wb->winheight - 40, IDC_CONTACT_FORM, WBC_VISIBLE); $wb->right_control = $contact_tab; $dim = wb_get_size($contact_tab, true); // contact $contact_list = wb_create_control($contact_tab, ListView, "", 0, 10, $dim[0] - 10, $dim[1] - 120, IDC_CONTACT_DATA_LIST, WBC_VISIBLE | WBC_ENABLED | WBC_SORT | WBC_LINES | WBC_CHECKBOXES, 0, 0); $wb->contact_list = $contact_list; // contact category $wb->contact_category_list = wb_create_control($contact_tab, ListView, "", 0, 10, $dim[0] - 10, $dim[1] - 120, IDC_CONTACT_CATEGORY_DATA_LIST, WBC_VISIBLE | WBC_ENABLED | WBC_SORT | WBC_LINES | WBC_CHECKBOXES, 0, 1); // End controls
function renderCategoryForm($p_ctl) { global $wb; // navigator $dim = wb_get_size($p_ctl, true); $form_y = $dim[1] - 280 + 30; $form_x = 20; $search_frame = wb_create_control($p_ctl, Frame, $wb->vars["Lang"]["lang_search"], $form_x, $form_y, $dim[0] - 120, 40, 0, WBC_VISIBLE, 0, 1); $this->category_keyword = wb_create_control($search_frame, EditBox, "", 50, 15, 150, 21, IDC_CATEGORY_KEYWORD, WBC_VISIBLE | WBC_ENABLED, 0, 1); $category_nav_last = wb_create_control($search_frame, PushButton, $wb->vars["Lang"]["lang_search"], 220, 15, 80, 22, IDC_CATEGORY_SEARCH_SUBMIT, WBC_VISIBLE, 0, 1); wb_set_handler($search_frame, "process_main"); // detail form $detail_frame = wb_create_control($p_ctl, Frame, $wb->vars["Lang"]["lang_detail"], $form_x, $form_y + 40, $dim[0] - 120, 120, 0, WBC_VISIBLE, 0, 1); wb_create_control($detail_frame, Label, $wb->vars["Lang"]["lang_category"] . $wb->vars["Lang"]["lang_name"], 60, 15, 150, 14, 0, WBC_VISIBLE, 0, 1); $this->category_name = wb_create_control($detail_frame, EditBox, "", 120, 15, 150, 21, IDC_CATEGORY_KEYWORD, WBC_VISIBLE | WBC_ENABLED, 0, 1); // Group A include_once PATH_CONFIG . 'common.php'; $i = 0; foreach ($ActiveOption as $key => $value) { $this->category_active = wb_create_control($detail_frame, RadioButton, $key, 80 + $i * 70, 40, 70, 14, IDC_CATEGORY_ACTIVE, 0, 0); $i++; } wb_create_control($detail_frame, PushButton, $wb->vars["Lang"]["lang_new"], 130, 80, 90, 25, IDC_CATEGORY_SUBMIT, 0x0, 0, 0); wb_set_handler($detail_frame, "process_main"); }
function process_form($window, $id, $ctrl, $lparam1 = 0, $lparam2 = 0) { global $wb; static $controls = array(); static $isMoving = false; static $xcuroff = 0; static $ycuroff = 0; static $ctrl_lastpos = null; switch ($id) { case IDDEFAULT: if ($lparam1 & WBC_RESIZE) { // Form was resized $size = wb_get_size($wb->formwin); $wb->form[$wb->currentform]->width = $size[0]; $wb->form[$wb->currentform]->height = $size[1]; update_control_data(); } elseif ($lparam1 & WBC_REDRAW) { // Redraw screen // Draw the form background and grid $buffer = $lparam2; $dim = wb_get_size($window, true); $winwidth = $dim[0]; $winheight = $dim[1]; draw_background($buffer, $winwidth, $winheight); // Draw all controls from the current form for ($i = 0; $i < $wb->form[$wb->currentform]->numcontrols; $i++) { $ct = $wb->form[$wb->currentform]->ct[$i]; if ($ct) { draw_control($buffer, $ct); } } // Draw a "ghost" if ($ctrl_lastpos && $wb->ghost) { draw_ghost($buffer, $ctrl_lastpos); } // Is there a control selected? if ($wb->form[$wb->currentform]->nselcontrol >= 0) { $ct = $wb->form[$wb->currentform]->ct[$wb->form[$wb->currentform]->nselcontrol]; if (!$isMoving) { draw_handles($buffer, "", $ct->left, $ct->top, $ct->width, $ct->height); } } else { break; } } elseif ($lparam1 & WBC_MOUSEUP) { // A button was released $ctrl_lastpos = null; $isMoving = false; $wb->mouseop = false; $xcuroff = 0; $ycuroff = 0; wb_refresh($window, true); SetMyCursor(IDC_ARROW); $wb->mousecpos = NOWHERE; } elseif ($lparam1 & WBC_LBUTTON) { // Left button is held down $wb->mouseop = true; $xleft = $lparam2 & 0xffff; $ytop = ($lparam2 & 4294901760.0) >> 16; // Left mouse button was pressed if ($lparam1 & WBC_MOUSEDOWN) { // Can't change the current control while resizing or moving a control if ($wb->mousecpos == NOWHERE || $wb->mousecpos == INCONTROL) { // If mouse cursor is clicked inside a control, select a new one. // Search in reverse order because we need the topmost control $wb->form[$wb->currentform]->nselcontrol = -1; // Start with no control selected $form = $wb->form[$wb->currentform]; // Auxiliary variable // This loop finds and selects a new control as current for ($i = $form->numcontrols - 1; $i >= 0; $i--) { $cttest = $form->ct[$i]; if ($xleft >= $cttest->left && $xleft <= $cttest->left + $cttest->width && $ytop >= $cttest->top && $ytop <= $cttest->top + $cttest->height) { $ctrl_lastpos = $form->ct[$i]; $wb->form[$wb->currentform]->nselcontrol = $i; break; } } // No control selected update_control_data(); } } // $ct (an auxiliary variable) is set to the currently selected control if ($wb->form[$wb->currentform]->nselcontrol >= 0) { $ct = $wb->form[$wb->currentform]->ct[$wb->form[$wb->currentform]->nselcontrol]; } // **** Below: resizes aren't considering cursor offset if ($wb->mousecpos == INCONTROL) { // Moving control $x = $lparam2 & 0xffff; $y = ($lparam2 & 4294901760.0) >> 16; if (!$isMoving) { $isMoving = true; $xcuroff = $x - $ct->left; $ycuroff = $y - $ct->top; } SetMyCursor(IDC_CROSS); // Is grid active? $wb->form[$wb->currentform]->ct[$wb->form[$wb->currentform]->nselcontrol]->left = $wb->grid ? (int) (max(4, $x - $xcuroff) / 5) * 5 : $x - $xcuroff; $wb->form[$wb->currentform]->ct[$wb->form[$wb->currentform]->nselcontrol]->top = $wb->grid ? (int) (max(4, $y - $ycuroff) / 5) * 5 : $y - $ycuroff; update_control_data(); wb_refresh($window, true); } elseif ($wb->mousecpos == INNHANDLE) { // Resizing control (North) $y = ($lparam2 & 4294901760.0) >> 16; // Is grid active? $y1 = $wb->grid ? (int) (max(4, $y - 0) / 5) * 5 : $y; SetMyCursor(IDC_SIZENS); $bottom = $ct->top + $ct->height; $newtop = $y1 + HANDLE_YOFFSET_5; $newheight = $bottom - $newtop; if ($newheight > 0) { $wb->form[$wb->currentform]->ct[$wb->form[$wb->currentform]->nselcontrol]->top = $newtop; $wb->form[$wb->currentform]->ct[$wb->form[$wb->currentform]->nselcontrol]->height = $newheight; } update_control_data(); wb_refresh($window, true); } elseif ($wb->mousecpos == INEHANDLE) { // Resizing control (East) $x = $lparam2 & 0xffff; // Is grid active? $x1 = $wb->grid ? (int) (max(4, $x - 0) / 5) * 5 : $x; SetMyCursor(IDC_SIZEWE); $wb->form[$wb->currentform]->ct[$wb->form[$wb->currentform]->nselcontrol]->width = max(1, $x1 - $ct->left); update_control_data(); wb_refresh($window, true); } elseif ($wb->mousecpos == INWHANDLE) { // Resizing control (West) $x = $lparam2 & 0xffff; // Is grid active? $x1 = $wb->grid ? (int) (max(4, $x - 0) / 5) * 5 : $x; SetMyCursor(IDC_SIZEWE); $right = $ct->left + $ct->width; $newleft = $x1 + HANDLE_XOFFSET_5; $newwidth = $right - $newleft; if ($newwidth > 0) { $wb->form[$wb->currentform]->ct[$wb->form[$wb->currentform]->nselcontrol]->left = $newleft; $wb->form[$wb->currentform]->ct[$wb->form[$wb->currentform]->nselcontrol]->width = $newwidth; } update_control_data(); wb_refresh($window, true); } elseif ($wb->mousecpos == INSHANDLE) { // Resizing control (South) $y = ($lparam2 & 4294901760.0) >> 16; // Is grid active? $y1 = $wb->grid ? (int) (max(4, $y - 0) / 5) * 5 : $y; SetMyCursor(IDC_SIZENS); $wb->form[$wb->currentform]->ct[$wb->form[$wb->currentform]->nselcontrol]->height = max(1, $y1 - $ct->top); update_control_data(); wb_refresh($window, true); } elseif ($wb->mousecpos == INNEHANDLE) { // Resizing control (Northeast) $x = $lparam2 & 0xffff; $y = ($lparam2 & 4294901760.0) >> 16; // Is grid active? $x1 = $wb->grid ? (int) (max(4, $x - 0) / 5) * 5 : $x; $y1 = $wb->grid ? (int) (max(4, $y - 0) / 5) * 5 : $y; SetMyCursor(IDC_SIZENESW); $wb->form[$wb->currentform]->ct[$wb->form[$wb->currentform]->nselcontrol]->width = max(1, $x1 - $ct->left); $bottom = $ct->top + $ct->height; $newtop = $y1 + HANDLE_YOFFSET_5; $newheight = $bottom - $newtop; if ($newheight > 0) { $wb->form[$wb->currentform]->ct[$wb->form[$wb->currentform]->nselcontrol]->top = $newtop; $wb->form[$wb->currentform]->ct[$wb->form[$wb->currentform]->nselcontrol]->height = $newheight; } update_control_data(); wb_refresh($window, true); } elseif ($wb->mousecpos == INSEHANDLE) { // Resizing control (Southeast) $x = $lparam2 & 0xffff; $y = ($lparam2 & 4294901760.0) >> 16; // Is grid active? $x1 = $wb->grid ? (int) (max(4, $x - 0) / 5) * 5 : $x; $y1 = $wb->grid ? (int) (max(4, $y - 0) / 5) * 5 : $y; SetMyCursor(IDC_SIZENWSE); $wb->form[$wb->currentform]->ct[$wb->form[$wb->currentform]->nselcontrol]->width = max(1, $x1 - $ct->left); $wb->form[$wb->currentform]->ct[$wb->form[$wb->currentform]->nselcontrol]->height = max(1, $y1 - $ct->top); update_control_data(); wb_refresh($window, true); } elseif ($wb->mousecpos == INNWHANDLE) { // Resizing control (Northwest) $x = $lparam2 & 0xffff; $y = ($lparam2 & 4294901760.0) >> 16; // Is grid active? $x1 = $wb->grid ? (int) (max(4, $x - 0) / 5) * 5 : $x; $y1 = $wb->grid ? (int) (max(4, $y - 0) / 5) * 5 : $y; SetMyCursor(IDC_SIZENWSE); $right = $ct->left + $ct->width; $newleft = $x1 + HANDLE_XOFFSET_5; $newwidth = $right - $newleft; if ($newwidth > 0) { $wb->form[$wb->currentform]->ct[$wb->form[$wb->currentform]->nselcontrol]->left = $newleft; $wb->form[$wb->currentform]->ct[$wb->form[$wb->currentform]->nselcontrol]->width = $newwidth; } $bottom = $ct->top + $ct->height; $newtop = $y1 + HANDLE_YOFFSET_5; $newheight = $bottom - $newtop; if ($newheight > 0) { $wb->form[$wb->currentform]->ct[$wb->form[$wb->currentform]->nselcontrol]->top = $newtop; $wb->form[$wb->currentform]->ct[$wb->form[$wb->currentform]->nselcontrol]->height = $newheight; } update_control_data(); wb_refresh($window, true); } elseif ($wb->mousecpos == INSWHANDLE) { // Resizing control (Southwest) $x = $lparam2 & 0xffff; $y = ($lparam2 & 4294901760.0) >> 16; // Is grid active? $x1 = $wb->grid ? (int) (max(4, $x - 0) / 5) * 5 : $x; $y1 = $wb->grid ? (int) (max(4, $y - 0) / 5) * 5 : $y; SetMyCursor(IDC_SIZENESW); $right = $ct->left + $ct->width; $newleft = $x1 + HANDLE_XOFFSET_5; $newwidth = $right - $newleft; if ($newwidth > 0) { $wb->form[$wb->currentform]->ct[$wb->form[$wb->currentform]->nselcontrol]->left = $newleft; $wb->form[$wb->currentform]->ct[$wb->form[$wb->currentform]->nselcontrol]->width = $newwidth; } $wb->form[$wb->currentform]->ct[$wb->form[$wb->currentform]->nselcontrol]->height = max(1, $y1 - $ct->top); update_control_data(); wb_refresh($window, true); } } elseif (!($lparam1 & (WBC_LBUTTON | WBC_RBUTTON))) { // No button pressed $xleft = $lparam2 & 0xffff; $ytop = ($lparam2 & 4294901760.0) >> 16; $form = $wb->form[$wb->currentform]; // Auxiliary variable if ($form->nselcontrol < 0) { $wb->mousecpos = NOWHERE; break; } $ct = $wb->form[$wb->currentform]->ct[$form->nselcontrol]; // Aux variable //-------------- Mouse position tests // Is mouse cursor inside the control area? if ($xleft >= $ct->left && $xleft <= $ct->left + $ct->width && $ytop >= $ct->top && $ytop <= $ct->top + $ct->height) { SetMyCursor(IDC_HAND); $wb->mousecpos = INCONTROL; break; // Test for North handle } else { if ($xleft >= $ct->left + ($ct->width - HANDLE_WIDTH) / 2 && $xleft <= $ct->left + ($ct->width + HANDLE_WIDTH) / 2 && $ytop >= $ct->top - HANDLE_YOFFSET && $ytop <= $ct->top - HANDLE_YOFFSET + HANDLE_HEIGHT) { SetMyCursor(IDC_SIZENS); $wb->mousecpos = INNHANDLE; break; // Test for East handle } else { if ($xleft >= $ct->left + $ct->width + HANDLE_XOFFSET - HANDLE_WIDTH && $xleft <= $ct->left + $ct->width + HANDLE_XOFFSET && $ytop >= $ct->top + ($ct->height - HANDLE_HEIGHT) / 2 && $ytop <= $ct->top + ($ct->height + HANDLE_HEIGHT) / 2) { SetMyCursor(IDC_SIZEWE); $wb->mousecpos = INEHANDLE; break; // Test for West handle } else { if ($xleft >= $ct->left - HANDLE_XOFFSET && $xleft <= $ct->left - HANDLE_XOFFSET + HANDLE_WIDTH && $ytop >= $ct->top + ($ct->height - HANDLE_HEIGHT) / 2 && $ytop <= $ct->top + ($ct->height + HANDLE_HEIGHT) / 2) { SetMyCursor(IDC_SIZEWE); $wb->mousecpos = INWHANDLE; break; // Test for South handle } else { if ($xleft >= $ct->left + ($ct->width - HANDLE_WIDTH) / 2 && $xleft <= $ct->left + ($ct->width + HANDLE_WIDTH) / 2 && $ytop >= $ct->top + $ct->height + HANDLE_YOFFSET - HANDLE_HEIGHT && $ytop <= $ct->top + $ct->height + HANDLE_YOFFSET) { SetMyCursor(IDC_SIZENS); $wb->mousecpos = INSHANDLE; break; // Test for Northeast handle } else { if ($xleft >= $ct->left + $ct->width + HANDLE_XOFFSET - HANDLE_WIDTH && $xleft <= $ct->left + $ct->width + HANDLE_XOFFSET && $ytop >= $ct->top - HANDLE_YOFFSET && $ytop <= $ct->top - HANDLE_YOFFSET + HANDLE_HEIGHT) { SetMyCursor(IDC_SIZENESW); $wb->mousecpos = INNEHANDLE; break; // Test for Shoutheast handle } else { if ($xleft >= $ct->left + $ct->width + HANDLE_XOFFSET - HANDLE_WIDTH && $xleft <= $ct->left + $ct->width + HANDLE_XOFFSET && $ytop >= $ct->top + $ct->height + HANDLE_YOFFSET - HANDLE_HEIGHT && $ytop <= $ct->top + $ct->height + HANDLE_YOFFSET) { SetMyCursor(IDC_SIZENWSE); $wb->mousecpos = INSEHANDLE; break; // Test for Northwest handle } else { if ($xleft >= $ct->left - HANDLE_XOFFSET && $xleft <= $ct->left - HANDLE_XOFFSET + HANDLE_WIDTH && $ytop >= $ct->top - HANDLE_YOFFSET && $ytop <= $ct->top - HANDLE_YOFFSET + HANDLE_HEIGHT) { SetMyCursor(IDC_SIZENWSE); $wb->mousecpos = INNWHANDLE; break; // Test for Shouthwest handle } else { if ($xleft >= $ct->left - HANDLE_XOFFSET && $xleft <= $ct->left - HANDLE_XOFFSET + HANDLE_WIDTH && $ytop >= $ct->top + $ct->height + HANDLE_YOFFSET - HANDLE_HEIGHT && $ytop <= $ct->top + $ct->height + HANDLE_YOFFSET) { SetMyCursor(IDC_SIZENESW); $wb->mousecpos = INSWHANDLE; break; } else { $wb->mousecpos = NOWHERE; } } } } } } } } } } break; case IDCLOSE: end_drawing_functions(); wb_destroy_window($window); break; } }
function reset_contact_category_view() { global $wb; // Empty listview wb_delete_items($wb->contact_category_list, null); $keyword = $wb->keyword; $where_is = " where 1 "; if ($keyword) { $where_is .= " AND category_name LIKE '%{$keyword}%' "; } $max_row = 22; $category_table_name = $wb->setting["Settings"]["contact_category_table"]; $start_num = ($wb->current_category_page - 1) * $max_row; $sql2 = " SELECT * FROM {$category_table_name} {$where_is} "; $wb->db->query($sql2); $total_category_num = $wb->db->num_rows(); $wb->total_category_page = ceil($total_category_num / $max_row); $sql2 = " SELECT * FROM {$category_table_name} {$where_is} ORDER BY id DESC LIMIT {$start_num}," . $max_row; $wb->db->query($sql2); $category_data = array(); while ($wb->db->next_record()) { $row = array(); $row[] = $wb->db->f("id"); $row[] = $wb->db->f("category_name"); $row[] = $wb->db->f("active"); $category_data[] = $row; } // Create listview items wb_create_items($wb->contact_category_list, $category_data); //category navigator $dim = wb_get_size($wb->right_control, true); $nav_button_y = $dim[1] - 80; $nav_button_x = 60 + 150; $nav_button_space = 100; wb_create_control($wb->right_control, Label, $wb->vars["Lang"]["lang_total"] . " " . $total_category_num . " " . $wb->vars["Lang"]["lang_records"] . " " . $wb->vars["Lang"]["lang_current"] . $wb->current_category_page . "/" . $wb->total_category_page . " " . $wb->vars["Lang"]["lang_page"], 20, $nav_button_y + 5, 150, 14, 0, WBC_VISIBLE, 0, 1); $category_nav_first = wb_create_control($wb->right_control, PushButton, $wb->vars["Lang"]["lang_first_page"], $nav_button_x, $nav_button_y, 80, 22, IDC_CATEGORY_NAV_FIRST, WBC_VISIBLE, 0, 1); $category_nav_pre = wb_create_control($wb->right_control, PushButton, $wb->vars["Lang"]["lang_pre_page"], $nav_button_x + $nav_button_space, $nav_button_y, 80, 22, IDC_CATEGORY_NAV_PRE, WBC_VISIBLE, 0, 1); $category_nav_next = wb_create_control($wb->right_control, PushButton, $wb->vars["Lang"]["lang_next_page"], $nav_button_x + $nav_button_space * 2, $nav_button_y, 80, 22, IDC_CATEGORY_NAV_NEXT, WBC_VISIBLE, 0, 1); $category_nav_last = wb_create_control($wb->right_control, PushButton, $wb->vars["Lang"]["lang_last_page"], $nav_button_x + $nav_button_space * 3, $nav_button_y, 80, 22, IDC_CATEGORY_NAV_LAST, WBC_VISIBLE, 0, 1); //category if ($wb->current_category_page == $wb->total_category_page) { wb_set_enabled($category_nav_next, false); wb_set_enabled($category_nav_last, false); } if ($wb->current_category_page == 1) { wb_set_enabled($category_nav_pre, false); wb_set_enabled($category_nav_first, false); } }