Changeset - r4755:2d0c9bd7697a
[Not reviewed]
master
0 2 0
glx - 18 years ago 2006-10-06 21:10:14
glx@openttd.org
(svn r6669) -Add: vararg functions to set hidden/disabled/lowered state of multiple widgets in one call
2 files changed with 51 insertions and 0 deletions:
0 comments (0 inline, 0 general)
window.c
Show inline comments
 
/* $Id$ */
 

	
 
#include "stdafx.h"
 
#include <stdarg.h>
 
#include "openttd.h"
 
#include "debug.h"
 
#include "functions.h"
 
@@ -17,6 +18,48 @@
 
// delta between mouse cursor and upper left corner of dragged window
 
static Point _drag_delta;
 

	
 
void CDECL SetWindowWidgetsDisabledState(Window *w, bool disab_stat, int widgets, ...)
 
{
 
	va_list wdg_list;
 

	
 
	va_start(wdg_list, widgets);
 

	
 
	while (widgets != WIDGET_LIST_END) {
 
		SetWindowWidgetHiddenState(w, widgets, disab_stat);
 
		widgets = va_arg(wdg_list, int);
 
	}
 

	
 
	va_end(wdg_list);
 
}
 

	
 
void CDECL SetWindowWidgetsHiddenState(Window *w, bool hidden_stat, int widgets, ...)
 
{
 
	va_list wdg_list;
 

	
 
	va_start(wdg_list, widgets);
 

	
 
	while (widgets != WIDGET_LIST_END) {
 
		SetWindowWidgetHiddenState(w, widgets, hidden_stat);
 
		widgets = va_arg(wdg_list, int);
 
	}
 

	
 
	va_end(wdg_list);
 
}
 

	
 
void CDECL SetWindowWidgetsLoweredState(Window *w, bool lowered_stat, int widgets, ...)
 
{
 
	va_list wdg_list;
 

	
 
	va_start(wdg_list, widgets);
 

	
 
	while (widgets != WIDGET_LIST_END) {
 
		SetWindowWidgetLoweredState(w, widgets, lowered_stat);
 
		widgets = va_arg(wdg_list, int);
 
	}
 

	
 
	va_end(wdg_list);
 
}
 

	
 
void RaiseWindowButtons(Window *w)
 
{
 
	const Widget *wi = w->widget;
window.h
Show inline comments
 
@@ -62,6 +62,11 @@ enum ResizeFlags {
 
	WIDG_LOWERED  = 6,  // widget is paint lowered, a pressed button in fact
 
} ResizeFlag;
 

	
 
/* used to indicate the end of widgets' list for vararg functions */
 
enum {
 
	WIDGET_LIST_END = -1,
 
};
 

	
 
typedef struct Widget {
 
	byte type;                        ///< Widget type, see @WindowWidgetTypes
 
	byte display_flags;               ///< Resize direction, alignment, etc. during resizing, see @ResizeFlags
 
@@ -783,6 +788,9 @@ void InvalidateWindowData(WindowClass cl
 
void RaiseWindowButtons(Window *w);
 
void RelocateAllWindows(int neww, int newh);
 
int PositionMainToolbar(Window *w);
 
void CDECL SetWindowWidgetsDisabledState(Window *w, bool disab_stat, int widgets, ...);
 
void CDECL SetWindowWidgetsHiddenState(Window *w, bool hidden_stat, int widgets, ...);
 
void CDECL SetWindowWidgetsLoweredState(Window *w, bool lowered_stat, int widgets, ...);
 

	
 
/* misc_gui.c*/
 
void GuiShowTooltips(StringID string_id);
0 comments (0 inline, 0 general)