fctsys.h 2.1 KB
Newer Older
1
/********************/
2
/* System includes. */
3
/********************/
4 5
#ifndef FCTSYS_H_
#define FCTSYS_H_
6 7

// For compilers that support precompilation, includes "wx.h".
8
#include <wx/wxprec.h>
9 10 11 12 13 14 15 16 17 18 19

#ifdef __BORLANDC__
#pragma hdrstop
#endif

// for all others, include the necessary headers (this file is usually all you
// need because it includes almost all "standard" wxWindows headers
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif

20 21 22 23
/*
 * FIXME: This appears to already be included in the OSX build of wxWidgets.
 *        Will someone with OSX please remove this and see if it compiles.
 */
24 25 26 27 28 29 30 31 32
#ifdef __WXMAC__
#include <Carbon/Carbon.h>
#endif

#ifndef M_PI
#define M_PI 3.141592653
#endif

#ifdef __WINDOWS__
33 34
#define DIR_SEP        '\\'
#define STRING_DIR_SEP wxT( "\\" )
35
#else
36 37
#define DIR_SEP        '/'
#define STRING_DIR_SEP wxT( "/" )
38 39
#endif

dickelbeck's avatar
dickelbeck committed
40 41 42 43 44 45
#ifdef DEBUG
#define D(x)        x
#else
#define D(x)        // nothing
#endif

46 47 48 49
/**
 * Function Clamp
 * limits @a value within the range @a lower <= @a value <= @a upper.  It will work
 * on temporary expressions, since they are evaluated only once, and it should work
50 51 52
 * on most if not all numeric types, string types, or any type for which "operator < ()"
 * is present. The arguments are accepted in this order so you can remember the
 * expression as a memory aid:
53 54 55 56 57 58 59 60
 * <p>
 * result is:  lower <= value <= upper
 */
template <typename T> inline const T& Clamp( const T& lower, const T& value, const T& upper )
{
    wxASSERT( lower <= upper );
    if( value < lower )
        return lower;
61
    else if( upper < value )
62 63 64 65
        return upper;
    return value;
}

66 67
#define UNIX_STRING_DIR_SEP wxT( "/" )
#define WIN_STRING_DIR_SEP  wxT( "\\" )
68

69
#define USE_RESIZE_BORDER
dickelbeck's avatar
dickelbeck committed
70
#if defined(__UNIX__) || defined(USE_RESIZE_BORDER)
71 72
#define MAYBE_RESIZE_BORDER wxRESIZE_BORDER   // linux users like resizeable
                                              // borders
dickelbeck's avatar
dickelbeck committed
73
#else
74
#define MAYBE_RESIZE_BORDER 0                 // no resizeable border
dickelbeck's avatar
dickelbeck committed
75 76
#endif

77 78 79 80 81
// wxNullPtr is not defined prior to wxWidget 2.9.0.
#if !wxCHECK_VERSION( 2, 9, 0 )
#define wxNullPtr ((void *)NULL)
#endif

82
#include <config.h>
83

84
#endif // FCTSYS_H__