home *** CD-ROM | disk | FTP | other *** search
- /* Some extra routines which may be useful... */
- /* They are for implementing a non-standard rectangle type, i.e. */
- /* when you call Shell_AddRectangle yourself instead of */
- /* Shell_AddBarGraph, Shell_AddGeneralArray, ... etc. When you do this */
- /* you have to write a redrawing function, for which many of the */
- /* following functions are useful. */
- /* The supplied rectangle funtions such as BarGraph, Array etc. use */
- /* these functions, so look at the source for examples. */
-
-
- #ifndef __Shell_Extra_h
- #define __Shell_Extra_h
-
- #ifndef __Shell_h
- #include "Shell.Shell.h"
- #endif
-
- #ifndef __dl_gfx_h
- #include "DeskLib:GFX.h"
- #endif
-
-
-
-
- BOOL Shell_CheckYScrollIsBottom( window_handle windowhandle);
- /* Returns TRUE if windowhandle y-scrollbar is at bottom */
-
- void Shell_MoveYScrollToBottom( window_handle window);
- /* Moves y-scrollbar to bottom */
-
- #define Shell_MakeGE( a, b) if ((b) > (a)) (a) = (b)
- #define Shell_MakeLE( a, b) if ((b) < (a)) (a) = (b)
- /* These macros change the *first* parameter so that it */
- /* is >= or <= the second parameter. */
- /* Useful when you are clipping rectangles. */
-
-
- void Shell_ConvertToTextRect( wimp_rect *rect);
- /* divides all x's and y's by Shell_TEXTXSIZE, Shell_TEXTYSIZE */
-
- void Shell_ConvertToSubTextRect( wimp_rect *rect, const wimp_rect *bigrect);
- /* Used in 2D array rectangle routines. */
- /* bigrect encloses total array, this routine makes *rect */
- /* contain line and column of rect inside bigrect */
-
- void Shell_ConvertToSubTextRect2( wimp_rect *rect, wimp_point rectsize);
- /* As above, but uses a size for the bigrect, for the new */
- /* redrawing method where the redrawer works relative to the */
- /* bottom-left of the rectblock. */
-
-
-
-
- void Shell_CheckWindSizeAndRedraw( window_handle window, const wimp_rect *rect);
- /* Checks that *rect is inside current size of window, and */
- /* resizes the window if nessary. Then does a Wimp_ForceRedraw */
- /* if any of rect is currently visible, or the window has been */
- /* resized. */
- /* This is used by Shell_AddRectangle. */
-
- void Shell_CheckWindSizeAndRedrawAndScroll( window_handle window, const wimp_rect *rect);
- /* As above, but also keeps scroll at lower limit if it is */
- /* already there */
-
- void Shell_ResizeIconRect( Shell_rectblock *r);
- /* Makes a rect's icon-rect the appropriate size */
- /* for the rect's rect. This function should be called */
- /* whenever a rect is resized. */
- /* When redrawing rects, the iconrect is checked */
- /* against the redraw rect so that any icon-border */
- /* is redrawn correctly. */
-
-
-
-
- /* Low level routines for use in rectangle redrawing functions */
- /* ----------------------------------------------------------- */
- /* They enable you to print text, fill rectangles etc inside windows, */
- /* but without having to convert everything to screen coors. */
-
-
- /* These next few functions/#defines are equivalent to GFX_ calls, */
- /* except you pass them a convert_block, and they deal with the scroll */
- /* bars, window position, etc. */
-
-
- #define Shell_ConvertXToScreen( xx, convert) ( (xx) + (convert).x)
- #define Shell_ConvertYToScreen( yy, convert) ( (yy) + (convert).y)
-
- #define Shell_ConvertXToWorkarea( xx, convert) ( (xx) - (convert).x)
- #define Shell_ConvertYToWorkarea( yy, convert) ( (yy) - (convert).y)
-
- #define Shell_ConvertRectToWorkarea( rect, convert) { \
- (rect)->min.x -= (convert).x; \
- (rect)->max.x -= (convert).x; \
- (rect)->min.y -= (convert).y; \
- (rect)->max.y -= (convert).y; \
- } \
-
- #define Shell_ConvertRectToScreen( rect, convert) { \
- (rect)->min.x += (convert).x; \
- (rect)->max.x += (convert).x; \
- (rect)->min.y += (convert).y; \
- (rect)->max.y += (convert).y; \
- } \
-
-
- void Shell_RectangleFill( const wimp_rect *rect, Shell_convertpoint convert);
-
- void Shell_RectangleFill3( int x, int y, int width, int height, Shell_convertpoint convert);
-
- void Shell_RectangleFill2( int xmin, int ymin, int xmax, int ymax, Shell_convertpoint convert);
-
-
-
- #define Shell_RectangleFill_16bit( rect, convert) \
- GFX_RectangleFill( \
- Shell_ConvertXToScreen( rect->min.x, convert), \
- Shell_ConvertYToScreen( rect->min.y, convert), \
- rect->max.x - rect->min.x, \
- rect->max.y - rect->min.y \
- ) \
-
-
-
- #define Shell_RectangleFill2_16bit( xmin, ymin, xmax, ymax, convert) \
- GFX_RectangleFill( \
- Shell_ConvertXToScreen( xmin, convert), \
- Shell_ConvertYToScreen( ymin, convert), \
- xmax - xmin, \
- ymax - ymin \
- ) \
-
-
- #define Shell_RectangleFill3_16bit( xmin, ymin, width, height, convert) \
- GFX_RectangleFill( \
- Shell_ConvertXToScreen( xmin, convert), \
- Shell_ConvertYToScreen( ymin, convert), \
- width, \
- height \
- ) \
-
-
-
-
- #define Shell_Draw2( x, y, convert) \
- GFX_Draw( \
- Shell_ConvertXToScreen( x, convert), \
- Shell_ConvertYToScreen( y, convert) \
- ) \
-
- #define Shell_Move( x, y, convert) \
- GFX_Move( \
- Shell_ConvertXToScreen( x, convert), \
- Shell_ConvertYToScreen( y, convert) \
- ) \
-
-
-
- #define Shell_PlotPoint( x, y, convert) \
- GFX_PlotPoint( \
- Shell_ConvertXToScreen( x, convert), \
- Shell_ConvertYToScreen( y, convert) \
- ) \
-
-
- #define Shell_Circle( x, y, r, convert) \
- GFX_Circle( \
- Shell_ConvertXToScreen( x, convert), \
- Shell_ConvertYToScreen( y, convert), \
- r \
- ) \
-
-
-
-
-
-
- #define Shell_Plot( plotcode, x, y, convert) \
- GFX_Plot( \
- plotcode, \
- Shell_ConvertXToScreen( x), \
- Shell_ConvertYToScreen( y) \
- ) \
-
- /* A general OS_Plot routine */
-
-
-
-
- void Shell_PrintString( const char *s, int x, int y, const Shell_convertpoint convert);
- /* Low level non-wimp print routine to print text straight */
- /* onto screen. x and y should be in work-area coors. */
- /* Used in rectangle-redrawing routines to print text without */
- /* having to convert explicitly to screen coors. */
-
- void Shell_ConvertToSubRect( wimp_rect *rect, const wimp_rect *bigrect);
-
- void Shell_ConvertToSubRect2( wimp_rect *rect, wimp_point bigsize);
-
-
-
- #endif
-