Changes between Initial Version and Version 1 of GUI_-_Custom_Objects


Ignore:
Timestamp:
Feb 23, 2008, 4:19:00 AM (16 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GUI_-_Custom_Objects

    v1 v1  
     1Some objects need to be predefined before they can be used, such as a new type of scrollbar which can be attached to other controls, or a particular icon that can be nested into caption text.
     2
     3An indefinite number of such objects can be placed in the ''<setup.xml>'' list.
     4
     5'''Key''': ''Italicised'' title means property is mandatory.
     6
     7== icon ==
     8This lets you specify the size and texture of an icon that can be used within any caption that uses text (or perhaps only text-boxes). The only information you need to specify here is sprite name and size.
     9
     10{{{
     11  <setup>
     12    <icon name="smiley"
     13          texture="smiley_happy02"
     14          size="10 10"
     15    />
     16  </setup>
     17}}}
     18
     19=== ''name'' ===
     20 * default: n/a
     21 * value: [wiki:GUI_-_Data_Types#name name]
     22
     23The name of the icon.
     24
     25=== ''size'' ===
     26 * default: n/a
     27 * value: [wiki:GUI_-_Data_Types#pos pos]
     28
     29Specifies the width and height of the icon (ie ''size="<width> <height>"'').
     30
     31=== ''sprite'' ===
     32 * default: "null"
     33 * value: [wiki:GUI_-_Data_Types#name name]
     34
     35Specifies the name of the sprite to use as the source of the icon.
     36
     37=== cell_id ===
     38 * default: "0"
     39 * value: [wiki:GUI_-_Data_Types#int int]
     40
     41If the icon is part of a multi-cell sheet, use this to indicate which element (0..n) in the sheet to use. (eg: ''cell_id="2"'' where each cell is 10x10 will use the area of the texture at 30x10.)
     42
     43== scrollbar ==
     44
     45Sets up a bar that can be attached to a control, and used to scroll when the control's contents exceed its size (eg a window of scrollable text).
     46
     47Horizontal scrollbars are not yet available, and will never be available for ''text'' boxes.
     48
     49[[Image(http://www.wildfiregames.com/~code/resources/wiki/gui/scrollbar_example.gif)]]
     50
     51{{{
     52  <setup>
     53    <scrollbar name="scrollbar1"
     54               always_shown="true"
     55               minimum_bar_size="10"
     56               width="20"
     57               scroll_wheel="false"
     58               scroll_speed="30"
     59               sprite_bar_vertical="scroll_dragbar"
     60               sprite_bar_vertical_over="scroll_dragbar_over"
     61               sprite_bar_vertical_pressed="scroll_dragbar_pressed"
     62               sprite_back_vertical="scrollbar_bkg"
     63               sprite_button_top="scroll_topbutton"
     64               sprite_button_top_disabled="scroll_topbutton_disabled"
     65               sprite_button_top_over="scroll_topbutton_over"
     66               sprite_button_top_pressed="scroll_topbutton_pressed"
     67               sprite_button_bottom="scroll_topbutton"
     68               sprite_button_bottom_disabled="scroll_topbutton_disabled"
     69               sprite_button_bottom_over="scroll_topbutton_over"
     70               sprite_button_bottom_pressed="scroll_topbutton_pressed"
     71    />
     72  </setup>
     73}}}
     74
     75=== ''name'' ===
     76 * default: n/a
     77 * value: [wiki:GUI_-_Data_Types#name name]
     78
     79Name of this scrollbar. Reference this name for a control using the object setting ''scrollbar_style''.
     80
     81=== always_shown ===
     82 * default: "false"
     83 * value: [wiki:GUI_-_Data_Types#bool bool] "(true|false)"
     84
     85If this is "true", the scrollbar will be drawn even when no scrolling is needed, although the vertical scroll button (sprite_bar_vertical) won't be drawn and the scroll buttons will use their "*_disabled" variant.
     86
     87{{Template:TODO|Gee|Not used.}}
     88
     89=== minimum_bar_size ===
     90 * default: n/a
     91 * value: [wiki:GUI_-_Data_Types#float float]
     92
     93The ''sprite_bar_vertical'' vertical scroll button will vary in height depending on the amount of content in the object's window. This sets the minimum height (in pixels) that the ''sprite_bar_vertical'' must be no matter how much or little content is in the parent object. It won't shrink any smaller than this size.
     94
     95Could be considered the "height" equivalent to the scrollbar's ''width''.
     96
     97=== scroll_wheel ===
     98 * default: "false"
     99 * value: [wiki:GUI_-_Data_Types#bool bool]"(true|false)"
     100
     101When ''true'', the user can use his mouse wheel to scroll the scrollbar. When ''false'', he cannot.
     102
     103'''Not yet implemented.''' Do we need this?
     104
     105=== scroll_speed ===
     106 * default: n/a
     107 * value: [wiki:GUI_-_Data_Types#float float]
     108
     109Specifies the number of pixels that the window will scroll each time the player clicks a scroll button or moves one step with the mouse wheel. Lower numbers are smoother; higher numbers are quicker.
     110'''Not yet implemented.''' This is hard-coded as of now.
     111
     112=== sprite_bar_vertical ===
     113 * default: "null"
     114 * value: [wiki:GUI_-_Data_Types#name name]
     115
     116The name of the sprite to use for the vertical sprite button (the long button that can be dragged up and down the scroll bar).
     117
     118Notice there is no ''*_disabled'' version of this property, this is because a disabled scrollbar displays no bar at all.
     119
     120=== sprite_bar_vertical_over ===
     121 * default: ''sprite_bar_vertical''
     122 * value: [wiki:GUI_-_Data_Types#name name]
     123
     124The name of the sprite to use for the ''sprite_bar_vertical'' when the user is hovering the mouse over it.
     125
     126=== sprite_bar_vertical_pressed ===
     127 * default: ''sprite_bar_vertical''
     128 * value: [wiki:GUI_-_Data_Types#name name]
     129
     130The name of the sprite to use for the ''sprite_bar_vertical'' when the user is clicking it.
     131
     132=== sprite_back_vertical ===
     133 * default: "null"
     134 * value: [wiki:GUI_-_Data_Types#name name]
     135
     136The name of the sprite to use for the background of the scrollbar.
     137
     138=== sprite_button_top ===
     139 * default: "null"
     140 * value: [wiki:GUI_-_Data_Types#name name]
     141
     142The name of the sprite to use for the top arrow button.
     143
     144=== sprite_button_top_over ===
     145 * default: ''sprite_button_top''
     146 * value: [wiki:GUI_-_Data_Types#name name]
     147
     148The name of the sprite to use for the top arrow button when the user is hovering the mouse over it.
     149
     150=== sprite_button_top_pressed ===
     151 * default: ''sprite_button_top''
     152 * value: [wiki:GUI_-_Data_Types#name name]
     153
     154The name of the sprite to use for the top arrow button when the user is clicking it.
     155
     156=== sprite_button_top_disabled ===
     157 * default: ''sprite_button_top''
     158 * value: [wiki:GUI_-_Data_Types#name name]
     159
     160The name of the sprite to use for the top arrow button when it is disabled (eg when always_shown is true).
     161
     162=== sprite_button_bottom ===
     163 * default: "null"
     164 * value: [wiki:GUI_-_Data_Types#name name]
     165
     166The name of the sprite to use for the bottom arrow button.
     167
     168=== sprite_button_bottom_over ===
     169 * default: ''sprite_button_bottom''
     170 * value: [wiki:GUI_-_Data_Types#name name]
     171
     172The name of the sprite to use for the bottom arrow button when the user is hovering the mouse over it.
     173
     174=== sprite_button_bottom_pressed ===
     175 * default: ''sprite_button_bottom''
     176 * value: [wiki:GUI_-_Data_Types#name name]
     177
     178The name of the sprite to use for the bottom arrow button when the user is clicking it.
     179
     180=== sprite_button_bottom_disabled ===
     181 * default: ''sprite_button_bottom''
     182 * value: [wiki:GUI_-_Data_Types#name name]
     183
     184The name of the sprite to use for the bottom arrow button when it is disabled (eg when always_shown is true).
     185
     186=== width ===
     187 * default: n/a
     188 * value: [wiki:GUI_-_Data_Types#float float]
     189
     190The horizontal width, in pixels, of the scrollbar. Use a higher number for a "fatter" scrollbar.
     191
     192The object that owns the scrollbar will be reduced in width by this amount.
     193
     194== tooltip ==
     195
     196This object sets up the look and feel of a tooltip (a window that displays formatted text when the user hovers over a control).
     197
     198There are two types of tooltips: ''appearing'' and ''existing''. They're mutually exclusive, so any incompatible settings will simply be ignored.
     199
     200 * An appearing tooltip is one setup from here and which appears next to the cursor when active. (So use an appearing tooltip when you want a tooltip that follows the cursor.)
     201  * Uses: name, anchor,
     202 * An existing tooltip "hijacks" another control and writes the object's tooltip text to its caption when active. (So use an existing tooltip when you want it to stay fixed at a certain position.)
     203  * Uses: name, hide_object, use_object
     204
     205{{{
     206  <setup>
     207    <!-- Appearing text-box -->
     208    <tooltip name="tooltip1"
     209             anchor="top"
     210             buffer_zone="2"
     211             delay="500"
     212             font="font"
     213             maxwidth="300"
     214             offset="10 10"
     215             sprite="backsprite"
     216             textcolor="0 0 0"
     217    />
     218 
     219    <!-- Existing text-box -->
     220    <tooltip name="tooltip2"
     221             delay="0"
     222             hide-object="true"
     223             useobject="text-box-object-name"
     224    />
     225  </setup>
     226}}}
     227
     228=== ''name'' ===
     229 * default: "null"
     230 * value: [wiki:GUI_-_Data_Types#name name]
     231
     232The name of the tooltip. Plug this name into the control's ''tooltip_style'' to tell it to use this tooltip.
     233
     234=== anchor ===
     235 * default: "bottom"
     236 * value: [wiki:GUI_-_Data_Types#enum enum] "(top|center|bottom)"
     237
     238This determines what part (vertically) of the tooltip box will be aligned with the cursor (if [wiki:#offset offset] is set to "0 0"). If "bottom", the tooltip box's bottom border will align with the cursor position (again, if [wiki:#offset offset] is set to "0 0").
     239
     240=== buffer_zone ===
     241 * default: "0"
     242 * value: [wiki:GUI_-_Data_Types#float float]
     243
     244Size of the "border" between the text area and the edge of the appearing tooltip window.
     245
     246=== delay ===
     247 * default: 500
     248 * value: [wiki:GUI_-_Properties#int int]
     249
     250The number of milliseconds to wait before displaying the tooltip when the player is hovering a control. Can be used by either kind of tooltip.
     251
     252=== font ===
     253 * default: n/a
     254 * value: [wiki:GUI_-_Properties#name name]
     255
     256Name of bitmap font to use for the appearing tooltip.
     257
     258=== hide_object ===
     259 * default: "false"
     260 * value: [wiki:GUI_-_Properties#bool bool] "(true|false)"
     261
     262Use for an existing tooltip. If set to "true", the tooltip object will only be visible while a tooltip is active. If "false", it will remain on the screen at all times.
     263
     264=== maxwidth ===
     265 * default: "0"
     266 * value: [wiki:GUI_-_Properties#int int]
     267
     268Maximum width of the appearing tooltip box. When the tooltip string is longer than this amount of pixels, the tooltip window will wordwrap. Obviously, this shouldn't be wider than the minimum width of the screen!
     269
     270=== offset ===
     271 * default: "0 0"
     272 * value: [wiki:GUI_-_Properties#pos pos]
     273
     274X and Y position of the appearing tooltip relative to the cursor. In other words, the tooltip will appear this number of pixels to the right (x) and below (y) the cursor.
     275
     276=== sprite ===
     277 * default: "null"
     278 * value: [wiki:GUI_-_Properties#name name]
     279
     280Sprite to use as the background of the appearing tooltip.
     281
     282=== textcolor ===
     283 * default: "0 0 0"
     284 * value: [wiki:GUI_-_Properties#color color]
     285
     286RGB colour of the text that appears in the appearing tooltip.
     287
     288=== use_object ===
     289 * default: "null"
     290 * value: [wiki:GUI_-_Properties#name name]
     291
     292Instead of having a box appearing on top of the cursor, you can use an already existing object with a ''caption''. Enter the name of this object here.
     293
     294== Color ==
     295It is possible to create pre-defined colors, so that one can define a color property simply as "Super-intelligent shade of blue", instead of maybe "23 11 244". This is useful if the color is used more than once. The syntax is simple:
     296
     297{{{
     298  <color name="Super-intelligent shade of blue"
     299  >23 11 244
     300  </color>
     301}}}
     302
     303=== ''name'' ===
     304 * default: n/a
     305 * value: [wiki:GUI_-_Properties#name name]
     306
     307Name to identify the customized color with.