http:^^www.cs.washington.edu^education^courses^457^projects^libui^

来自「This data set contains WWW-pages collect」· EDU^EDUCATION^COURSES^457^PROJECTS^LIBUI^ 代码 · 共 1,346 行 · 第 1/4 页

EDU^EDUCATION^COURSES^457^PROJECTS^LIBUI^
1,346
字号
Date: Mon, 02 Dec 1996 16:09:37 GMTServer: NCSA/1.4.2Content-type: text/html<html><title>CSE 457 libui documentation</title><img src = "../../images/cse457.gif" align = left alt="CSE 457"><br><hr noshade><center><img src = "../../images/title.gif" alt="Introduction to Computer Graphics"><hr noshade><font size=-2><b>1996 Autumn Quarter</b></font></center><br clear=left><blockquote><h2>libui: The Interface Library</h2><ul>  <li><a HREF="#Overview">Overview</a></li>       <!-- anchor href="#Tutorial" tutorial -->  <li><a HREF="#Reference">Reference</a></li>       <ul>	 <li><a HREF="#Reference-DataTypes">Data Types and Constants</a></li>	 <li><a href="#Macros">Macros</a></li>	 <li><a HREF="#Reference-Routines">Routines</a>	      <ul>		<li><a href="#Routines-Init">Initialization routines</a>		<li><a href="#Routines-Windows">Window routines</a>		<li><a href="#Routines-Controls">Control routines</a>		<li><a href="#Routines-Images">Image routines</a>		<li><a href="#Routines-Draw">Drawing Routines</a>		<li><a href="#Routines-Misc">Miscellaneous routines</a>	      </ul>	 <li><a HREF="#Reference-Glossary">Glossary</a></li>       </ul>  <li><h3><a HREF="#Index">Index</a></h3></li></ul><EM>This documentation still needs work.  If you find anything confusingor incomplete, <strong>please</strong> <a href=mailto:pighin@cs>let me know</a>. Any comments may you have will greatly facilitate it's revision.<p></EM><hr><h2><a NAME="Overview">Overview</a></h2>The user-interface library you will be using in 457 is designed to bepowerful and simple to use. It provides you with buttons, toggle buttons, sliders, rectangular drawing areas, file dialogs, and a text feedback area.<p>The main things that the libui library provides you with are:<ul>  <li><strong>A main application window</strong><br>       The application will have a main window which will hold all       the controls, the text area, drawing areas, etc. This window       is created when the application calls       <CODE><a HREF="#uiInitWindowsDef">uiInitWindow()</a></CODE>.</li>         <li><strong>Buttons</strong><br>       You can add buttons to the control area in the upper-right part       of the main window which take some action when pressed. Buttons       are created and their actions specified by calling       <CODE><a HREF="#uiAddButtonDef">uiAddButton()</a></CODE>.</li>         <li><strong>Toggle Buttons</strong><br>       You can add toggle buttons to the control area        of the main window which can be set to either True or False       by the user. Toggle buttons are created by calling       <CODE><a HREF="#uiAddToggleButtonDef">uiAddToggleButton()</a></CODE>.        The current state (True/False) of a toggle button can be queried       by calling <CODE><a HREF="#uiGetToggleButtonStateDef">       uiGetToggleButtonState()</a></CODE>.</li>         <li><strong>Sliders</strong><br>       Sliders can be added to the control area to allow the user to       control a continuous parameter. Sliders are created with a call to       <CODE><a HREF="#uiAddSliderDef">uiAddSlider()</a></CODE>.        The current value of the slider can be retrieved using       <CODE><a HREF="#uiGetSliderValueDef">uiGetSliderValue()</a></CODE>.       You can set the value of the slider by using        <CODE><a HREF="#uiSetSliderValueDef">uiSetSliderValue()</a></CODE>.       </li>         <li><strong>Menus</strong><br>       Menus can be added to control area to allow the user to select       the desired option.  Menus are created with a call to        <CODE><a HREF = "#uiMakeMenuDef">uiMakeMenu()</a></CODE>.       Menu item can be added using <CODE><a HREF="#uiAddMenuItemDef">       uiAddMenuItem()</a></CODE>.</li>                <li><strong>Drawing areas</strong><br>       These are rectangular areas within the main application window       that can be rendered into using OpenGL.	These are created by       calling <CODE><a HREF="#uiAddWindowDef">uiAddWindow()</a></CODE>.       </li>         <li><strong>Text area</strong><br>       There is an optional area at the bottom of the main window that       is used to do display text and/or allow the user to input text.       The text to be displayed can be set using <CODE>       <a HREF="#uiSetTextDef">uiSetText()</a></CODE> and can be examined       with <CODE><a HREF="#uiGetTextDef">uiGetText()</a></CODE>.</li>         <li><strong>File-selection dialogs</strong><br>       Applications can present file-selection dialog boxes to let the       user specify a file. The dialog box is presented by calling       <CODE><a HREF="#uiPostFileDialogDef">uiPostFileDialog()</a></CODE>.       This call returns immediately after the dialog is put up - the       application is notified that the OK button has been pressed by       having a callback procedure invoked.</li>         <li><strong>Event handling</strong><br>       Applications respond to user and systems actions such as buttons       being pressed and windows becoming visible through <em>event       callbacks</em>. These are routines that are called by the system       in response to these types of events. Callbacks are usually       specified when an interface element is created.       There is also a function call <CODE><a HREF="#uiBusyCursorDef">       uiBusyCursor()</a></CODE> to prevent all user interactions until       the program finishes executing a certain process.</ul><hr><h3><!--a NAME="Tutorial"Tutorial/a--></h3><!-- maybe use serpinski as tutorial? --><!-- This is a simple tutorial for the libui library --><!-- [a HREF="http:source/"](source code is available)[/a]. --><!-- It will show you how to create a simple interface including buttons, sliders, --><!-- little areas to draw into and a text area.  It will then demonstrate how to --><!-- get your program to respond to events such as: buttons being pushed and  --><!-- drawing areas being meddled with. --><!-- hr --><h2><a NAME="Reference">Reference</a></h2><h4><a NAME="Reference-DataTypes">Data types and Constants</a></h4><dl>  <dt><a NAME="uiBoolDef"><strong>uiBool</strong></a></dt>  <dd>Boolean type:<br>       <samp>typedef enum {<strong>uiFalse</strong>, <strong>uiTrue</strong>}       <strong>uiBool</strong>;</samp></dd><p>  <dt><a NAME="uiColorRGBDef"><strong>uiColorRGB</strong></a></dt>  <dd>RGB color type:<br>       <samp>typedef struct{  float r;  float g;  float b;}<strong> uiColorRGB</strong>;</samp></dd><p>  <dt><a NAME="uiDrawingPlaneDef"><strong>uiDrawingPlane</strong></a></dt>  <dd>The different planes to draw into. Specified when calling       <samp><a HREF="#uiSetCurrentWindowDef">uiSetCurrentWindow()</a>       </samp>.<br>       <samp>typedef enum {<strong>uiNormal</strong>, <strong>       uiOverlayPlane</strong>} <strong>uiDrawingPlane</strong>;<p></samp>       <dl>	 <dt><strong>uiNormal</strong></dt>	 <dd>The normal drawing plane. This is a full-color drawing plane,	      where colors are specified using the <strong>glColor*</strong>	      calls. Most drawing will take place in this plane.</dd>	 <dt><strong>uiOverlayPlane</strong></dt>	 <dd>The overlay plane. This is a drawing plane that sits on top of	      the normal plane, which can be used to draw on top of things	      without disturbing them. This plane is an indexed-color plane,	      so colors are specified using <strong>glIndex()</strong>. Index	      0 is transparent.</dd>       </dl>       </dd><p>         <dt><a NAME="uiAppOptionsDef"><strong>uiAppOptions</strong></a></dt>  <dd>Options for the <samp><a HREF="#uiInitWindowsDef">uiInitWindows()       </a></samp>call. The <VAR>options</VAR> parameter of this call should       be the logical <samp>OR</samp> of the desired options, or       <strong>uiNone</strong> for none of them.<br>       <samp>typedef enum {<strong>uiHasNone</strong> = 0, <strong>       uiHasControls</strong> = 1, <strong>uiHasText</strong> = 2, <strong>       uiHasDouble</strong> = 4 } <strong>uiAppOptions</strong>;</a></samp><p>              <dl>	 <dt><strong>uiHasNone</strong></dt>	 <dd>none of the following.</dd>	 <dt><strong>uiHasControls</strong></dt>	 <dd>The control area in the upper-right of the main window is	      present.</dd>	 <dt><strong>uiHasText</strong></dt>	 <dd>The text area at the bottom of the main window is present.</dd>	 <dt><strong>uiHasDouble</strong></dt>	 <dd>Double-buffering is enabled for the application.</dd>	 <dt><strong>uiIndexedColorMode</strong></dt>	 <dd>Main windows use indexed color.       </dl><p>       Examples:<br>       <samp>uiInitWindows( 0, NULL, uiHasControls );</samp><br>       <samp>uiInitWindows( 0, NULL, uiHasControls | uiHasText);</samp><br>       </dd><p>  <dt><a NAME="uiMouseActionDef"><strong>uiMouseAction</strong></dt>  <dd>Enumerated type indicating what kind of mouse action has taken place.       <br>       <samp>typedef enum {<br>       <strong>uiLeftMouseDown</strong>, <strong>uiLeftMouseUp</strong>,<br>       <strong>uiLeftMouseDrag</strong>, <strong>uiLeftMouseClick</strong>,<br>       <strong>uiRightMouseDown</strong>, <strong>uiRightMouseUp</strong>,<br>       <strong>uiRightMouseDrag</strong>, <strong>uiRightMouseClick</strong>       <br>       } <strong>uiMouseAction</strong>;       <dl>	 <dt><strong>uiLeftMouseDown</strong>, <strong>uiRightMouseDown	      </strong></dt>	 <dd>The left or right mouse button was pressed.	 <dt><strong>uiLeftMouseUp</strong>, <strong>uiRightMouseUp	      </strong></dt>	 <dd>The left or right mouse button was released.</dd>	 <dt><strong>uiLeftMouseDrag</strong>, <strong>uiRightMouseDrag	      </strong></dt>	 <dd>The mouse was moved while a button was held down.  A drag action	      will always be preceeded by a corresponding <strong>uiMouseDown	      </strong> action.</dd>	 <dt><strong>uiLeftMouseClick</strong>, <strong>uiRightMouseClick	      </strong></dt>	 <dd>The mouse button has been briefly pressed and released without	      motion in between. When a <strong>uiMouseClick</strong>	      action is reported, the corresponding <strong>uiMouseDown	      </strong> and <strong>uiMouseUp</strong> actions are <em>not	      </em> reported.</dd>       </dl></dd><p>  <dt><a NAME="uiWindowDef"><strong>uiWindow</strong></a></dt>  <dd>Opaque type returned from <a HREF="#uiAddWindowDef">       <strong>uiAddWindow()</strong></a>.</dd><p>  <dt><a NAME="uiSliderDef"><strong>uiSlider</strong></a></dt>  <dd>Slider type returned from <a HREF="#uiAddSliderDef">       <strong>uiAddSlider()</strong></a>.</dd><p>  <dt><a NAME="uiToggleButtonDef"><strong>uiToggleButton</strong></a></dt>  <dd>Toggle button type returned from <a HREF="#uiAddToggleButtonDef">       <strong>uiToggleButton()</strong></a>.</dd><p></dl>       <h4>Callback types</h4><dl>  <dt><samp><a NAME="uiExposeCallbackDef">typedef void (* <strong>       uiExposeCallback</strong>)( <strong><a HREF="#uiWindowDef">uiWindow</a>       </strong> *<VAR>window</VAR>);</a></samp></dt>  <dd>Exposure callback routine. Called in response to a window being       exposed.<p>       <ul>	 <li><VAR>window</VAR>: the window which has been exposed</li>       </ul><p>       The application can force the exposure routine to be called by       calling <strong><a HREF="#uiDirtyWindowDef">uiDirtyWindow()</a>       </strong>.</dd><p>  <dt><samp><a NAME="uiIdleCallbackDef">typedef int (* <strong>       uiIdleCallback</strong>) (void);</a></samp></dt>  <dd><a HREF="#IdleProcedureDefinition">Idle procedure</a>. Called       periodically when the system has nothing better to do.  An idle       procedure is added to the work queue with       <a href="#uiSetIdleCallback">uiSetIdleCallback()</a>,       and removed depending upon       the return value of your idle procedure:<p>       <dl>	 <dt>TRUE	 <dd>The idle procedure is through with its task, and should be	      removed from the work queue.  (To put it back on the	      queue, you need to call uiSetIdleCallback again.)	 <dt>FALSE	 <dd>The idle procedure is <em>not</em> through with its task, and	      will remain on the event queue</em>       </dl></dd><p>         <dt><samp><a name="uiTimerCallbackDef">typedef int (* <strong>       uiTimerCallback</strong>) (void);</a></samp></dt>  <dd>Similar to an IdleCallback, only also incorporates a pause       interval.  A timer procedure is added       with <a href="#uiSetTimerCallback">uiSetTimerCallback()</a>       where you define a pause interval (in milliseconds).  Like       an idle procedure, a timer procedure is added and removed       depending on its return value:       <dl>	 <dt>TRUE	 <dd>The timer procedure is through, remove this from	      the timer queue.  (To put it back on the queue, you	      need to call uiSetTimerCallback again.)	 <dt>FALSE	 <dd>The timer procedure is <em>not</em> through with its task,	      and will remain on the event queue.       </dl>       <p>         <dt><samp><a NAME="uiCallbackDef">typedef void (* <strong>uiCallback</strong>       ) (void);</samp></a></dt>  <dd>Button or slider callback. Called in response to the user pressing       the button or moving the slider with which it is associated.  See        <strong><a HREF="#uiAddButtonDef">uiAddButton()</a></strong>,        <strong><a HREF="#uiAddToggleButtonDef">uiAddToggleButton()</a>       </strong> and <strong><a HREF="#uiAddSliderDef">uiAddSlider()</a>       </strong>.</dd><p>  <dt><samp><a NAME="uiMouseCallbackDef">typedef void (* <strong>       uiMouseCallback</strong>) (<a HREF="#uiWindowDef"><strong>uiWindow       </strong></a> *<VAR>window</VAR>, int <VAR>x</VAR>, int <VAR>y</VAR>,       <strong><a HREF="#uiMouseActionDef">uiMouseAction</a></strong>       <VAR>action</VAR>);</a></samp></dt>  <dd>Mouse action callback - called in response to mouse input in <VAR>       window</VAR>.<p>       <dl>	 <dt><VAR>window</VAR></dt>	 <dd>The window in which the mouse action took place.</dd>	 <dt><VAR>x</VAR>, <VAR>y</VAR></dt>	 <dd>The location of the mouse action.</dd>	 <dt><VAR>action</VAR></dt>	 <dd>The mouse action which caused the callback to be invoked.</dd>       </dl><p>       Applications specify the mouse callback routine in <strong>

⌨️ 快捷键说明

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