]>
git.saurik.com Git - wxWidgets.git/blob - src/motif/mdi/lib/XsMotifWindow.h
2 Copyright (C) 1996 Scott W. Sadler
10 03-Mar-96 1.0; Scott W. Sadler (ssadler@cisco.com)
14 #ifndef XSMOTIFWINDOW_H
15 #define XSMOTIFWINDOW_H
20 #include "XsMDIWindow.h"
22 // Forward declarations
27 ----------------------------------------------------------------------------
31 class _XsMotifBase
: public XsComponent
{
37 virtual ~_XsMotifBase ( );
41 virtual void show ( );
45 virtual const char *className ( ) const;
49 // Protected constructor
51 _XsMotifBase (const char *name
, XsMotifWindow
*win
);
53 // Component life-cycle
55 virtual void _componentDestroyed ( );
59 void _drawShadows (Position x
, Position y
, Dimension width
,
60 Dimension height
, Dimension thick
, Boolean reverse
= False
);
62 void _drawLine (Position x1
, Position y1
, Position x2
, Position y2
, GC
&gc
);
73 virtual void _map ( );
75 // Internal Event handlers
77 static void _mapEventHandler (Widget
, XtPointer
, XEvent
*, Boolean
*);
81 ----------------------------------------------------------------------------
82 _XsMotifComponent class
85 class _XsMotifComponent
: public _XsMotifBase
{
91 virtual ~_XsMotifComponent ( );
96 TopCursor
= 0, BottomCursor
, LeftCursor
, RightCursor
,
97 TopLeftCursor
, TopRightCursor
, BottomLeftCursor
,
98 BottomRightCursor
, NumCursors
};
102 virtual const char *className ( ) const;
106 // Protected constructor
108 _XsMotifComponent (const char *name
, XsMotifWindow
*win
, Widget parent
= 0);
112 static Cursor _cursors
[NumCursors
];
114 // Component parameters
116 Dimension _borderSize
;
117 Dimension _buttonSize
;
118 Dimension _cornerSize
;
122 virtual void _expose (XEvent
*) = 0;
123 virtual void _input (XEvent
*);
127 // Internal Event handlers
129 static void _exposeEventHandler (Widget
, XtPointer
, XEvent
*, Boolean
*);
130 static void _inputEventHandler (Widget
, XtPointer
, XEvent
*, Boolean
*);
134 static XtResource _resourceList
[];
140 ----------------------------------------------------------------------------
144 class _XsMotifCorner
: public _XsMotifComponent
{
150 enum Corner
{ TopLeft
= 0, TopRight
, BottomLeft
, BottomRight
, Max
};
152 // Constructor/Destructor
154 _XsMotifCorner (const char *name
, XsMotifWindow
*win
, Corner corner
);
155 virtual ~_XsMotifCorner ( );
159 virtual const char *className ( ) const;
169 virtual void _expose (XEvent
*);
170 virtual void _input (XEvent
*);
171 virtual void _map ( );
175 ----------------------------------------------------------------------------
179 class _XsMotifSide
: public _XsMotifComponent
{
185 enum Side
{ Top
= 0, Bottom
, Left
, Right
, Max
};
187 // Constructor/Destructor
189 _XsMotifSide (const char *name
, XsMotifWindow
*win
, Side side
);
190 virtual ~_XsMotifSide ( );
194 virtual const char *className ( ) const;
207 virtual void _expose (XEvent
*);
208 virtual void _input (XEvent
*);
209 virtual void _map ( );
210 virtual void _configure (XEvent
*);
216 static void _configureEventHandler (Widget
, XtPointer
, XEvent
*, Boolean
*);
220 ----------------------------------------------------------------------------
224 class _XsMotifButton
: public _XsMotifComponent
{
230 enum Button
{ Menu
= 0, Minimize
, Maximize
, Max
};
232 // Constructor/Destructor
234 _XsMotifButton (const char *name
, XsMotifWindow
*win
, Button button
);
235 virtual ~_XsMotifButton ( );
239 virtual void redraw ( );
243 virtual const char *className ( ) const;
254 virtual void _expose (XEvent
*);
255 virtual void _input (XEvent
*);
256 virtual void _map ( );
260 ----------------------------------------------------------------------------
264 class _XsMotifTitle
: public _XsMotifComponent
{
268 // Constructor/Destructor
270 _XsMotifTitle (const char *name
, XsMotifWindow
*win
);
271 virtual ~_XsMotifTitle ( );
275 void setTitle (const char *name
);
276 const char *title ( ) const;
280 virtual const char *className ( ) const;
290 XFontStruct
*_titleFont
;
295 // Component life-cycle
297 virtual void _componentDestroyed ( );
301 virtual void _redraw ( );
305 virtual void _expose (XEvent
*);
306 virtual void _input (XEvent
*);
307 virtual void _map ( );
308 virtual void _configure (XEvent
*);
314 static void _configureEventHandler (Widget
, XtPointer
, XEvent
*, Boolean
*);
318 static XtResource _resourceList
[];
321 // Inline member functions
323 inline const char *_XsMotifTitle::title ( ) const
325 return (_titleString
);
329 ----------------------------------------------------------------------------
333 class _XsMotifIcon
: public _XsMotifComponent
{
337 // Constructor/Destructor
339 _XsMotifIcon (const char *name
, XsMotifWindow
*win
, Widget parent
);
340 virtual ~_XsMotifIcon ( );
344 virtual void show ( );
348 void setIconName (const char *name
);
349 const char *iconName ( ) const;
351 void setPixmap (Pixmap pm
);
352 Pixmap
pixmap ( ) const;
356 virtual const char *className ( ) const;
367 XFontStruct
*_iconFont
;
371 Dimension _width
, _height
;
372 Position _iconX
, _iconY
;
375 // Component life-cycle
377 virtual void _componentDestroyed ( );
381 virtual void _expose (XEvent
*);
382 virtual void _input (XEvent
*);
383 virtual void _map ( );
389 static XtResource _resourceList
[];
392 // Inline member-functions
394 inline const char *_XsMotifIcon::iconName ( ) const
399 inline Pixmap
_XsMotifIcon::pixmap ( ) const
405 ----------------------------------------------------------------------------
409 class _XsMotifMenu
: public _XsMotifBase
{
413 // Constructor/Destructor
415 _XsMotifMenu (const char *name
, XsMotifWindow
*win
);
416 virtual ~_XsMotifMenu ( );
420 virtual void popup (Boolean atPointer
= True
);
425 NoItem
= -1, Restore
, Move
, Size
, Minimize
,
426 Maximize
, Raise
, Lower
, Close
, Num
431 virtual const char *className ( ) const;
437 enum { ShadowThickness
= 1 };
438 enum { VertTextOffset
= 3 };
439 enum { HorizTextOffset
= 10 };
443 static Cursor _cursor
;
444 static Pixmap _stipple
;
445 static Display
*_dpy
;
449 String _strings
[Num
];
450 XFontStruct
*_menuFont
;
458 // Component life-cycle
460 virtual void _componentDestroyed ( );
462 // Menu event processing
464 virtual void _processEvents ( );
468 virtual void _processItem (Item item
);
469 virtual void _redrawMenu ( );
471 void _redrawItem (Item
);
472 void _toggleItem (Item
, Boolean active
= False
);
473 Item
_trackPointer (XMotionEvent
*event
);
477 Boolean
_grabPointer ( );
478 void _ungrabPointer ( );
482 virtual void _map ( );
488 static Boolean
_workProc (XtPointer
);
492 static XtResource _resourceList
[];
498 ----------------------------------------------------------------------------
502 class XsMotifWindow
: public XsMDIWindow
{
506 // Constructor/Destructor
508 XsMotifWindow (const char *name
);
509 virtual ~XsMotifWindow ( );
511 // Window manipulation
513 virtual void raise ( );
514 virtual void lower ( );
516 virtual void minimize ( );
517 virtual void maximize ( );
518 virtual void restore ( );
520 virtual void close ( );
522 // Window and icon strings
524 void setTitle (const char *name
);
525 const char *title ( ) const;
527 void setIconName (const char *name
);
528 const char *iconName ( ) const;
530 void setPixmap (Pixmap pm
);
531 Pixmap
pixmap ( ) const;
533 // Window icon handle
535 Widget
icon ( ) const;
539 void popupMenu (Boolean atPointer
= True
);
543 Boolean
maximized ( ) const;
544 Boolean
minimized ( ) const;
548 virtual void setPosition (Position
, Position
);
549 virtual void setSize (Dimension
, Dimension
);
551 Dimension
minWidth ( ) const;
552 Dimension
minHeight ( ) const;
556 virtual const char *className ( ) const;
560 // Window creation functions
562 virtual void _buildClientArea (Widget parent
) = 0;
563 virtual void _createWindow (Widget parent
);
567 _XsMotifCorner
*_corners
[_XsMotifCorner::Max
];
568 _XsMotifSide
*_sides
[_XsMotifSide::Max
];
569 _XsMotifButton
*_buttons
[_XsMotifButton::Max
];
570 _XsMotifTitle
*_title
;
576 Dimension _savedWidth
, _savedHeight
;
577 Position _savedX
, _savedY
;
578 Dimension _minW
, _maxW
;
579 Dimension _minH
, _maxH
;
587 Boolean _showMinimize
;
588 Boolean _showMaximize
;
589 Boolean _lowerOnIconify
;
598 virtual void _mapEvent ( );
602 // Internal event handlers
604 static void _mapEventHandler (Widget
, XtPointer
, XEvent
*, Boolean
*);
608 static XtResource _resourceList
[];
611 // Inline member functions
613 inline Boolean
XsMotifWindow::maximized ( ) const
618 inline Boolean
XsMotifWindow::minimized ( ) const
623 inline const char *XsMotifWindow::title ( ) const
626 return (_title
->title ( ));
631 inline const char *XsMotifWindow::iconName ( ) const
634 return (_icon
->iconName ( ));
639 inline Pixmap
XsMotifWindow::pixmap ( ) const
642 return (_icon
->pixmap ( ));
647 inline Widget
XsMotifWindow::icon ( ) const
650 return (_icon
->base ( ));
655 inline Dimension
XsMotifWindow::minWidth ( ) const
660 inline Dimension
XsMotifWindow::minHeight ( ) const