namespace axl::gui

namespace gui {

// typedefs

typedef FontTuple<GdiFont> GdiFontuple;

typedef void(Widget::* WidgetMsgProc)(
    const WidgetMsg *msg,
    bool *isHandled
    );

// enums

enum
{
    ColorFlag_Undefined = 0x80000000,
    ColorFlag_Index     = 0x40000000,
    ColorFlag_IndexMask = 0x3fffffff,
    ColorFlag_RgbMask   = 0x00ffffff,
};

enum FontFlag;
enum FormFactor;
enum Key;
enum ModifierKey;
enum MouseButton;
enum Orientation;
enum PixelFormat;
enum StdColor;
enum StdCursorKind;
enum StdFontKind;
enum StdPalColor;
enum WidgetMsgCode;
enum WmKind;

// structs

struct CaretPos;
struct ColorAttr;
struct FontDesc;
struct HyperlinkAnchor;
struct ImageDesc;
struct Notify;
struct Palette;
struct Point;
struct Rect;
struct Size;
struct TextAttr;
struct TextAttrAnchor;
struct WidgetConstructParam;
struct WidgetKeyMsg;
struct WidgetMouseMsg;
struct WidgetMouseWheelMsg;
struct WidgetMsg;
struct WidgetMsgMap;

template <typename T>
struct WidgetMsgParam;

struct WidgetPaintMsg;
struct WidgetScrollBar;
struct WidgetThreadMsg;

// classes

class AnsiAttrParser;
class Canvas;
class Cursor;
class DeleteGdiObject;
class Engine;
class Font;
class FontTuple;
class GdiCanvas;
class GdiCursor;
class GdiEngine;
class GdiFont;
class GdiImage;

template <typename T>
class GdiObjectHandle;

template <typename T>
class GdiWidget;

class GdiWidgetImpl;
class GuiItem;
class HyperText;
class HyperlinkAnchorArray;
class Image;

template <typename T>
class OffscreenCanvasCache;

class QtCanvas;
class QtCaret;
class QtCursor;
class QtEngine;
class QtFont;
class QtFontTuple;
class QtImage;

template <typename T>
class QtRagelSyntaxHighlighter;

template <typename T>
class QtWidget;

class QtWidgetBase;
class ScreenDc;
class TextAttrAnchorArray;
class TextPainter;
class Widget;
class WidgetDriver;

// global functions

uint_t
getColorIndex(uint_t color);

uint_t
overlayColor(
    uint_t baseColor,
    uint_t overlayColor
    );

uint_t
inverseRgb(uint_t rgb);

MouseButton
getFirstMouseButton(uint_t buttons);

ModifierKey
getFirstModifierKey(uint_t modifierKeys);

FormFactor
getFormFactor(
    int width,
    int height,
    int stripThreshold = 8
    );

FormFactor
getFormFactor(
    const Size& size,
    int stripThreshold = 8
    );

FontFlag
getFirstFontFlag(uint_t flags);

const char*
getFontFlagString(FontFlag flag);

const char*
getFontFlagString(uint_t flags);

uint_t
overlayFontFlags(
    uint_t baseFontFlags,
    uint_t overlayFontFlags
    );

bool
buildLogFont(
    LOGFONTW* logFont,
    const sl::StringRef_w& family,
    size_t pointSize,
    uint_t flags = 0
    );

bool
getLogFontFromFontDesc(
    const FontDesc& fontDesc,
    LOGFONTW* logFont
    );

void
modifyLogFont(
    LOGFONTW* logFont,
    uint_t flags
    );

bool
getFontDescFromLogFont(
    const LOGFONTW* logFont,
    FontDesc* fontDesc
    );

int
getScrollBarFromOrientation(Orientation orientation);

void
buildScrollInfo(
    SCROLLINFO* scrollInfo,
    size_t max,
    size_t page,
    size_t pos
    );

void
getScrollInfoFromScrollBar(
    const WidgetScrollBar& scrollBar,
    SCROLLINFO* scrollInfo
    );

const char*
getPixelFormatString(PixelFormat pixelFormat);

Engine*
getQtEngine();

} // namespace gui