# widget.c File Reference

`#include "magick/studio.h"`
`#include "magick/color.h"`
`#include "magick/color-private.h"`
`#include "magick/exception.h"`
`#include "magick/exception-private.h"`
`#include "magick/image.h"`
`#include "magick/magick.h"`
`#include "magick/memory_.h"`
`#include "magick/PreRvIcccm.h"`
`#include "magick/string_.h"`
`#include "magick/token.h"`
`#include "magick/utility.h"`
`#include "magick/xwindow-private.h"`
`#include "magick/widget.h"`

## Data Structures

struct | _XWidgetInfo

## Defines

#define | AreaIsActive(matte_info, position)
#define | Extent(s) ((int) strlen(s))
#define | MatteIsActive(matte_info, position)
#define | MaxTextWidth ((unsigned int) (255*XTextWidth(font_info,"_",1)))
#define | MinTextWidth (26*XTextWidth(font_info,"_",1))
#define | QuantumMargin MagickMax(font_info->max_bounds.width,12)
#define | WidgetTextWidth(font_info, text) ((unsigned int) XTextWidth(font_info,text,Extent(text)))
#define | WindowIsActive(window_info, position)
#define | CancelButtonText "Cancel"
#define | ColornameText "Name:"
#define | ColorPatternText "Pattern:"
#define | GrabButtonText "Grab"
#define | ResetButtonText "Reset"
#define | tile_width 112
#define | tile_height 70
#define | CancelButtonText "Cancel"
#define | DismissButtonText "Dismiss"
#define | YesButtonText "Yes"
#define | CancelButtonText "Cancel"
#define | CancelButtonText "Cancel"
#define | DirectoryText "Directory:"
#define | FilenameText "File name:"
#define | GrabButtonText "Grab"
#define | FormatButtonText "Format"
#define | HomeButtonText "Home"
#define | UpButtonText "Up"
#define | BackButtonText "Back"
#define | CancelButtonText "Cancel"
#define | FontnameText "Name:"
#define | FontPatternText "Pattern:"
#define | ResetButtonText "Reset"
#define | CancelButtonText "Cancel"
#define | DismissButtonText "Dismiss"
#define | Timeout 8
#define | ApplyButtonText "Apply"
#define | CacheButtonText "%lu mega-bytes of memory in the undo edit cache "
#define | CancelButtonText "Cancel"
#define | NumberPreferences 8
#define | DismissButtonText "Dismiss"

## Typedefs

typedef struct _XWidgetInfo | XWidgetInfo

## Enumerations

enum | WidgetState { ControlState = 0x0001, InactiveWidgetState = 0x0004, JumpListState = 0x0008, RedrawActionState = 0x0010, RedrawListState = 0x0020, RedrawWidgetState = 0x0040, UpdateListState = 0x0100 }

## Functions

static void | XDrawMatte (Display *, const XWindowInfo *, const XWidgetInfo *)
static void | XSetBevelColor (Display *, const XWindowInfo *, const MagickStatusType)
static void | XSetMatteColor (Display *, const XWindowInfo *, const MagickStatusType)
static void | XSetTextColor (Display *, const XWindowInfo *, const MagickStatusType)
MagickExport void | DestroyXWidget (void)
static void | XDrawBevel (Display *display, const XWindowInfo *window_info, const XWidgetInfo *bevel_info)
static int | MagickAbsoluteValue (const int x)
static int | MagickMax (const int x, const int y)
static int | MagickMin (const int x, const int y)
static void | XDrawBeveledButton (Display *display, const XWindowInfo *window_info, const XWidgetInfo *button_info)
static void | XDrawBeveledMatte (Display *display, const XWindowInfo *window_info, const XWidgetInfo *matte_info)
static void | XDrawMatteText (Display *display, const XWindowInfo *window_info, XWidgetInfo *text_info)
static void | XDrawTriangleEast (Display *display, const XWindowInfo *window_info, const XWidgetInfo *triangle_info)
static void | XDrawTriangleNorth (Display *display, const XWindowInfo *window_info, const XWidgetInfo *triangle_info)
static void | XDrawTriangleSouth (Display *display, const XWindowInfo *window_info, const XWidgetInfo *triangle_info)
static void | XDrawWidgetText (Display *display, const XWindowInfo *window_info, XWidgetInfo *text_info)
static void | XEditText (Display *display, XWidgetInfo *text_info, const KeySym key_symbol, char *text, const unsigned long state)
static void | XGetWidgetInfo (const char *text, XWidgetInfo *widget_info)
static void | XHighlightWidget (Display *display, const XWindowInfo *window_info, const int x, const int y)
static int | XScreenEvent (Display *display, XEvent *event, char *data)
MagickExport void | XColorBrowserWidget (Display *display, XWindows *windows, const char *action, char *reply)
MagickExport int | XCommandWidget (Display *display, XWindows *windows, const char **selections, XEvent *event)
MagickExport int | XConfirmWidget (Display *display, XWindows *windows, const char *reason, const char *description)
MagickExport int | XDialogWidget (Display *display, XWindows *windows, const char *action, const char *query, char *reply)
MagickExport void | XFileBrowserWidget (Display *display, XWindows *windows, const char *action, char *reply)
static int | FontCompare (const void *x, const void *y)
MagickExport void | XFontBrowserWidget (Display *display, XWindows *windows, const char *action, char *reply)
MagickExport void | XInfoWidget (Display *display, XWindows *windows, const char *activity)
MagickExport void | XListBrowserWidget (Display *display, XWindows *windows, XWindowInfo *window_info, const char **list, const char *action, const char *query, char *reply)
MagickExport int | XMenuWidget (Display *display, XWindows *windows, const char *title, const char **selections, char *item)
MagickExport void | XNoticeWidget (Display *display, XWindows *windows, const char *reason, const char *description)
MagickExport MagickBooleanType | XPreferencesWidget (Display *display, XResourceInfo *resource_info, XWindows *windows)
MagickExport void | XProgressMonitorWidget (Display *display, XWindows *windows, const char *task, const MagickOffsetType offset, const MagickSizeType span)
MagickExport void | XTextViewWidget (Display *display, const XResourceInfo *resource_info, XWindows *windows, const MagickBooleanType mono, const char *title, const char **textlist)

## Variables

static XWidgetInfo | monitor_info
static XWidgetInfo | submenu_info
static XWidgetInfo * | selection_info = (XWidgetInfo *) NULL
static XWidgetInfo | toggle_info
static const int | BorderOffset = 4
static const int | DoubleClick = 250

## Define Documentation

#define ApplyButtonText "Apply"

#define AreaIsActive | ( | matte_info,
|  | position |  | ) |

Value:

    ( \
      ((position.y >= (int) (matte_info.y-matte_info.bevel_width)) &&  \
       (position.y < (int) (matte_info.y+matte_info.height+matte_info.bevel_width))) \
       ? MagickTrue : MagickFalse)

#define BackButtonText "Back"

#define CacheButtonText "%lu mega-bytes of memory in the undo edit cache "

#define CancelButtonText "Cancel"

#define CancelButtonText "Cancel"

#define CancelButtonText "Cancel"

#define CancelButtonText "Cancel"

#define CancelButtonText "Cancel"

#define CancelButtonText "Cancel"

#define CancelButtonText "Cancel"

#define ColornameText "Name:"

#define ColorPatternText "Pattern:"

#define DirectoryText "Directory:"

#define DismissButtonText "Dismiss"

#define DismissButtonText "Dismiss"

#define DismissButtonText "Dismiss"

#define Extent | ( | s |  | ) | ((int) strlen(s))

#define FilenameText "File name:"

#define FontnameText "Name:"

#define FontPatternText "Pattern:"

#define FormatButtonText "Format"

#define GrabButtonText "Grab"

#define GrabButtonText "Grab"

#define HomeButtonText "Home"

#define MatteIsActive | ( | matte_info,
|  | position |  | ) |

Value:

    ( \
      ((position.x >= (int) (matte_info.x-matte_info.bevel_width)) && \
       (position.y >= (int) (matte_info.y-matte_info.bevel_width)) &&  \
       (position.x < (int) (matte_info.x+matte_info.width+matte_info.bevel_width)) &&  \
       (position.y < (int) (matte_info.y+matte_info.height+matte_info.bevel_width))) \
       ? MagickTrue : MagickFalse)

#define MaxTextWidth ((unsigned int) (255*XTextWidth(font_info,"_",1)))

#define MinTextWidth (26*XTextWidth(font_info,"_",1))

#define NumberPreferences 8

#define QuantumMargin MagickMax(font_info->max_bounds.width,12)

#define ResetButtonText "Reset"

#define ResetButtonText "Reset"

#define tile_height 70

#define tile_width 112

#define Timeout 8

#define UpButtonText "Up"

#define WidgetTextWidth | ( | font_info,
|  | text |  | ) | ((unsigned int) XTextWidth(font_info,text,Extent(text)))

#define WindowIsActive | ( | window_info,
|  | position |  | ) |

Value:

    ( \
      ((position.x >= 0) && (position.y >= 0) &&  \
       (position.x < (int) window_info.width) &&  \
       (position.y < (int) window_info.height)) ? MagickTrue : MagickFalse)

#define YesButtonText "Yes"

## Typedef Documentation

typedef struct _XWidgetInfo XWidgetInfo

## Enumeration Type Documentation

enum WidgetState

Enumerator:

  ControlState |
  InactiveWidgetState |
  JumpListState |
  RedrawActionState |
  RedrawListState |
  RedrawWidgetState |
  UpdateListState |

## Function Documentation

MagickExport void DestroyXWidget | ( | void |  | ) |

static int FontCompare | ( | const void * | x,
|  | const void * | y |
| ) |  |  | `[static]`

static int MagickAbsoluteValue | ( | const int | x | ) | `[inline, static]`

static int MagickMax | ( | const int | x,
|  | const int | y |
| ) |  |  | `[inline, static]`

static int MagickMin | ( | const int | x,
|  | const int | y |
| ) |  |  | `[inline, static]`

MagickExport void XColorBrowserWidget | ( | Display * | display,
|  | XWindows * | windows,
|  | const char * | action,
|  | char * | reply |
| ) |  |  |

MagickExport int XCommandWidget | ( | Display * | display,
|  | XWindows * | windows,
|  | const char ** | selections,
|  | XEvent * | event |
| ) |  |  |

MagickExport int XConfirmWidget | ( | Display * | display,
|  | XWindows * | windows,
|  | const char * | reason,
|  | const char * | description |
| ) |  |  |

MagickExport int XDialogWidget | ( | Display * | display,
|  | XWindows * | windows,
|  | const char * | action,
|  | const char * | query,
|  | char * | reply |
| ) |  |  |

static void XDrawBevel | ( | Display * | display,
|  | const XWindowInfo * | window_info,
|  | const XWidgetInfo * | bevel_info |
| ) |  |  | `[static]`

static void XDrawBeveledButton | ( | Display * | display,
|  | const XWindowInfo * | window_info,
|  | const XWidgetInfo * | button_info |
| ) |  |  | `[static]`

static void XDrawBeveledMatte | ( | Display * | display,
|  | const XWindowInfo * | window_info,
|  | const XWidgetInfo * | matte_info |
| ) |  |  | `[static]`

static void XDrawMatte | ( | Display * | display,
|  | const XWindowInfo * | window_info,
|  | const XWidgetInfo * | matte_info |
| ) |  |  | `[static]`

static void XDrawMatteText | ( | Display * | display,
|  | const XWindowInfo * | window_info,
|  | XWidgetInfo * | text_info |
| ) |  |  | `[static]`

static void XDrawTriangleEast | ( | Display * | display,
|  | const XWindowInfo * | window_info,
|  | const XWidgetInfo * | triangle_info |
| ) |  |  | `[static]`

static void XDrawTriangleNorth | ( | Display * | display,
|  | const XWindowInfo * | window_info,
|  | const XWidgetInfo * | triangle_info |
| ) |  |  | `[static]`

static void XDrawTriangleSouth | ( | Display * | display,
|  | const XWindowInfo * | window_info,
|  | const XWidgetInfo * | triangle_info |
| ) |  |  | `[static]`

static void XDrawWidgetText | ( | Display * | display,
|  | const XWindowInfo * | window_info,
|  | XWidgetInfo * | text_info |
| ) |  |  | `[static]`

static void XEditText | ( | Display * | display,
|  | XWidgetInfo * | text_info,
|  | const KeySym | key_symbol,
|  | char * | text,
|  | const unsigned long | state |
| ) |  |  | `[static]`

MagickExport void XFileBrowserWidget | ( | Display * | display,
|  | XWindows * | windows,
|  | const char * | action,
|  | char * | reply |
| ) |  |  |

MagickExport void XFontBrowserWidget | ( | Display * | display,
|  | XWindows * | windows,
|  | const char * | action,
|  | char * | reply |
| ) |  |  |

static void XGetWidgetInfo | ( | const char * | text,
|  | XWidgetInfo * | widget_info |
| ) |  |  | `[static]`

static void XHighlightWidget | ( | Display * | display,
|  | const XWindowInfo * | window_info,
|  | const int | x,
|  | const int | y |
| ) |  |  | `[static]`

MagickExport void XInfoWidget | ( | Display * | display,
|  | XWindows * | windows,
|  | const char * | activity |
| ) |  |  |

MagickExport void XListBrowserWidget | ( | Display * | display,
|  | XWindows * | windows,
|  | XWindowInfo * | window_info,
|  | const char ** | list,
|  | const char * | action,
|  | const char * | query,
|  | char * | reply |
| ) |  |  |

MagickExport int XMenuWidget | ( | Display * | display,
|  | XWindows * | windows,
|  | const char * | title,
|  | const char ** | selections,
|  | char * | item |
| ) |  |  |

MagickExport void XNoticeWidget | ( | Display * | display,
|  | XWindows * | windows,
|  | const char * | reason,
|  | const char * | description |
| ) |  |  |

MagickExport MagickBooleanType XPreferencesWidget | ( | Display * | display,
|  | XResourceInfo * | resource_info,
|  | XWindows * | windows |
| ) |  |  |

MagickExport void XProgressMonitorWidget | ( | Display * | display,
|  | XWindows * | windows,
|  | const char * | task,
|  | const MagickOffsetType | offset,
|  | const MagickSizeType | span |
| ) |  |  |

static int XScreenEvent | ( | Display * | display,
|  | XEvent * | event,
|  | char * | data |
| ) |  |  | `[static]`

static void XSetBevelColor | ( | Display * | display,
|  | const XWindowInfo * | window_info,
|  | const | MagickStatusType |
| ) |  |  |

static void XSetMatteColor | ( | Display * | display,
|  | const XWindowInfo * | window_info,
|  | const | MagickStatusType |
| ) |  |  |

static void XSetTextColor | ( | Display * | display,
|  | const XWindowInfo * | window_info,
|  | const | MagickStatusType |
| ) |  |  |

MagickExport void XTextViewWidget | ( | Display * | display,
|  | const XResourceInfo * | resource_info,
|  | XWindows * | windows,
|  | const MagickBooleanType | mono,
|  | const char * | title,
|  | const char ** | textlist |
| ) |  |  |

## Variable Documentation

const int BorderOffset = 4`[static]`

const int DoubleClick = 250`[static]`

XWidgetInfo monitor_info `[static]`

Initial value:

      {
        (char *) NULL, (char *) NULL, (char *) NULL, 0, 0, 0, 0, 0, 0, 0, 0,
        MagickFalse, MagickFalse, MagickFalse, MagickFalse, MagickFalse
      }

XWidgetInfo * selection_info = (XWidgetInfo *) NULL`[static]`

XWidgetInfo submenu_info `[static]`

Initial value:

      {
        (char *) NULL, (char *) NULL, (char *) NULL, 0, 0, 0, 0, 0, 0, 0, 0,
        MagickFalse, MagickFalse, MagickFalse, MagickFalse, MagickFalse
      }

XWidgetInfo toggle_info `[static]`

Initial value:

      {
        (char *) NULL, (char *) NULL, (char *) NULL, 0, 0, 0, 0, 0, 0, 0, 0,
        MagickFalse, MagickFalse, MagickFalse, MagickFalse, MagickFalse
      }