Example #1
0
$wb->newscontent = null;
$label = wb_create_control($mainwin, Label, getTimeShotFormat(date("h:i:s")), 0, 15, 108, 20, 0, WBC_CENTER);
wb_set_font($label, wb_create_font("Tahoma", 11, null, FTA_BOLD));
$label_week = wb_create_control($mainwin, Label, formatLocalWeek(date("Y-m-d H:i:s")), 102, 2, 50, 15, 0, WBC_CENTER);
$label_day = wb_create_control($mainwin, Label, date("m月d"), 102, 15, 50, 15, 0, WBC_CENTER);
$label_year = wb_create_control($mainwin, Label, date("Y年"), 102, 30, 50, 15, 0, WBC_CENTER);
wb_set_font($label_week, wb_create_font("Tahoma", 8));
wb_set_font($label_day, wb_create_font("Tahoma", 8));
wb_set_font($label_year, wb_create_font("Tahoma", 8));
// Create status bar
$top_bar = wb_create_control($mainwin, Label, "", 10, 2, 100, 10, 0, WBC_CENTER);
wb_set_font($top_bar, wb_create_font("Simsun", 8));
$foot_bar = wb_create_control($mainwin, Label, '', 0, 35, 100, 10, 0, WBC_CENTER);
wb_set_font($foot_bar, wb_create_font("Simsun", 8));
$statusbar = wb_create_control($mainwin, StatusBar, "");
wb_set_font($statusbar, wb_create_font("Simsun", 10));
// Create the timer
wb_create_timer($mainwin, ID_APP_TIMER, 500);
wb_create_timer($mainwin, ID_NEWS_TIMER, 30000);
// Enter application loop
wb_set_image($mainwin, "resource/time.ico");
wb_main_loop();
//-------------------------------------------------------------------- FUNCTIONS
/* Process main window commands */
function process_main($window, $id)
{
    global $label, $statusbar, $top_bar, $foot_bar, $news_str, $wb;
    static $pos, $top_pos, $foot_pos;
    $disks_str = "";
    $news_str = $wb->newscontent;
    //	if ((date("i")%3)==0)
function draw_hyperlink($buffer, $caption, $xstart, $ystart, $width, $height, $style, $value)
{
    global $cl, $wb;
    if ($style & WBC_DISABLED) {
        $font = $cl->disabledfont;
    } else {
        if ($wb->wireframe) {
            $font = $cl->sysfont;
        } else {
            $font = wb_create_font("Tahoma", 8, $value, $style & WBC_LINES ? FTA_UNDERLINE : 0);
        }
    }
    wb_draw_text($buffer, $caption, $xstart, $ystart, $width, $height, $font, ($style & WBC_CENTER ? WBC_CENTER : WBC_LEFT) | WBC_TOP);
    if (!($style & WBC_DISABLED) && !$wb->wireframe) {
        wb_destroy_font($font);
    }
}
Example #3
0
 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]));
 }