2020-02-29 15:40:55 +00:00
|
|
|
#ifndef __qwaq_view_h
|
|
|
|
#define __qwaq_view_h
|
|
|
|
|
|
|
|
#include <Array.h>
|
|
|
|
#include <Object.h>
|
|
|
|
|
2020-03-02 06:22:54 +00:00
|
|
|
#include "qwaq-draw.h"
|
2020-03-01 09:25:02 +00:00
|
|
|
#include "qwaq-rect.h"
|
2020-03-06 08:25:19 +00:00
|
|
|
#include "qwaq-textcontext.h"
|
2020-02-29 15:40:55 +00:00
|
|
|
|
2020-03-05 06:44:53 +00:00
|
|
|
@class Group;
|
2020-03-24 04:33:28 +00:00
|
|
|
@class ListenerGroup;
|
2020-03-05 06:44:53 +00:00
|
|
|
|
|
|
|
enum {
|
2020-03-23 11:18:12 +00:00
|
|
|
ofCanFocus = 0x0001,
|
|
|
|
ofFirstClick = 0x0002,
|
|
|
|
ofDontDraw = 0x0004,
|
|
|
|
ofPreProcess = 0x0008,
|
|
|
|
ofPostProcess = 0x0010,
|
|
|
|
ofMakeFirst = 0x0020,
|
|
|
|
ofTileable = 0x0040,
|
|
|
|
ofCentered = 0x0080,
|
2020-03-05 06:44:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
2020-03-23 11:18:12 +00:00
|
|
|
sfDrawn = 0x0001,
|
|
|
|
sfDisabled = 0x0002,
|
|
|
|
sfInFocus = 0x0004,
|
|
|
|
sfModal = 0x0008,
|
|
|
|
sfLocked = 0x0010,
|
2020-03-05 06:44:53 +00:00
|
|
|
};
|
|
|
|
|
2020-03-23 11:14:32 +00:00
|
|
|
enum {
|
2020-03-23 13:08:30 +00:00
|
|
|
gfGrowNone = 0x0000,
|
2020-03-23 11:14:32 +00:00
|
|
|
gfGrowLoX = 0x0001,
|
|
|
|
gfGrowLoY = 0x0002,
|
|
|
|
gfGrowHiX = 0x0004,
|
|
|
|
gfGrowHiY = 0x0008,
|
|
|
|
gfGrowRel = 0x0010,
|
|
|
|
gfGrowLo = gfGrowLoX | gfGrowLoY,
|
|
|
|
gfGrowHi = gfGrowHiX | gfGrowHiY,
|
|
|
|
gfGrowX = gfGrowLoX | gfGrowHiX,
|
|
|
|
gfGrowY = gfGrowLoY | gfGrowHiY,
|
|
|
|
gfGrowAll = gfGrowX | gfGrowY,
|
|
|
|
};
|
2020-03-19 02:32:44 +00:00
|
|
|
|
2020-03-24 12:02:26 +00:00
|
|
|
@protocol View
|
2020-03-05 06:44:53 +00:00
|
|
|
-setOwner: (Group *) owner;
|
2020-03-23 13:08:30 +00:00
|
|
|
-setGrowMode: (int) mode;
|
2020-03-19 02:32:44 +00:00
|
|
|
|
2020-03-19 06:55:57 +00:00
|
|
|
-(Rect)rect;
|
2020-03-19 09:38:24 +00:00
|
|
|
-(Point)origin;
|
|
|
|
-(Extent)size;
|
2020-03-19 06:55:57 +00:00
|
|
|
|
|
|
|
-(int) containsPoint: (Point) point;
|
2020-03-19 07:27:30 +00:00
|
|
|
-(void) grabMouse;
|
|
|
|
-(void) releaseMouse;
|
2020-03-19 02:32:44 +00:00
|
|
|
|
|
|
|
-(int) options;
|
2020-03-24 04:33:28 +00:00
|
|
|
-(int) state;
|
2020-03-19 02:32:44 +00:00
|
|
|
|
|
|
|
-setContext: (id<TextContext>) context;
|
2020-03-05 06:44:53 +00:00
|
|
|
-draw;
|
2020-03-24 12:01:48 +00:00
|
|
|
-hide;
|
2020-03-05 06:44:53 +00:00
|
|
|
-redraw;
|
2020-03-23 11:14:32 +00:00
|
|
|
-move: (Point) delta;
|
|
|
|
-resize: (Extent) delta;
|
2020-03-25 05:39:37 +00:00
|
|
|
-move:(Point)dpos andResize:(Extent)dsize;
|
2020-03-23 11:14:32 +00:00
|
|
|
-grow: (Extent) delta;
|
2020-03-14 10:45:07 +00:00
|
|
|
-handleEvent: (qwaq_event_t *) event;
|
2020-03-24 04:33:28 +00:00
|
|
|
-takeFocus;
|
|
|
|
-loseFocus;
|
|
|
|
-(ListenerGroup *) onReceiveFocus;
|
|
|
|
-(ListenerGroup *) onReleaseFocus;
|
2020-03-26 02:18:00 +00:00
|
|
|
-raise;
|
2020-03-06 08:25:19 +00:00
|
|
|
|
2020-03-19 06:55:57 +00:00
|
|
|
- (void) onMouseEnter: (Point) pos;
|
|
|
|
- (void) onMouseLeave: (Point) pos;
|
|
|
|
|
2020-03-06 08:25:19 +00:00
|
|
|
- (void) refresh;
|
|
|
|
- (void) mvprintf: (Point) pos, string fmt, ...;
|
|
|
|
- (void) mvvprintf: (Point) pos, string fmt, @va_list args;
|
|
|
|
- (void) mvaddch: (Point) pos, int ch;
|
2020-02-29 15:40:55 +00:00
|
|
|
@end
|
|
|
|
|
2020-03-24 12:02:26 +00:00
|
|
|
@interface View: Object <View>
|
|
|
|
{
|
|
|
|
union {
|
|
|
|
Rect rect;
|
|
|
|
struct {
|
|
|
|
int xpos;
|
|
|
|
int ypos;
|
|
|
|
int xlen;
|
|
|
|
int ylen;
|
|
|
|
};
|
|
|
|
struct {
|
|
|
|
Point pos;
|
|
|
|
Extent size;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
Rect absRect;
|
|
|
|
Point point; // can't be local :(
|
|
|
|
Group *owner;
|
|
|
|
id<TextContext> textContext;
|
|
|
|
int state;
|
|
|
|
int options;
|
|
|
|
int growMode;
|
|
|
|
int cursorState;
|
|
|
|
Point cursor;
|
|
|
|
ListenerGroup *onReceiveFocus;
|
|
|
|
ListenerGroup *onReleaseFocus;
|
|
|
|
}
|
|
|
|
-initWithRect: (Rect) rect;
|
|
|
|
@end
|
|
|
|
|
2020-03-17 16:39:12 +00:00
|
|
|
@interface View (TextContext) <TextContext>
|
2020-03-09 17:58:30 +00:00
|
|
|
@end
|
|
|
|
|
2020-02-29 15:40:55 +00:00
|
|
|
#endif//__qwaq_view_h
|