home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GEMini Atari
/
GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso
/
zip
/
program
/
gempp15b.zoo
/
include
/
gemw.h
< prev
next >
Wrap
C/C++ Source or Header
|
1993-04-25
|
5KB
|
190 lines
/////////////////////////////////////////////////////////////////////////////
//
// GEMwindow
//
// A GEMwindow is a standard GEM window, which acts just like that as
// a base class. Its contents is undefined, and redraw requests have
// no effect - derived classes should implement this. It does, however,
// handle the requirement of clipping the redraw area - a standard
// requirement of GEM windows.
//
// This file is Copyright 1992,1993 by Warwick W. Allison.
// This file is part of the gem++ library.
// You are free to copy and modify these sources, provided you acknowledge
// the origin by retaining this notice, and adhere to the conditions
// described in the file COPYING.LIB.
//
/////////////////////////////////////////////////////////////////////////////
#ifndef GEMw_h
#define GEMw_h
#include <gemfb.h>
#include <grect.h>
#include <gemfast.h>
#include <bool.h>
class GEMactivity;
class GEMevent;
class GEMwindow
{
public:
GEMwindow(GEMactivity& in, int Parts);
GEMwindow(GEMactivity& in, int Parts, const GRect&);
GEMwindow(GEMactivity& in, int Parts, const GRect& actWorkArea, const GRect& maxWorkArea);
GEMwindow(const GEMwindow&);
virtual ~GEMwindow();
// some GEM like open and close functions
virtual bool Create();
virtual void Open();
virtual void Close();
virtual void Delete();
// Accessory windows are closed "automatically". Groan. An accessory
// should call this method for all windows on an AC_CLOSE message.
virtual void BecomeDeleted();
// discriminators and inquiring functions
virtual bool IsOpen() const;
bool IsCreated() const { return created; }
GRect BorderRect() const { return Work2Win(Pos); }
GRect WorkRect() const { return Pos; }
// routines performing actions
virtual void Top(const GEMevent&);
virtual void Move(int X, int Y);
virtual void Resize( int w, int h ); // it's the border size
virtual GEMfeedback Click(const GEMevent&);
// Top attempted by clicking at (x,y) - returns TRUE if actually topped.
// (rather than simply using the click)
void RedrawOverlaps(const GRect&); // Calls Redraw
int Handle() const { return handle; }
void Align(int x, int y, int xmult=8, int ymult=1);
// Movement will align such that (x,y) is a multiple of (xmult,ymult).
virtual GEMfeedback UserClosed()
{ Close(); return ContinueInteraction; }
virtual void UserFulled();
virtual void UserResized( int w,int h );
virtual void UserMoved( int x, int y )
{ Move( x,y ); }
// methods for the vertical slider
virtual GEMfeedback VSlidered( int newPos );
virtual GEMfeedback LineUp();
virtual GEMfeedback LineDown();
virtual GEMfeedback PageUp();
virtual GEMfeedback PageDown();
// methods for the horizontal slider
virtual GEMfeedback HSlidered( int newPos );
virtual GEMfeedback ColumnLeft();
virtual GEMfeedback ColumnRight();
virtual GEMfeedback PageLeft();
virtual GEMfeedback PageRight();
// Info-line
char *InfoText() const { return info; }
void SetInfoText( const char * );
// Name (title)
void SetName( const char * );
const char *Name() const { return name; }
// Slider
virtual void Flush();
// the Set* members flush their changes !
void SetVisibleLines( int noOfLines );
void SetTotalLines( int noOfLines );
void SetTopLine( int noOfLine );
// the Set* members flush their changes !
void SetVisibleColumns( int noOfColumns );
void SetTotalColumns( int noOfColumns );
void SetLeftColumn( int noOfColumn );
// since this value may change after Resize()
int VisibleLines() { return visibleLines; }
// since this value may change after Resize()
int VisibleColumns() { return visibleColumns; }
int TopLine() { return actualTopLine; }
int LeftColumn() { return actualLeftColumn; }
int LineHeight() { return lineHeight; }
int ColumnWidth() { return columnWidth; }
void LineHeight(int i) { lineHeight=i; }
void ColumnWidth(int i) { columnWidth=i; }
protected:
int parts;
bool initialized;
// characteristic rectangles, representing the work area
GRect Pos, Max; // Current and Full sizes
// convert functions using the 'parts' member
GRect Win2Work( const GRect& outer ) const;
GRect Work2Win( const GRect& work ) const;
virtual void Redraw(const GRect&);
void SetBorderRect( const GRect& );
virtual void SetWorkRect( const GRect& );
// ratio of the units ( document / pixel ),
// used to handle Resize() requests
//Rational vUnitRatio;
// I'd like to implement windows with automatic
// processing of WinWithSizer::UserResized() and
// WinWithFuller::UserFulled() requests, i.e., the
// slider size will change because the number of
// visible lines may change.
void VCalculateGEMvalues();
void VCalculateValues();
virtual bool VAlignSlider();
void VFlushSlider();
void HCalculateGEMvalues();
void HCalculateValues();
virtual bool HAlignSlider();
void HFlushSlider();
private:
char *info;
GRect storer; // stores last actual size and pos.
char *name;
int handle;
bool opened, created;
GEMactivity* act;
int xoff,yoff,xalign,yalign;
// parameters representing the real GEM slider
int vSize,
vPosition;
int hSize,
hPosition;
// pixel size of document units
int lineHeight,columnWidth;
// representation of the slider in document units
int visibleLines,
totalLines,
actualTopLine;
// representation of the slider in document units
int visibleColumns,
totalColumns,
actualLeftColumn;
void InActivity(GEMactivity& in);
};
#endif