void Open(long mode=EW_POSITION_OVER,EW_Window *relation=NULL)
void Close(void)
Open/Close the window with the specified mode potentially
relative to another window relation.
If the mode is EW_POSITION_OVER, the new window is automatically
psuedo-centered over the relation (or screen if relation is NULL).
If the mode is EW_POSITION_RELATIVE_TO,
the new window is placed relative to the relation
(or screen if relation is NULL) using the windows currently specified
origin.
Note that the origin is updated to the new postition,
so any successive relative positionings may accumulate.
The window is checked against the bounds of the screen unless
mode is EW_POSITION_RELATIVE_TO and relation is NULL.
The optional arguments mode and relation default to
EW_POSITION_OVER and NULL which pseudo-centers over the whole screen.
By pseudo-centering, we mean that the X midlines are aligned,
but the Y midline of the new window is aligned with the
two-thirds-up midline of the relation (or the screen).
Relativity is only used during the opening.
If the relation moves later, it will not force movement upon
the other opened window.
long GetOpened(void)
Returns TRUE if the window is currently open.
long Map(void)
long UnMap(void)
Map/UnMap the window using the same optional arguments as Open().
The optional arguments mode and relation default to
EW_POSITION_RELATIVE_TO and NULL.
long GetMapped(void)
Returns TRUE if the window is currently mapped.
void SetTitle(char *set)
void DelayedDelete(void)
It is sometimes desirable to delete a window as a result
of an event occuring in that window.
However, the point where this would be done, such as in a callback,
occurs under a member function of that window.
Calling DelayedDelete() will cause the window to be deleted
after the window finishes processing the event.
Any window is automatically closed and removed from any event context
during its destruction.
Also, all the widgets contained in a destructed window
will be automatically deleted.
To prevent a widget or widget hierarchy from being deleted with a window,
remove it from the window prior to the window's destruction.
char *GetTitle(void)
Set/Get the text in the window title bar.
The graphical presentation of this data is dependent on the window manager
which may be able to defeat it altogether.
void SetFlags(long set)
long GetFlags(void)
Set/Get the window flags.
which can be set to an OR'ed sum of the following:
| EW_WINDOW_FLAG_NULL 0x00 |
No special flags.
|
| EW_WINDOW_BORDERLESS 0x01 |
The window is created without a border.
|
| EW_WINDOW_FIXED_SIZE 0x02 |
The window cannot be resize interactively.
|
| EW_WINDOW_TRANSIENT 0x04 | The window manager is told that this window is temporary (for pop-up windows). |
| EW_WINDOW_NOMAP 0x08 |
The window is not mapped when opened.
The default is to map (show) the window when opened.
|
| EW_WINDOW_MODAL 0x20 |
The window is modal. This potentially blocks input to other windows.
This flag should never changed when the window is mapped or opened.
|
| EW_WINDOW_MODAL_EXCLUSIVE 0x60 |
The window is modal and exclusive over any previously mapped modals.
Modal priority is given to the most recently mapped modal.
If that modal is not exclusive, all currently mapped modals
are treated non-exclusively.
In most common cases, modals should all be exclusive.
One exception would be a pop-up window from a modal parent which requires
event passage though the parent.
This flag should never changed when the window is mapped or opened.
|
void Resize(void)
Resize the widget hierarchy based on modified dimensions.
This is generally only called internally by the event loop.
void SetNumberColors(long set)
long GetNumberColors(void)
Set/Get the number of colors used in the window, currently either 16, 8. or 4.
This number may change when the window opens since color resolution
degradation can occur if there is insufficient colormap space.
Windows in the same application will try to share colormap space.
void SetDoubleBuffer(long set)
long GetDoubleBuffer(void)
Activate/Deactivate double buffering of the windows graphics, if supported.
Double buffering is activated if set is non-zero.
void Dump(long brief)
This prints out information about the entire widget hierarchy for
debugging purposes.
If brief is non-zero, the output may be condensed.
This can be used by applications,
but be aware that it can change the current pointers
on the widget linked lists.
long Raise(long force)
long Lower(long force)
Raise/lower the window in the window managers stack of windows.
Using a non-zero force may take extra measures to ensure the action.
This is not an issue under X-Windows since it allows you to
raise/lower windows freely.
Win32 (or NT, at least) has a much less convenient system.
It ties thread scheduling, window focus, and window stacking together
in a rather messy inconsistant methodology.
The issue here is that you may not be able to a raise a window if
it is not "active" or "foregrounded".
Using non-zero force causes prerequisite actions
in order to raise the window.
This should not be taken lightly,
since it can cause unneccessary and/or highly annoying focus changes.
Currently, force has no effect in Lower().
Note that under X-Windows, the window focus (Win32's "active" window)
is almost entirely controlled by the window manager and the
user's configuration thereof, allowing flexability to meet varying preferences.
This is yet another problem with the Microsoft line of
operating/windowing systems that is difficult to address without making
a barrage of judgemental statements.
void Activate(void)
Assign window focus to the window.
This only has meaning under Win32 and has no effect under X-Windows.
This should only be used in very rare cases such as
to specify which window will be active after
the currently active window closes.
This function is called from Raise(TRUE).
void SetEventContext(EW_EventContext *set)
EW_EventContext *GetEventContext(void)
Set/Get the event context.
Return the EW_EventContext to which the window belongs.
static void GetScreenSize(long *x,long *y)
Get the size of the screen.
long GrabPointer(void)
long ReleasePointer(void)
Grab/Release exclusive access to the mouse pointer.
void RegisterKillCallback( void (*function)(EW_Window *,long))
Register a function to be called when the window is killed.
This arguments passed to the callback indicate the window and a flag,
potentially set to TRUE if the intent was to kill the entire application.
Not all windowing systems are capable of distinguishing
a "kill application" event from a "close window" event and will
only produce the latter.
If function is NULL, the default function ewDefaultKillCallback() is called.
Its default action is to call Close() after a normal non-kill where other windows still exist
and EndLoop() in reaction to an application kill or if no other open/mapped windows exist.
Applications that do not desire this exact behavior should supply their own callback on a per window basis.
void SetDoWork(long set)
long GetDoWork(void)
Activate/Deactivate EW_ITEM_WORK events for this window.
void RingBell(void)
Do some platform-specific action to draw attention,
perhaps a short sound effect, but potentially nothing.
void SetColor(long type,long index)
long GetColor(long type)
Set/Get the current color for the specified type.
Acceptable values for index are:
The following previously support colors are mapped
to currently supported colors.
Acceptable values for type are:
void LineOut(long x,long y,long sx,long sy,long inc,long colorindex)
void LineOut(long x,long y,long sx,long sy,long inc)
Draw a pattern of diagonal lines across the rectangular area
from a lower-left corner x,y of size sx,sy.
void GreyOut(long x,long y,long sx,long sy,long colorindex)
void GreyOut(long x,long y,long sx,long sy)
Draw a point mesh of dots from a lower-left corner
x,y of size sx,sy at 50% coverage.
This should give anything previously drawn in that region a hazy appearance.
This function actually maps into LineOut() using an inc of 2,
which is equivalent and faster than drawing pixel by pixel.
void RectFill(long left,long bottom,long right,long top)
void RectFill(long left,long bottom,long right,long top,long colorindex)
void RectWire(long left,long bottom,long right,long top)
void RectWire(long left,long bottom,long right,long top,long colorindex)
Draw a filled/unfilled rectangle with the specified bounds:
left,bottom,right,top.
The optional argument colorindex draws using the specified color.
Otherwise, the current EW_PEN_COLOR is used.
The specified edges are all inclusively drawn,
not just up to but including the edges.
void ArcFill(long cx,long cy,long rx,long ry,float start,float end)
void ArcFill(long cx,long cy,long rx,long ry,float start,float end,long colorindex)
void ArcWire(long cx,long cy,long rx,long ry,float start,float end)
void ArcWire(long cx,long cy,long rx,long ry,float start,float end,long colorindex)
Draw a filled/unfilled elliptical arc with the center
(cx,cy), and radius (rx,ry).
The start and end
angles indicate the extent of the arc in degrees.
This extent goes counter-clockwise from
start angle to the end angle, even if the end angle is lesser.
If the angles are equal, a full ellipse is drawn.
The optional argument colorindex draws using the specified color.
Otherwise, the current EW_PEN_COLOR is used.
void TriangleFill(long a[2],long b[2],long c[2])
void TriangleFill(long a[2],long b[2],long c[2],long colorindex)
void TriangleWire(long a[2],long b[2],long c[2])
void TriangleWire(long a[2],long b[2],long c[2],long colorindex)
Draw an arbitrary 3 vertex wireframe or filled polygon between
the specified x,y coordinates.
The optional argument colorindex draws using the specified color.
Otherwise, the current EW_PEN_COLOR is used.
void PolyFill(long vert[][2],long vertices)
void PolyFill(long vert[][2],long vertices,long colorindex)
void PolyWire(long closed,long vert[][2],long vertices)
void PolyWire(long closed,long vert[][2],long vertices,long colorindex)
Draw a multi-vertex line or filled polygon between
the specified array of x,y coordinates of vert[][2],
of a specified number of vertices.
The optional argument colorindex draws using the specified color.
Otherwise, the current EW_PEN_COLOR is used.
For PolyWire(), a non-zero closed indicates
that the last vertex should be connected to the first.
PolyFill() is always connected.
void Line(long x1,long y1,long x2,long y2)
void Line(long x1,long y1,long x2,long y2,long colorindex)
Draw a arbitrary line between from
x1,y1 to x2,y2.
The optional argument colorindex draws using the specified color.
Otherwise, the current EW_PEN_COLOR is used.
Both endpoint pixels are drawn.
void Point(long x,long y)
void Point(long x,long y,long colorindex)
Draw a point at the specified x,y location.
The optional argument colorindex draws using the specified color.
Otherwise, the current EW_PEN_COLOR is used.
void ImageDraw(long posx,long posy,long lenx,long leny,unsigned char *buffer,long transparent=FALSE)
Draw a raster of color indexes at origin
posx,posy and of size lenx,leny
from the given char buffer of length, at least,
of lenx*leny.
If the optional argument transparent is TRUE,
the image contains transparent pixels of the index 255.
void ImageCopy(long srcx,long srcy,long destx,long desty,long sx,long sy)
Copy a raster of color indexes from
srcx,srcy and of size sx,sy to destx,desty.
EW_DISPLAY_TYPE GetDisplayIdentifier(void)
Return a window-system specific display identifier,
currently either an X (Display *) or an Win32 (HWND).
Use of this information should be heavily scrutinized since it deviates
from the concept of a portable abstraction.
void GetClipBounds(long *x,long *y,long *sx,long *sy)
Set/Get the bounds of the clipping region at the current level
of the clipping-region stack.
The bounds have a lower left corner of x,y and size sx,sy.
void CopyClipRegionFrom(EW_RectangleList *other)
void CopyClipRegionTo(EW_RectangleList *other)
Copy current clip region from/to the specified list of rectangles.
void IntersectClipRegion(long x,long y,long sx,long sy)
Sets the current clipping region at the current level
of the clipping-region stack to the intersection of the previous setting
and the clipping region specified in the arguments.
void PushClipRegion(void)
Copy the current clipping region to a new entry on the clipping stack and
make the new entry the current clipping region.
void PopClipRegion(void)
Discard the current clipping region and return to clipping region previous
to the last PushClipRegion() call.
One PopClipRegion() is expect to pair up with every
PushClipRegion() call.
void RewindClipRegion(void)
void RestoreClipRegion(void)
Move the pointer to the current clipping region without pushing or
popping the stack.
This will probably be rarely used outside of EW internals.
One RestoreClipRegion() is expect to pair up with every
RewindClipRegion() call.
Any call to PushClipRegion() or PopClipRegion() on an unrestored
stack will discard all unrestored levels from the stack since the
push/pop operation will occur at the rewound level.
long LoadFont(EW_Font *fontdata,EW_FontRequest *request)
Attempt to load the font closest to the specifications in
request using the handle fontdata.
Returns a non-zero value if unsuccessful.
long SetFont(EW_Font *fontdata)
Use the font associated with the handle fontdata
for following text operations.
Returns a non-zero value if unsuccessful.
long CopyDefaultFontTo(EW_Font *fontdata)
long CopyDefaultFontFrom(EW_Font *fontdata)
Copying the current default font to/from the given fontdata.
The default font is applied to windows that do not set to a specific font.
void SetUnderline(long setting)
If setting is non-zero, use underlining in following text operations.
This underlining uses Line(), not window-system dependent text underlining.
long StringWidth(const char *string)
long CharWidth(char c)
Return the width in pixels of the specified string or character
in the font specified by SetFont().
long GetFontHeight(void)
Return the height in pixels of the largest glyph (character)
in the font specified by SetFont().
void SetTemporaryFontHeight(long set)
Set a temporary font height used for sizing computations
before the window is opened.
long FindFontAttribute(long type)
Return the value for the given attribute type
in the font specified by SetFont().
Acceptable values for type are
| EW_FONTATTR_ASCENT |
The distance, in pixels, the font reaches over the baseline.
|
| EW_FONTATTR_DESCENT |
The distance, in pixels, the font reaches below the baseline.
|
| EW_FONTATTR_HEIGHT |
The total height of the font,
in pixels (equivalent to GetFontHeight()).
This value is neccesarily equal to the sum of the values returned with
EW_FONTATTR_ASCENT and EW_FONTATTR_DESCENT.
|
void Text(long x,long y,const char *string,long len,long shadow,long colorindex)
void Text(long x,long y,const char *string,long len,long shadow)
Draw the text string of length len at the specified location.
If shadow is non-zero,
the text is drawn with a slight shadow to make it easier to read.
Note that this can take twice as long.
void Refresh(void)
void Refresh(EW_Redraw *redraw)
Redraw the widget hierarchy.
The argument version is generally only called by the event loop itself.
The non-argument version can be used by a widget or application to force
a total redraw of the window.
void WinSet(void)
This directs internal graphics calls to this window.
For efficency, this is not done automatically by individual graphics commands.
This is generally only called internally by the event loop before a
Refresh().
void UpdateSize(void)
This resets window/graphics system dependent parameters related
to the window size such as clipping and viewports.
This is generally only called internally by the event loop or window itself.
void ProcessEvent(EW_Event *event)
This acts on the given EW_Event using
EW_WidgetList::Descend() on each child, and
Resize() and Refresh() as appropriate.
This is generally only called internally by the event loop.
void SetIgnoreNextExposure(long set)
long GetIgnoreNextExposure(void)
Set/Get a flag that forces the next exposure occuring in the window
to be ignored.
After ignoring an exposure, the flag is cleared.
void DoKillCallback(long quit_app)
Call the registered kill-callback.
This is generally only called by EW internally.
If quit_app is non-zero,
the intent is to quit the application, not just close the specific window.
Clear(void)
Clear to entire window to the EW_BACKGROUND_COLOR.
This is generally only called internally by the window itself.
Flush(long block)
This is used to force all pending drawing operations to complete.
If block is non-zero, the call may map into a stronger blocking call that
should wait until the graphics pipelines have emptied.
This can be important since most window and graphics systems buffer
their graphics commands.
The resultant effect and functionality is closely tied to
the window and graphics systems used.
BufferSwap(void)
Swap the image buffers when using double buffering.
This is generally only called internally by the window itself.
Since double buffering is often tightly tied to the creation of each window,
it should currently only be activated/deactivated on windows when
they are in a closed state (such as before they are opened).
Similarly, SetFlags() and SetTitle()
should be set while the window is in a closed state.
LoadFont() and/or SetFont()
may not operate as desired if the window is not open.
One can use the event context's phantom window if neccessary.