mirror of https://github.com/OpenTTD/OpenTTD
(svn r18203) -Codechange (r18092): Remove DisplayFlags enum of old widgets.
parent
2750c719cc
commit
0512761214
|
@ -16,58 +16,6 @@
|
||||||
#include "strings_type.h"
|
#include "strings_type.h"
|
||||||
#include "gfx_type.h"
|
#include "gfx_type.h"
|
||||||
|
|
||||||
/* How the resize system works:
|
|
||||||
First, you need to add a WWT_RESIZEBOX to the widgets, and you need
|
|
||||||
to add the flag WDF_RESIZABLE to the window. Now the window is ready
|
|
||||||
to resize itself.
|
|
||||||
As you may have noticed, all widgets have a RESIZE_XXX in their line.
|
|
||||||
This lines controls how the widgets behave on resize. RESIZE_NONE means
|
|
||||||
it doesn't do anything. Any other option let's one of the borders
|
|
||||||
move with the changed width/height. So if a widget has
|
|
||||||
RESIZE_RIGHT, and the window is made 5 pixels wider by the user,
|
|
||||||
the right of the window will also be made 5 pixels wider.
|
|
||||||
Now, what if you want to clamp a widget to the bottom? Give it the flag
|
|
||||||
RESIZE_TB. This is RESIZE_TOP + RESIZE_BOTTOM. Now if the window gets
|
|
||||||
5 pixels bigger, both the top and bottom gets 5 bigger, so the whole
|
|
||||||
widgets moves downwards without resizing, and appears to be clamped
|
|
||||||
to the bottom. Nice aint it?
|
|
||||||
You should know one more thing about this system. Most windows can't
|
|
||||||
handle an increase of 1 pixel. So there is a step function, which
|
|
||||||
let the windowsize only be changed by X pixels. You configure this
|
|
||||||
after making the window, like this:
|
|
||||||
w->resize.step_height = 10;
|
|
||||||
Now the window will only change in height in steps of 10.
|
|
||||||
You can also give a minimum width and height. The default value is
|
|
||||||
the default height/width of the window itself. You can change this
|
|
||||||
AFTER window - creation, with:
|
|
||||||
w->resize.width or w->resize.height.
|
|
||||||
That was all.. good luck, and enjoy :) -- TrueLight */
|
|
||||||
|
|
||||||
enum DisplayFlags {
|
|
||||||
RESIZE_NONE = 0, ///< no resize required
|
|
||||||
|
|
||||||
RESIZE_LEFT = 1, ///< left resize flag
|
|
||||||
RESIZE_RIGHT = 2, ///< rigth resize flag
|
|
||||||
RESIZE_TOP = 4, ///< top resize flag
|
|
||||||
RESIZE_BOTTOM = 8, ///< bottom resize flag
|
|
||||||
|
|
||||||
RESIZE_LR = RESIZE_LEFT | RESIZE_RIGHT, ///< combination of left and right resize flags
|
|
||||||
RESIZE_RB = RESIZE_RIGHT | RESIZE_BOTTOM, ///< combination of right and bottom resize flags
|
|
||||||
RESIZE_TB = RESIZE_TOP | RESIZE_BOTTOM, ///< combination of top and bottom resize flags
|
|
||||||
RESIZE_LRB = RESIZE_LEFT | RESIZE_RIGHT | RESIZE_BOTTOM, ///< combination of left, right and bottom resize flags
|
|
||||||
RESIZE_LRTB = RESIZE_LEFT | RESIZE_RIGHT | RESIZE_TOP | RESIZE_BOTTOM, ///< combination of all resize flags
|
|
||||||
RESIZE_RTB = RESIZE_RIGHT | RESIZE_TOP | RESIZE_BOTTOM, ///< combination of right, top and bottom resize flag
|
|
||||||
|
|
||||||
/* The following flags are used by the system to specify what is disabled, hidden, or clicked
|
|
||||||
* They are used in the same place as the above RESIZE_x flags, Widget visual_flags.
|
|
||||||
* These states are used in exceptions. If nothing is specified, they will indicate
|
|
||||||
* Enabled, visible or unclicked widgets*/
|
|
||||||
WIDG_DISABLED = 4, ///< widget is greyed out, not available
|
|
||||||
WIDG_HIDDEN = 5, ///< widget is made invisible
|
|
||||||
WIDG_LOWERED = 6, ///< widget is paint lowered, a pressed button in fact
|
|
||||||
};
|
|
||||||
DECLARE_ENUM_AS_BIT_SET(DisplayFlags);
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
WIDGET_LIST_END = -1, ///< indicate the end of widgets' list for vararg functions
|
WIDGET_LIST_END = -1, ///< indicate the end of widgets' list for vararg functions
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue