// This may look like C code, but it's really -*- C++ -*-
/*
 * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
 *
 * See the LICENSE file for terms of use.
 */
#ifndef WGLOBAL_H_
#define WGLOBAL_H_

#include <Wt/WFlags>

/*! \file */

namespace Wt {
  class EventSignalBase;
  class JSlot;
  class WAbstractArea;
  class WAbstractSpinBox;
  class WAbstractItemDelegate;
  class WAbstractItemModel;
  class WAbstractItemView;
  class WAbstractMedia;
  class WAbstractListModel;
  class WAbstractProxyModel;
  class WAbstractTableModel;
  class WAbstractToggleButton;
  class WAggregateProxyModel;
  class WAccordionLayout;
  class WAnimation;
  class WAnchor;
  class WApplication;
  class WAudio;
  class WBatchEditProxyModel;
  class WBorder;
  class WBorderLayout;
  class WBoxLayout;
  class WBreak;
  class WBrush;
  class WButtonGroup;
  class WCalendar;
  class WCanvasPaintDevice;
  class WCheckBox;
  class WCircleArea;
  class WColor;
  class WCombinedLocalizedStrings;
  class WComboBox;
  class WCompositeWidget;
  class WCoreServer;
  class WContainerWidget;
  class WCssDecorationStyle;
  class WCssRule;
  class WCssStyleSheet;
  class WCssTemplateRule;
  class WCssTextRule;
  class WCssTheme;
  class WDate;
  class WDateEdit;
  class WDatePicker;
  class WDateTime;
  class WDateValidator;
  class WDefaultLayout;
  class WDefaultLoadingIndicator;
  class WDialog;
  class WDoubleSpinBox;
  class WDoubleValidator;
  class WDropEvent;
  class WEnvironment;
  class WEvent;
  class WException;
  class WFileResource;
  class WFileUpload;
  class WFitLayout;
  class WFlashObject;
  class WFont;
  class WFormModel;
  class WFormWidget;
  class WGestureEvent;
  class WGLWidget;
  class WGoogleMap;
  class WGridLayout;
  class WGroupBox;
  class WHBoxLayout;
  class WMouseEvent;
  class WIcon;
  class WIconPair;
  class WImage;
  class WInPlaceEdit;
  class WIntValidator;
  class WInteractWidget;
  class WIOService;
  class WItemDelegate;
  class WItemSelectionModel;
  class WKeyEvent;
  class WLabel;
  class WLayout;
  class WLayoutItem;
  class WLength;
  class WLengthValidator;
  class WLineEdit;
  class WLineF;
  class WLink;
  class WLocale;
  class WLocalDateTime;
  class WLoadingIndicator;
  class WLocalizedStrings;
  class WLogEntry;
  class WLogger;
  class WMatrix4x4;
  class WMediaPlayer;
  class WMemoryResource;
  class WMenu;
  class WMenuItem;
  class WMessageBox;
  class WMessageResourceBundle;
  class WMessageResources;
  class WModelIndex;
  class WMouseEvent;
  class WNavigationBar;
  class WObject;
  class WOverlayLoadingIndicator;
  class WPaintDevice;
  class WPaintedWidget;
  class WPainter;
  class WPainterPath;
  class WPanel;
  class WPdfImage;
  class WPen;
  class WPoint;
  class WPointF;
  class WPolygonArea;
  class WPopupMenu;
  class WPopupWidget;
  typedef WMenuItem WPopupMenuItem;
  class WProgressBar;
  class WPushButton;
  class WRadioButton;
  class WRandom;
  class WReadOnlyProxyModel;
  class WRasterImage;
  class WRectArea;
  class WRectF;
  class WRegExp;
  class WRegExpValidator;
  class WResource;
  class WScrollArea;
  class WScrollBar;
  class WScrollEvent;
  class WSelectionBox;
  class WServer;
  class WShadow;
  class WSlider;
  class WSocketNotifier;
  class WSortFilterProxyModel;
  class WSound;
  class WSpinBox;
  class WSplitButton;
  class WStackedWidget;
  class WStandardItem;
  class WStandardItemModel;
  class WStreamResource;
  class WString;
  class WStringListModel;
  typedef class WMenuItem WSubMenuItem;
  class WSuggestionPopup;
  class WSvgImage;
  class WTabWidget;
  class WTable;
  class WTableCell;
  class WTableColumn;
  class WTableRow;
  class WTableView;
  class WTemplate;
  class WText;
  class WTextArea;
  class WTextEdit;
  class WToolBar;
  class WTheme;
  class WTime;
  class WTimer;
  class WTouchEvent;
  class WTransform;
  class WTree;
  class WTreeNode;
  class WTreeTable;
  class WTreeTableNode;
  class WTreeView;
  class WVBoxLayout;
  class WValidationStatus;
  class WValidator;
  class WVectorImage;
  class WVideo;
  class WViewWidget;
  class WVirtualImage;
  class WVmlImage;
  class WWebWidget;
  class WWidget;
  class WWidgetItem;

  namespace Auth {
    class AbstractPasswordService;
    class AbstractUserDatabase;
    class AuthModel;
    class AuthService;
    class AuthWidget;
    class FacebookService;
    class FormBaseModel;
    class GoogleService;
    class HashFunction;
    class Identity;
    class Login;
    class LostPasswordWidget;
    class OAuthService;
    class PasswordHash;
    class PasswordPromptDialog;
    class PasswordService;
    class PasswordStrengthValidator;
    class PasswordVerifier;
    class RegistrationModel;
    class RegistrationWidget;
    class Token;
    class UpdatePasswordWidget;
    class User;

    namespace Dbo {
      template <class UserType> class AuthInfo;
      template <class DboType> class UserDatabase;
    }
  }

  namespace Chart {
    class SeriesIterator;
    class WAbstractChart;
    class WAxis;
    class WCartesianChart;
    class WChartPalette;
    class WDataSeries;
    class WPieChart;
    class WStandardPalette;
  }

  namespace Dbo {
    struct dbo_default_traits;

    class Call;
    class Exception;
    class FieldInfo;
    class FixedSqlConnectionPool;
    class ObjectNotFoundException;
    class SaveBaseAction;
    class Session;
    class SqlConnection;
    class SqlConnectionPool;
    class SqlStatement;
    class StaleObjectException;
    class Transaction;

    template <class C> class collection;
    template <class C> struct dbo_traits;
    template <typename V, class Enable> struct sql_value_traits;
    template <class C> class ptr;
    template <class Result, typename BindStrategy> class Query;
    template <class Result> class QueryModel;

    namespace backend {
      class Firebird;
      class Postgres;
      class Sqlite3;
    }
  }

  namespace Http {
    class Client;
    class Message;
    class Request;
    class Response;
    class ResponseContinuation;
    class UploadedFile;
    class WtClient;
  }

  namespace Json {
    class Array;
    class Object;
    class TypeException;
    class Value;
  }

  namespace Mail {
    class Client;
    class Mailbox;
    class Message;
  }

  namespace Payment {
    class Address;
    class Customer;
    class Money;
    class Order;
    class OrderItem;
    class PayPalExpressCheckout;
    class PayPalService;
    class Result;
    class Approval;
  }

  namespace Render {
    class WPdfRenderer;
  }

/*! \brief Enumeration that indicates a direction.
 */
enum Orientation { Horizontal = 0x1, //!< Horizontal
		   Vertical   = 0x2  //!< Vertical
};
W_DECLARE_OPERATORS_FOR_FLAGS(Orientation)

/*! \brief Enumeration that indicates a standard button.
 *
 * Multiple buttons may be specified by logically or'ing these values
 * together, e.g.
 * \code
 * Ok | Cancel
 * \endcode
 *
 * \sa WMessageBox
 */
enum StandardButton {
  NoButton = 0x00,  //!< No button
  Ok = 0x01,        //!< An OK button.
  Cancel = 0x02,    //!< A Cancel button.
  Yes = 0x04,       //!< A Yes button.
  No = 0x08,        //!< A No button.
  Abort = 0x10,     //!< An Abort button.
  Retry = 0x20,     //!< A Retry button.
  Ignore = 0x40,    //!< An Ignore button.
  YesAll = 0x80,    //!< A Yes-to-All button.
  NoAll = 0x100     //!< A No-to-All button.
};
W_DECLARE_OPERATORS_FOR_FLAGS(StandardButton)

/*! \brief Enumeration that indiciates a standard icon.
 *
 * \sa WMessageBox
 */
enum Icon {
  NoIcon = 0,       //!< No icon.
  Information = 1,  //!< An information icon.
  Warning = 2,      //!< A warning icon.
  Critical = 3,     //!< A critical icon.
  Question = 4      //!< A question icon.
};

/*! \brief Enumeration that indicates how items may be selected.
 *
 * \sa WTreeView::setSelectionMode()
 */
enum SelectionMode { NoSelection = 0,      //!< No selections
		     SingleSelection = 1,  //!< Single selection only
		     ExtendedSelection = 3 //!< Multiple selection
};

/*! \brief Enumeration that indicates what is being selected.
 *
 * \sa WTreeView::setSelectionBehavior()
 */
enum SelectionBehavior { SelectItems = 0,    //!< Select single items
			 SelectRows = 1      //!< Select only rows
			 /*, SelectColumns */
};

/*! \brief Enumeration that indicates how to change a selection.
 *
 * \sa WTreeView::select()
 */
enum SelectionFlag {
  Select = 1,          //!< Add to selection
  Deselect = 2,        //!< Remove from selection
  ToggleSelect = 3,    //!< Toggle in selection
  ClearAndSelect = 4   //!< Clear selection and add single item
};

/*! \brief Enumeration that indicates a relative location.
 *
 * Values of CenterX, CenterY, and CenterXY are only valid for
 * WCssDecorationStyle::setBackgroundImage()
 *
 * \sa WWidget::setMargin(const WLength& x, WFlags<Side> sides)
 * \sa WWidget::setOffsets(const WLength& x, WFlags<Side> sides)
 * \sa WWidget::setFloatSide(Side s)
 * \sa WWidget::setClearSides(WFlags<Side> sides)
 * \sa WContainerWidget::setPadding(const WLength& x, WFlags<Side> sides)
 * \sa WCssDecorationStyle::setBackgroundImage()
 */
enum Side {
  Top = 0x1,                          //!< Top side
  Bottom = 0x2,                       //!< Bottom side
  Left = 0x4,                         //!< Left side
  Right = 0x8,                        //!< Right side
  CenterX = 0x10,                     //!< Center horiziontally
  CenterY = 0x20                      //!< Center vertically
};

W_DECLARE_OPERATORS_FOR_FLAGS(Side)

/** \brief No side */
static const WFlags<Side> None = 0;
/** \brief (CenterX | CenterY) */
static const WFlags<Side> CenterXY = CenterX | CenterY;
/** \brief (Left | Right) */
static const WFlags<Side> Horizontals = Left | Right;
/** \brief (Top | Bottom) */
static const WFlags<Side> Verticals = Top | Bottom;
/** \brief All sides */
static const WFlags<Side> All = Top | Bottom | Left | Right;

/*! \brief Enumeration that specifies a horizontal or a vertical alignment.
 *
 * The vertical alignment flags are AlignBaseline, AlignSub, AlignSuper,
 * AlignTop, AlignTextTop, AlignMiddle, AlignBottom and AlignTextBottom.
 * The horizontal alignment flags are AlignLeft, AlignRight, AlignCenter
 * and AlignJustify.
 *
 * When used with setVerticalAlignment(), this applies only
 * to inline widgets and determines how to position itself on the
 * current line, with respect to sibling inline widgets.
 *
 * When used with WTableCell::setContentAlignment(), this determines the
 * vertical alignment of contents within the table cell.
 *
 * When used with WPainter::drawText(), this determines the horizontal and
 * vertical alignment of the text with respect to the bounding rectangle.
 *
 * When used with WContainerWidget::setContentAlignment(), this specifies how
 * contents should be aligned horizontally within the container.
 *
 * Not all values are applicable in all situations. The most commonly
 * used values are AlignLeft, AlignCenter, AlignRight, AlignBottom,
 * AlignMiddle and AlignTop.
 */
enum AlignmentFlag {
  /*! \brief Align to the left
   */
  AlignLeft=0x1,
  /*! \brief Align to the right
   */
  AlignRight=0x2,
  /*! \brief Align horizontally in the center
   */
  AlignCenter=0x4,
  /*! \brief Justify left and right
   */
  AlignJustify=0x8,
  /*! \brief Align at baseline (default alignment).
   */
  AlignBaseline=0x10,
  /*! \brief Align below the baseline (as if subscript).
   */
  AlignSub=0x20,
  /*! \brief Align above the baseline (as if superscript).
   */
  AlignSuper=0x40,
  /*! \brief Align top of widget with top of tallest sibling widget.
   */
  AlignTop=0x80,
  /*! \brief Align top of widget with the top of the parent widget's font.
   */
  AlignTextTop=0x100,
  /*! \brief Align vertically the middle to the middle of the parent widget.
   */
  AlignMiddle=0x200,
  /*! \brief Align bottom of widget to the bottom of the lowest sigling widget.
   */
  AlignBottom=0x400,
  /*! \brief Align bottom of widget to the bottom of parent widget's font.
   */
  AlignTextBottom=0x800
};

W_DECLARE_OPERATORS_FOR_FLAGS(AlignmentFlag)

/*! \brief Combination of all horizontal alignment flags */
static const WFlags<AlignmentFlag> AlignHorizontalMask
  = AlignLeft | AlignRight | AlignCenter | AlignJustify;

/*! \brief Combination of all vertical alignment flags */
static const WFlags<AlignmentFlag> AlignVerticalMask
  = AlignBaseline | AlignSub | AlignSuper | AlignTop | AlignTextTop
  | AlignMiddle | AlignBottom | AlignTextBottom;

/*! \brief Enumeration that specifies the way text should be printed.
 *
 * \sa WPainter::drawText(const WRectF& rect, WFlags<AlignmentFlag> alignmentFlags, TextFlag textFlag, const WString& text)
 */
enum TextFlag {
  TextSingleLine,   //!< Text will be printed on just one line
  TextWordWrap      //!< Lines will break at word boundaries
};

/*! \brief Enumeration that specifies a layout mechanism for a widget.
 *
 * The layout mechanism determines how the widget positions itself relative
 * to the parent or sibling widgets.
 *
 * \sa WWidget::setPositionScheme(PositionScheme scheme)
 */
enum PositionScheme {
  /*! \brief Static position scheme.
   *
   *  The widget is layed-out with other \link Wt::Static
   *  Static \endlink and \link Wt::Relative Relative \endlink
   *  sibling widgets, one after another.
   *
   *  Inline widgets are layed out in horizontal lines (like text),
   *  wrapping around at the end of the line to continue on the next
   *  line. Block widgets are stacked vertically.
   *
   *  Static widgets may also float to the left or right border,
   *  using setFloatSide().
   */
  Static,

  /*! \brief Relative position scheme.
   *
   *  The widget is first layed out according to Static layout
   *  rules, but after layout, the widget may be offset relative to
   *  where it would be in a static layout, using setOffsets().
   *
   *  Another common use of a Relative position scheme (even with no
   *  specified offsets) is to provide a new reference coordinate
   *  system for Absolutely positioned widgets.
   */
  Relative,

  /*! \brief Absolute position scheme.
   *
   *  The widget is positioned at an absolute position
   *  with respect to the nearest ancestor widget that is either:
   *  <ul>
   *    <li> a WTableCell </li>
   *    <li> or has a position scheme that is \link Wt::Relative
   *  Relative\endlink or \link Wt::Absolute Absolute\endlink. </li>
   *  </ul>
   */
  Absolute,

  /*! \brief Fixed position scheme.
   *
   *  The widget is positioned at fixed position with respect to
   *  the browser's view-pane.
   */
  Fixed
};

/*! \brief Enumeration for a cursor style
 *
 * \sa WCssDecorationStyle::setCursor(), WAbstractArea::setCursor()
 */
enum Cursor {
  ArrowCursor,        //!< Arrow, CSS 'default' cursor
  AutoCursor,         //!< Cursor chosen by the browser, CSS 'auto' cursor.
  CrossCursor,        //!< Crosshair, CSS 'cross' cursor
  PointingHandCursor, //!< Pointing hand, CSS 'pointer' cursor
  OpenHandCursor,     //!< Open hand, CSS 'move' cursor
  WaitCursor,         //!< Wait, CSS 'wait' cursor
  IBeamCursor,        //!< Text edit, CSS 'text' cursor
  WhatsThisCursor     //!< Help, CSS 'help' cursor
};

/*! \brief Enumeration that indicates a character encoding.
 *
 * Character encodings are used to represent characters in a stream of
 * bytes.
 *
 * \relates WString
 */
enum CharEncoding {
  /*! \brief Wt's default encoding
   *
   * Wt's global default encoding, as set through WString::setDefaultEncoding()
   *
   */
  DefaultEncoding,

  /*! \brief The (server) system locale.
   *
   * Each byte represents a character, according to the locale
   * of the server-side system.
   */
  LocalEncoding,

  /*! \brief UTF-8 unicode encoding.
   *
   * The byte stream represents unicode characters encoded using
   * UTF-8.
   */
  UTF8
};

/*! \brief Enumeration that indicates a pen style.
 *
 * \ingroup painting
 *
 * \relates WPen
 */
enum PenStyle {
  NoPen,          //!< Do not stroke
  SolidLine,      //!< Stroke with a solid line
  DashLine,       //!< Stroked with a dashed line
  DotLine,        //!< Stroke with a dotted line
  DashDotLine,    //!< Stroke with a dash dot line
  DashDotDotLine  //!< Stroke with a dash dot dot line
};

/*! \brief Enumeration that indicates how line end points are rendered
 *
 * \ingroup painting
 *
 * \relates WPen
 */
enum PenCapStyle {
  FlatCap,        //!< Flat ends
  SquareCap,      //!< Square ends (prolongs line with half width)
  RoundCap        //!< Round ends (terminates with a half circle)
};

/*! \brief Enumeration that indicates how line joins are rendered.
 *
 * \ingroup painting
 *
 * \relates WPen
 */
enum PenJoinStyle {
  MiterJoin,      //!< Pointy joins
  BevelJoin,      //!< Squared-off joins
  RoundJoin       //!< Rounded joins
};

/*! \brief Enumeration that indicates a fill style.
 *
 * \ingroup painting
 *
 * \relates WBrush
 */
enum BrushStyle {
  NoBrush,        //!< Do not fill
  SolidPattern,   //!< Fill with a solid color
  GradientPattern //!< Fill with a color gradient
};

/*! \brief Enumeration that indicates a gradient style.
 *
 * \ingroup painting
 *
 * \relates WGradient
 */
enum GradientStyle {
  LinearGradient,
  RadialGradient
};

/*! \brief Enumeration that specifies where the target of an anchor should
 *         be displayed.
 *
 * \sa WAnchor::setTarget()
 */
enum AnchorTarget {
  TargetSelf,      //!< Show Instead of the application
  TargetThisWindow,//!< Show in the top level frame of the application window
  TargetNewWindow  //!< Show in a separate new tab or window
};

/*! \brief Enumeration that indicates the text format.
 *
 * \sa WText::setTextFormat()
 */
enum TextFormat {
  XHTMLText,       //!< Format text as XSS-safe XHTML markup'ed text
  XHTMLUnsafeText, //!< Format text as XHTML markup'ed text
  PlainText        //!< Format text as plain text
};

/*! \brief Enumeration for predefined colors
 *
 * \ingroup style
 */
enum GlobalColor {
  /*! \brief Color white.
   */
  white,
  /*! \brief Color black.
   */
  black,
  /*! \brief Color red.
   */
  red,
  /*! \brief Color dark red.
   */
  darkRed,
  /*! \brief Color green.
   */
  green,
  /*! \brief Color dark green.
   */
  darkGreen,
  /*! \brief Color blue.
   */
  blue,
  /*! \brief Color dark blue.
   */
  darkBlue,
  /*! \brief Color cyan.
   */
  cyan,
  /*! \brief Color dark cyan.
   */
  darkCyan,
  /*! \brief Color magenta.
   */
  magenta,
  /*! \brief Color dark magenta.
   */
  darkMagenta,
  /*! \brief Color yellow.
   */
  yellow,
  /*! \brief Color dark yellow.
   */
  darkYellow,
  /*! \brief Color medium gray.
   */
  gray,
  /*! \brief Color dark gray.
   */
  darkGray,
  /*! \brief Color light gray.
   */
  lightGray,
  /*! \brief Color transparent.
   */
  transparent
};

/*! \brief Enumeration for keyboard modifiers
 *
 * \sa WMouseEvent::modifiers(), WKeyEvent::modifiers()
 *
 * \ingroup signalslot
 */
enum KeyboardModifier {
  NoModifier = 0x0,       //!< No modifiers
  ShiftModifier = 0x1,    //!< Shift key pressed
  ControlModifier = 0x2,  //!< Control key pressed
  AltModifier = 0x4,      //!< Alt key pressed
  MetaModifier = 0x8      //!< Meta key pressed ("Windows" or "Command" (Mac) key)
};

W_DECLARE_OPERATORS_FOR_FLAGS(KeyboardModifier)

/*! \brief Enumeration for key codes
 *
 * These are key codes that identify a key on a keyboard. All keys
 * listed here can be identified across all browsers and (Western)
 * keyboards. A %Key is returned by WKeyEvent::key(). If you want to
 * identify a character, you should use the WKeyEvent::charCode()
 * method instead.
 *
 * \sa WInteractWidget::keyWentDown, WInteractWidget::keyWentUp
 *
 * \ingroup signalslot
 */
enum Key {
  Key_unknown = 0,     //!< Unknown key.
  Key_Enter = 13,      //!< Enter key.
  Key_Tab = 9,         //!< Tab key.
  Key_Backspace = 8,   //!< Backspace key.
  Key_Shift = 16,      //!< Shift key.
  Key_Control = 17,    //!< Control key.
  Key_Alt = 18,        //!< Alt key.
  Key_PageUp = 33,     //!< Page up key.
  Key_PageDown = 34,   //!< Page down key.
  Key_End = 35,        //!< End key.
  Key_Home = 36,       //!< Home key.
  Key_Left = 37,       //!< Left arrow key.
  Key_Up = 38,         //!< Up arrow key.
  Key_Right = 39,      //!< Right arrow key.
  Key_Down = 40,       //!< Down arrow key.
  Key_Insert = 45,     //!< Insert key.
  Key_Delete = 46,     //!< Delete key.
  Key_Escape = 27,     //!< Escape key.
  Key_F1 = 112,        //!< F1 function key.
  Key_F2 = 113,        //!< F2 function key.
  Key_F3 = 114,        //!< F3 function key.
  Key_F4 = 115,        //!< F4 function key.
  Key_F5 = 116,        //!< F5 function key.
  Key_F6 = 117,        //!< F6 function key.
  Key_F7 = 118,        //!< F7 function key.
  Key_F8 = 119,        //!< F8 function key.
  Key_F9 = 120,        //!< F9 function key.
  Key_F10 = 121,       //!< F10 function key.
  Key_F11 = 122,       //!< F11 function key.
  Key_F12 = 123,       //!< F12 function key.
  Key_Space = ' ',     //!< Space
  Key_A = 'A',         //!< 'A' key
  Key_B = 'B',         //!< 'B' key
  Key_C = 'C',         //!< 'C' key
  Key_D = 'D',         //!< 'D' key
  Key_E = 'E',         //!< 'E' key
  Key_F = 'F',         //!< 'F' key
  Key_G = 'G',         //!< 'G' key
  Key_H = 'H',         //!< 'H' key
  Key_I = 'I',         //!< 'I' key
  Key_J = 'J',         //!< 'J' key
  Key_K = 'K',         //!< 'K' key
  Key_L = 'L',         //!< 'L' key
  Key_M = 'M',         //!< 'M' key
  Key_N = 'N',         //!< 'N' key
  Key_O = 'O',         //!< 'O' key
  Key_P = 'P',         //!< 'P' key
  Key_Q = 'Q',         //!< 'Q' key
  Key_R = 'R',         //!< 'R' key
  Key_S = 'S',         //!< 'S' key
  Key_T = 'T',         //!< 'T' key
  Key_U = 'U',         //!< 'U' key
  Key_V = 'V',         //!< 'V' key
  Key_W = 'W',         //!< 'W' key
  Key_X = 'X',         //!< 'X' key
  Key_Y = 'Y',         //!< 'Y' key
  Key_Z = 'Z',         //!< 'Z' key
  Key_1 = '1',         //!< '1' key
  Key_2 = '2',         //!< '2' key
  Key_3 = '3',         //!< '3' key
  Key_4 = '4',         //!< '4' key
  Key_5 = '5',         //!< '5' key
  Key_6 = '6',         //!< '6' key
  Key_7 = '7',         //!< '7' key
  Key_8 = '8',         //!< '8' key
  Key_9 = '9',         //!< '9' key
  Key_0 = '0',         //!< '0' key
};

/*! \brief Enumeration for the check state of a check box.
 *
 * \sa WCheckBox
 */
enum CheckState {
  Unchecked,        //!< Unchecked
  PartiallyChecked, //!< Partially checked (for a tri-state checkbox)
  Checked           //!< Checked
};

/*! \brief Enumeration that indicates how to change a selection.
 *
 * \sa WPaintedWidget::update(), WPaintDevice::paintFlags()
 */
enum PaintFlag {
  PaintUpdate = 0x1 //!< The canvas is not cleared, but further painted on.
};

W_DECLARE_OPERATORS_FOR_FLAGS(PaintFlag)

#ifndef WT_TARGET_JAVA

/*! \brief Enumeration that indicates a regular expression option.
 *
 * \sa WSortFilterProxyModel::setFilterOptions(), WRegExpValidator::setOptions()
 */
enum RegExpFlag {
  MatchCaseInsensitive = 0x1 //!< Case insensitive matching
};

W_DECLARE_OPERATORS_FOR_FLAGS(RegExpFlag)

#else // WT_TARGET_JAVA

enum RegExpFlag { };
const int MatchCaseInsensitive = 0x1;

#endif // WT_TARGET_JAVA

/*! \brief Enumeration that indicates a %Wt entrypoint type.
 *
 * An entry point binds a behavior to a public URL. Only the wthttpd
 * connector currently supports multiple entry points.
 */
enum EntryPointType {
  /*! \brief Specifies a full-screen application.
   *
   * A full screen application manages the entire browser window and
   * provides its own HTML page.
   *
   * \sa WServer::addEntryPoint(), WApplication::root()
   */
  Application,

  /*! \brief Specifies an application that manages one or more widgets.
   *
   * A widget set application is part of an existing HTML page. One or
   * more HTML elements in that web page may be bound to widgets
   * managed by the application.
   *
   * The application presents itself as a JavaScript file, and
   * therefore should be embedded in the web page using a
   * &lt;script&gt; tag, from within the &lt;body&gt; (since it needs
   * access to the &lt;body&gt;).
   *
   * \note A WidgetSet application requires JavaScript support
   *
   * \sa WServer::addEntryPoint(), WApplication::bindWidget()
   */
  WidgetSet,

  /*! \brief Specifies a static resource.
   *
   * A static resource binds a WResource to a public URL, and is not bound
   * to a specific session.
   *
   * \if cpp
   * \sa WServer::addResource()
   * \elseif java
   * @see WtServlet#addResource(WResource r, String path)
   * \endif
   */
  StaticResource
};


/*! \brief Enum for internal use.
 */
enum RenderFlag {
  RenderFull    = 0x1,
  RenderUpdate  = 0x2
};

W_DECLARE_OPERATORS_FOR_FLAGS(RenderFlag)

/*! \brief Flags that specify how to match two values.
 *
 * Except when MatchExactly, the lexical matching is done (by comparing
 * string representations of the value with the query). This is by default
 * case insensitive, unless MatchCaseSensitive is OR'ed.
 *
 * \ingroup modelview
 */
enum MatchFlag {
  MatchExactly = 0x0,       //!< Same type and value
  MatchStringExactly = 0x1, //!< Lexical match
  MatchStartsWith = 0x2,    //!< Match start with query
  MatchEndsWith = 0x3,      //!< Match end with query
  MatchRegExp = 0x4,        //!< Regular expression match
  MatchWildCard = 0x5,      //!< Wildcard match
  MatchCaseSensitive = 0x10,//!< Case sensitive
  MatchWrap = 0x20          //!< Wrap around whole model
};

W_DECLARE_OPERATORS_FOR_FLAGS(MatchFlag)

/*! \brief Type part of MatchFlags */
static const WFlags<MatchFlag> MatchTypeMask = 
  MatchExactly | MatchStringExactly | MatchStartsWith | MatchEndsWith |
  MatchRegExp | MatchWildCard;

/*! \brief Flags that indicate table header options
 *
 * \sa WAbstractItemModel::headerFlags()
 *
 * \ingroup modelview
 */
enum HeaderFlag {
  /*! \brief Flag that indicates that the column can be expanded.
   *
   * \sa WAbstractItemModel::expandColumn()
   */
  ColumnIsCollapsed = 0x1,

  /*! \brief Flag that indicates that the column was expanded to the left.
   *
   * \sa WAbstractItemModel::collapseColumn()
   */
  ColumnIsExpandedLeft = 0x2,

  /*! \brief Flag that indicates that the column was expanded to the right.
   *
   * \sa WAbstractItemModel::collapseColumn()
   */
  ColumnIsExpandedRight = 0x4,

  /*! \brief Flag that indicates that the header can be checked.
   */
  HeaderIsUserCheckable = 0x8,

  /*! \brief Flag that indicates that the item has three states.
   *
   * When set, Wt::CheckStateRole data is of type Wt::CheckState
   */
  HeaderIsTristate = 0x10,

  /*! \brief Flag that indicates that the item text (DisplayRole, ToolTipRole)
   * is HTML
   */
  HeaderIsXHTMLText = 0x40
};

W_DECLARE_OPERATORS_FOR_FLAGS(HeaderFlag)

/*! \brief Enumeration that indicates a meta header type.
 *
 * \sa WApplication::addMetaHeader()
 */
enum MetaHeaderType {
  MetaName,       //!< Of the form &lt;meta name=... content=... &gt;
  MetaProperty,   //!< Of the form &lt;meta property=... content=... &gt; 
  MetaHttpHeader  //!< Of the form &lt;meta http-equiv=... content=... &gt;
};

/*! \brief An enumeration describing an event's type.
 *
 * \sa WEvent::eventType()
 */
enum EventType {
  OtherEvent,   //!< An event which is not user- or timer-initiated
  UserEvent,    //!< A user-initiated event
  TimerEvent,   //!< A timer-initiated event
  ResourceEvent //!< An event which is a resource request
};

/*! \brief An enumeration describing a layout direction.
 */
enum LayoutDirection {
  LeftToRight, //!< Left-to-Right (Western and other languages)
  RightToLeft  //!< Right-to-Left (Many Middle Eastern and Arabic languages)
};

enum WebWriteEvent {
  WriteCompleted, // Write was successful
  WriteError      // Write failed
};

enum WebReadEvent {
  ReadError,   // Read failed
  ReadMessage, // Read a WebSocket message
  ReadPing     // Read Ping message
};

}

#endif // WGLOBALS_H_
