⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 winhello.c

📁 vxworks系统下tornado开发环境下的图形演示程序
💻 C
字号:
/* winHello.c - WindML Basic Hello World Windowing Example Program */

/* Copyright 2000 - 2003 Wind River Systems, Inc. All Rights Reserved */

/*
modification history
--------------------
01a,16apr03,jlb  Added modification history
*/

 
/*

DESCRIPTION

This example program opens a window and displays the test "Hello World".  The
basics to create a window and place text within a window are demonstrated by 
this program.

The program is started by executing the application's entry point, winHello.
This is typically called from the pull down menu selection on the winDemo
program.


*/

/* Includes */
#include <ugl/uglWin.h>

/**************************************************************************
*
* cbWinDraw - call back to draw the hello world window
*
* This callback routine draws the hello window in response to MSG_DRAW 
* messages.  (MSG_DRAW messages are sent when the window is exposed or 
* otherwise invalidated.)
*
* RETURNS: 
*
* ERRNO: N/A
*
* SEE ALSO:  
*
* NOMANUAL
*/
UGL_LOCAL UGL_STATUS cbDraw
    (
    WIN_ID          winId,      /* window ID */                                
    WIN_MSG *       pMsg,       /* message (always MSG_DRAW) */                                    
    void *          pData,      /* copy of data passed to winCreate() */               
    void *          pParam      /* parameter passed to winCbAdd() */  
    )
    {
    /* draw the background */

    uglLineWidthSet (pMsg->data.draw.gcId, 0);
    uglBackgroundColorSet (pMsg->data.draw.gcId, WIN_LIGHTBLUE);

    uglRectangle (pMsg->data.draw.gcId, pMsg->data.draw.rect.left, 
                  pMsg->data.draw.rect.top, pMsg->data.draw.rect.right, 
                  pMsg->data.draw.rect.bottom);

    /* draw the text */

    uglFontSet (pMsg->data.draw.gcId, WIN_FONT_SYSTEM);
    uglTextDraw (pMsg->data.draw.gcId, 10, 10, -1, "Hello World!");

    uglFontSet (pMsg->data.draw.gcId, WIN_HZ_FONT_FIXED);
    uglTextDraw (pMsg->data.draw.gcId, 10, 32, -1, "欢迎使用WindML3.0窗口图形系统!");
    /* return UGL_STATUS_FINISHED because default handling not needed */

    return (UGL_STATUS_FINISHED);
    }


/**************************************************************************
*
* winHello - create a "Hello World" window
*
* This routine creates a window containing the text "Hello World".  
*
* This example program demonstrates how to:
*
*\ml
*\m  Create an application context
*\m  Create a window attached to the application context
*\m  Add a call back to the window to handle MSG_DRAW messages
*\m  Attach the created window to the root window
*\me
*
*
* The MSG_DRAW message is generated by the windowing system when a
* window is invalidated.  A window is initially invalidated when created and 
* it will become invalidated when the visibility of the window changes.  This
* example program demonstrates how to handle the MSG_DRAW callback by displaying
* the text "Hello World" within the window.
*
* NOTE:
* This program may be started from the shell.  However, the usual way to
* launch this program is from the task bar from the winDemo application.
*
* RETURNS: 
*
* ERRNO: N/A
*
* SEE ALSO: winDemo() 
*
*/
void winHello (void)
    {

    WIN_APP_ID      appId;
    WIN_ID          winId;

    /* create the application context */

    appId = winAppCreate ("winHello", 0, 0, 0, UGL_NULL);

    /* create the window */

    winId = winCreate (appId, UGL_NULL_ID, 
                       WIN_ATTRIB_FRAMED | WIN_ATTRIB_VISIBLE, 
                       100, 100, 200, 150, UGL_NULL, 0, UGL_NULL);

    /* add the draw callback */

    winCbAdd (winId, MSG_DRAW, 0, cbDraw, UGL_NULL);

    /* attach the window to the default display */

    winAttach (winId, UGL_NULL_ID, UGL_NULL_ID);
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -