Introduction to X - PowerPoint PPT Presentation

About This Presentation
Title:

Introduction to X

Description:

Introduction to X – PowerPoint PPT presentation

Number of Views:188
Avg rating:3.0/5.0
Slides: 31
Provided by: steve545
Learn more at: https://www.d.umn.edu
Category:

less

Transcript and Presenter's Notes

Title: Introduction to X


1
Introduction to X
  • Features of X
  • Industry standard
  • Device Independent
  • Motif A high level toolkit
  • Programs based on Motif
  • Xlib lowest level
  • Xt Intrinsics hides details of Xlib
  • Motif builds on Xt and provides visual
    components.

2
The Client-Server Model
  • The server is a program that controls all I/O.
  • Creates and manipulates windows
  • produces text and graphics
  • handles input
  • The client is a program that uses the I/O
    services of a server

3
The Window Hierarchy
  • The window tree
  • root window entire screen
  • every window has a parent window except for the
    root window
  • windows can have child windows
  • The X coordinate system
  • upper left corner is (0, 0)
  • x increases to the right and y increases
    downwards

4
Events
  • The server communicates with clients by sending
    "events" to the client application
  • X programs(client applications) are "event
    driven"
  • they wait for an event
  • they respond to the event
  • then they wait for another event

5
Xt Intrinsics
  • Xlib is low level
  • Many lines of code required to perform common
    functions
  • Xt is a toolkit for building UI toolkits
  • defines an object-oriented architecture for UI
    components or "widgets" such as buttons,
    scrollbars and menus
  • independent of any particular look or feel

6
Widgets
  • A widget is a window a data structure
  • Two fundamental types of widgets
  • Display widgets for user info/ input
  • Container widgets for grouping other widgets
    together on the screen
  • It implies a widget hierarchy or a widget tree
  • The root of every widget tree is a shell widget

7
Xt Widget Classes
  • Core
  • Superclass for all other widget classes
  • Composite
  • contains and manages other child widgets
  • Constraint
  • subclass of the Composite class
  • manage children using constraint information
    (size, position)

8
Xt Widget Class (contd.)
  • Shell
  • subclass of the composite class
  • can have only one child
  • three subclasses
  • ApplicationShell
  • provide the main windowfor an application
  • OverrideShell
  • no "decorations" and good for popup menus
  • TransientShell
  • displayed for short time (dialog boxes)

9
Event Dispatching
  • Event Handlers
  • Actions
  • Callbacks
  • functions to be called when some widget-specific
    condition occurs which is usually related to an
    event

10
Xt Resources
  • Xt resources
  • are customizable parameters supported by widgets
  • control most aspects of widgets appearance and
    behavior
  • it is possible to
  • "hard code" resources
  • retrieve them from a database allowing them to be
    specified outside the application i.e. user can
    change them without recompiling

11
The Core widget Class
  • All widgets inherit the resources, callbacks and
    other behavior from Core
  • rarely used directly

12
Core widget class Resources
  • XmNx, XmNy
  • XmNwidth, XmNheight
  • XmNborderWidth
  • XmNsensitive
  • XmNancestorSensitive
  • XmNcolormap
  • XmNbackground
  • XmNbackgroundPixmap
  • XmNborderColor
  • XmNborderPixmap
  • XmNmappedWhenManaged

13
Primitive Motif Widgets
  • XmPrimitive
  • subclass of Core
  • they do not support children
  • also called "display" widget, since they usually
    display information
  • Behaviors
  • Top and bottom shadows
  • Keyboard traversal of windows
  • support for highlighting

14
XmPrimitive Class Resources
  • XmNforeground
  • XmNhighlightOnEnter
  • XmNhighlightThickness
  • XmNhighlightColor
  • XmNshadowThickness
  • XmNtopShadowColor, XmNbottomShadowColor
  • XmNuserData

15
XmLabel Widget Class
  • Provides support for XmPushButton,
    XmToggleButton, XmDrawnButton, XmCascadeButton
  • used to display text or pixmap in a window

16
XmLabel Class Resources
  • XmNalignment
  • XmNlabelType
  • XmNmarginHeight, XmNmarginWidth
  • XmNmarginLeft, XmNmarginRight, XmNmarginTop,
    XmNmarginBottom
  • XmNfontList
  • XmNlabelPixmap
  • XmNlabelString
  • XmNinsensitivePixmap
  • XmNrecomputeSize

17
XmPushButton Widget Class
  • Very common
  • characteristic Motif 3D look
  • appear to protrude until pushed in

18
XmPushButton Class
  • XmPushButton Class Resources
  • XmNarmColor
  • XmNarmPixmap
  • XmNfillOnArm
  • Callbacks
  • XmNarmCallback
  • XmNactivateCallback
  • XmNdisarmCallback

19
XmSeparator Widget Class
  • Used to separate areas of a window
  • they can have several apperances
  • no additional callbacks
  • they support several resources
  • XmNorientation
  • XmHORIZONTAL and XmVERTICAL
  • XmNseparatorType
  • XmNO_LINE, XmSINGLE_LINE, XmDOUBLE_LINE,
    XmSINGLE_DASHED_LINE, XmDOUBLE_DASHED_LINE,
    XmSHADOW_ETCHED_OUT, XmSHADOW_ETCHED_IN,
    XmSHADOW_ETCHED_OUT_DASH, XmSHADOW_ETCHED_IN_DASH

20
Manager Widgets
  • Used to combine child widgets into large
    applications
  • They determine positions of the children
  • must be subclasses of Xt's Composite class
  • the Composite class provides support for handling
    multiple children
  • the Constraint class supports position and size
    for each child

21
XmManager Widget Class
  • Provides support for all Motif widgets that
    contain or manage other widgets
  • inherit behavior from Core, Composite and
    Constraint
  • is an abstract class and is never used directly
  • adds support for
  • top and bottom shadows
  • input focus and keyboard navigation

22
XmManager Class Resources
  • XmNforeground
  • XmNshadowThickness
  • XmNtopShadowColor, XmNbottomShadowColor
  • XmNuserData

23
XmBulletinBoard Widget Class
  • Simple layout strategy
  • child is positioned by setting XmNx, XmNy
    resources
  • don't usually move or resize children
  • provides services and resources for subclasses

24
XmBulletinBoard Class Resources
  • XmNshadowType
  • XmSHADOW_IN, XmSHADOW_OUT, XmSHADOW_ETCHED_IN,
    XmSHADOW_ETCHED_OUT
  • XmNshadowThickness
  • XmNallowOverlap
  • XmNresizePolicy
  • XmRESIZE_NONE, XmRESIZE_ANY, XmRESIZE_GROW
  • XmNbuttonFontList
  • XmNlabelFontList
  • XmNtextFontList
  • XmNtextTranslations
  • XmNfocusCallback

25
XmForm Widget Class
  • Position their children based on values of
    constraint resources with each child
  • resources specify child's position
  • child can have "attachments" for their top,
    bottom, left, right sides
  • supports dynamically resizable layouts
  • flexible and widely used, but tricky to use

26
XmForm Class Resources
  • XmNrubberPositioning
  • XmNresizable
  • XmNfractionBase

27
XmForm Class Constraint Resources
  • XmNtopAttachment, XmNbottomAttachment,
    XmNleftAttachment, XmNrightAttachment
  • XmATTACH_NONE, XmATTACH_FORM, XmATTACH_WIDGET,
    XmATTACH_OPPOSITE_WIDGET, XmATTACH_POSITION,
    XmATTACH_SELF
  • XmNtopWidget, XmNbottomWidget, XmNleftWidget,
    XmNrightWidget
  • XmNtopPosition, XmNbottomPosition,
    XmNleftPosition, XmNrightPosition
  • XmNtopOffset, XmNbottomOffset, XmNleftOffset,
    XmNrightOffset

28
XmForm Attachment Error
  • "Circular" attachments
  • E.g. Do not attach the right side of widget A to
    the left side of widget B and the right side of
    widget B to the left side of widget A.

29
Shell Widget Class
  • Abstract class of Composite
  • Only supports one child
  • Resources
  • XmNallowShellResize
  • XmNgeometry
  • Callbacks
  • XmNpopupCallback, XmNpopdownCallback

30
WmShell Widget Class
  • Subclass of Shell class
  • additional support for interacting with window
    manager
  • Resources
  • XmNbaseHeight, XmNbaseWidth
  • XmNHeightInc, XmNwidthInc
  • XmNinitialState
  • XmNtitle
  • XmNminWidth,XmNminHeight,XmNmaxWidth,XmNmaxHeight
  • XmNiconPixmap
  • XmNiconWindow
Write a Comment
User Comments (0)
About PowerShow.com