/contrib/media/updf/include/mgtk/app.h |
---|
0,0 → 1,22 |
#ifndef __MGTK_APP_H |
#define __MGTK_APP_H |
#include<mgtk/widget.h> |
class GApplication: public GGroup |
{ |
public: |
GApplication(GRect *); |
virtual ~GApplication(); |
virtual void SetCaption(char *); |
virtual void Init(); |
virtual void Run(); |
virtual void Done(); |
virtual void DrawWidget(); |
private: |
char * Caption; |
GPoint priv_origin,priv_size; |
unsigned long body,grab,frame; |
}; |
#endif |
/contrib/media/updf/include/mgtk/bitmap.h |
---|
0,0 → 1,38 |
#ifndef __MGTK_BITMAP_H |
#define __MGTK_BITMAP_H |
#include<mgtk/widget.h> |
#include<stdio.h> |
extern "C" { |
#include<libmgfx.h> |
} |
/* Image is 24-bit RGB bitmap */ |
class GImagePool: public GWidget |
{ |
public: |
GImagePool(GRect *); |
virtual ~GImagePool(); |
virtual void DrawWidget(); |
virtual void Write(unsigned long,unsigned long,char *); |
virtual void Load(FILE *); |
virtual void Save(FILE *); |
virtual void PutPixel(int,int,unsigned long); |
GImagePool * Duplicate(GImagePool * Img); |
private: |
char * image_data; |
unsigned long scan_size,image_size; |
}; |
class GPicture: public GWidget |
{ |
public: |
GPicture(GRect * r,char * filename); |
virtual ~GPicture(); |
virtual void DrawWidget(); |
virtual bool Load(char *); |
private: |
mgfx_image_t * img; |
}; |
#endif |
/contrib/media/updf/include/mgtk/button.h |
---|
0,0 → 1,99 |
#ifndef __MGTK_BUTTON_H |
#define __MGTK_BUTTON_H |
#include<mgtk/widget.h> |
#include<mgtk/pen.h> |
#define bs_Normal 0 |
#define bs_DontDraw 1 |
class GTextButton; |
class GButton: public GWidget |
{ |
friend class GTextButton; |
public: |
GButton(GRect *,int flags,unsigned long color,int cmd); |
virtual ~GButton(void); |
virtual void HandleEvent(GEvent *); |
virtual void DrawWidget(); |
virtual void ClickProc(); |
virtual void SetCommand(int); |
private: |
int bId; |
int bFlags; |
int bCmd; |
unsigned long bColor; |
}; |
class GRadioButton; |
class GCheckBox: public GWidget |
{ |
friend class GRadioButton; |
public: |
GCheckBox(GRect *,bool); |
virtual ~GCheckBox(); |
virtual void DrawWidget(); |
virtual void HandleEvent(GEvent *); |
bool Checked(); |
void Check(bool); |
private: |
bool state; |
}; |
class GRadioButton: public GCheckBox |
{ |
public: |
GRadioButton(GRect *,bool); |
virtual ~GRadioButton(); |
virtual void DrawWidget(); |
}; |
class GRadioGroup: public GGroup |
{ |
public: |
GRadioGroup(GRect *,int); |
virtual ~GRadioGroup(); |
virtual void HandleEvent(GEvent *); |
virtual int ActualButton(); |
private: |
int actual; |
GRadioButton * _current_click; |
}; |
class GTextButton: public GButton |
{ |
public: |
GTextButton(GRect *,char *,int); |
virtual ~GTextButton(); |
virtual void DrawWidget(); |
private: |
char * txt; |
}; |
class GButtonAllocator |
{ |
public: |
GButtonAllocator(int max); |
virtual ~GButtonAllocator(); |
int New(); |
void Del(int); |
private: |
unsigned char * gbutton_bitmap; |
int nr_buttons; |
}; |
extern GButtonAllocator * OSButtonAlloc; |
class GImageButton: public GButton |
{ |
public: |
GImageButton(GRect *,struct GImageData *,int); |
virtual ~GImageButton(); |
virtual void DrawWidget(); |
private: |
struct GImageData * data; |
}; |
#endif |
/contrib/media/updf/include/mgtk/editor.h |
---|
0,0 → 1,58 |
#ifndef __MGTK_EDITOR_H |
#define __MGTK_EDITOR_H |
#include<mgtk/widget.h> |
#include<mgtk/slider.h> |
class GClipboard |
{ |
public: |
typedef enum { |
CL_EMPTY=0, |
CL_BINARY=1, |
CL_IMAGE=2, |
CL_TEXT=3, |
} clip_data_type_t; |
GClipboard(); |
virtual ~GClipboard(); |
virtual void * GetData(); |
virtual clip_data_type_t GetDataType(); |
virtual unsigned long GetDataSize(); |
virtual void SetClipData(clip_data_type_t type,void * ptr,unsigned long size); |
virtual void Empty(); |
private: |
void * buf_location; |
unsigned long size; |
clip_data_type_t data_type; |
}; |
#define INVALID_EDITOR_OFFSET 0xffffffff |
class GEditorCore |
{ |
public: |
GEditorCore(unsigned long SizeLim); |
virtual ~GEditorCore(); |
virtual int ExpandBuffer(int delta); |
virtual void Delete(unsigned long offset,unsigned long size); |
virtual void Cut(unsigned long offset,unsigned long size, |
GClipboard * Clip); |
virtual void Copy(unsigned long offset,unsigned long size, |
GClipboard * Clip); |
virtual void Paste(unsigned long offset,GClipboard * Clip); |
virtual unsigned long Search(unsigned long from_off,char * keyword,int name_len); |
virtual int Replace(unsigned long from_off,char * keyword,char * replace_to, |
int kword_len,int rt_len,bool ReplaceAll); |
virtual unsigned long GetTextSize(); |
virtual char * GetTextBuffer(); |
virtual void Empty(); |
virtual bool IsEmpty(); |
virtual void SetCaseSensitive(bool); |
virtual void InsertCharAt(unsigned long off,char c); |
private: |
char * text_buffer; |
unsigned long text_size,buffer_size,size_limit; |
bool case_sensitive; |
}; |
#endif |
/contrib/media/updf/include/mgtk/event.h |
---|
0,0 → 1,49 |
#ifndef __MGTK_EVENT_H |
#define __MGTK_EVENT_H |
typedef struct { |
int evType; |
union { |
struct { |
int evCommand; |
int evMessage; |
void * info; |
unsigned long info_long; |
unsigned char info_char; |
} command; |
struct { |
int xMouse; |
int yMouse; |
int bMouse; |
} mouse; |
struct { |
int keyId; |
} key; |
struct { |
int butId; |
} button; |
} type; |
} GEvent; |
#define GEVENT_NOTHING 0 |
#define GEVENT_COMMAND 1 |
#define GEVENT_MOUSE 2 |
#define GEVENT_CLICK 3 |
#define GEVENT_KEYBOARD 4 |
#define GEVENT_IDLE 5 |
#define GEVENT_BUTTON 6 |
#define cm_Ignore 0 |
#define cm_Disable 1 |
#define cm_Enable 2 |
#define cm_Click 3 |
#define cm_Paint 4 |
#define cm_Quit 5 |
#define cm_Clicked 6 |
#define cm_Scroll 7 |
#define cm_Radio 8 |
#define cm_Scrollup 9 |
#define cm_Scrolldown 10 |
#define cm_KillMenu 11 |
#endif |
/contrib/media/updf/include/mgtk/mgtk.h |
---|
0,0 → 1,15 |
#ifndef __MGTK_H |
#define __MGTK_H |
#include"app.h" |
#include"bitmap.h" |
#include"button.h" |
#include"event.h" |
#include"pen.h" |
#include"slider.h" |
#include"text.h" |
#include"types.h" |
#include"widget.h" |
#include"terminal.h" |
#endif |
/contrib/media/updf/include/mgtk/pen.h |
---|
0,0 → 1,32 |
#ifndef __MGTK_PEN_H |
#define __MGTK_PEN_H |
#include<mgtk/widget.h> |
struct GImageData { |
int w,h; |
unsigned char * data; |
}; |
class GPen |
{ |
public: |
GPen(GWidget *); |
virtual ~GPen(); |
void PutPixel(int,int,unsigned long); |
void Line(int,int,int,int,unsigned long); |
void FillRect(int,int,int,int,unsigned long); |
void DrawLines(GPoint *,int nr_point,unsigned long color); |
void WriteText(int,int,char *,int,unsigned long); |
void Rect(int,int,int,int,unsigned long); |
void Rect3d(int x,int y,int w,int h,unsigned long color); |
void FillRect2(int,int,int,int,unsigned long); |
void Line2(int,int,int,int,unsigned long); |
void PutImage(int,int,int,int,char *); |
void PutImage(int,int,struct GImageData *); |
private: |
int _dx,_dy; |
int _lx,_ly; |
}; |
#endif |
/contrib/media/updf/include/mgtk/slider.h |
---|
0,0 → 1,55 |
#ifndef __MGTK_SLIDER_H |
#define __MGTK_SLIDER_H |
#include<mgtk/widget.h> |
#include<mgtk/button.h> |
#define slider_Horizontal 0 |
#define slider_Vertical 1 |
#define slider_Solid 2 |
class GSlider: public GWidget |
{ |
public: |
GSlider(GRect * r,int mode,unsigned long min,unsigned long max,unsigned long cur); |
virtual ~GSlider(); |
virtual void DrawWidget(); |
virtual void HandleEvent(GEvent *); |
virtual void VSetMin(unsigned long); |
virtual void VSetMax(unsigned long); |
virtual void VSetCur(unsigned long); |
virtual void SetMin(unsigned long); |
virtual void SetMax(unsigned long); |
virtual void SetCur(unsigned long); |
virtual unsigned long GetCur(); |
virtual unsigned long GetMin(); |
virtual unsigned long GetMax(); |
private: |
unsigned long SMode,SMin,SMax,SCur; |
}; |
class GPercentSlider: public GSlider |
{ |
public: |
GPercentSlider(GRect * r,int percent); |
virtual ~GPercentSlider(); |
virtual void DrawWidget(); |
virtual void HandleEvent(GEvent *); |
private: |
char _txt[10]; /* xxx % */ |
}; |
class GScroll: public GGroup |
{ |
public: |
GScroll(GRect * r,int mode,unsigned long min,unsigned long max,unsigned long cur, |
unsigned long _delta); |
virtual ~GScroll(); |
virtual void HandleEvent(GEvent *); |
private: |
GButton * b1,* b2; |
GSlider * slider; |
unsigned long delta; |
}; |
#endif |
/contrib/media/updf/include/mgtk/string.h |
---|
0,0 → 1,20 |
#ifndef __MGTK_STRING_H |
#define __MGTK_STRING_H |
class GString |
{ |
public: |
GString(char *); |
GString(const char *); |
GString(GString&); |
~GString(); |
int Length(); |
char * operator = (GString&); |
GString& operator = (char *); |
void Truncate(int AtPos); |
private: |
char * __str; |
int __len; |
}; |
#endif |
/contrib/media/updf/include/mgtk/terminal.h |
---|
0,0 → 1,30 |
#ifndef __MGTK_TERMINAL_H |
#define __MGTK_TERMINAL_H |
#include<mgtk/widget.h> |
#include<mgtk/pen.h> |
class GTerminal: public GWidget |
{ |
public: |
GTerminal(GRect * r,int cursor_vis,unsigned long TextColor=0x00FF00, |
unsigned long BackgrColor=0); |
virtual ~GTerminal(); |
virtual void DrawWidget(); |
virtual void Putch(char); |
virtual void ClrScr(); |
virtual void Idle(); |
virtual void Scroll(); |
inline void Puts(char * s) |
{ |
for(;*s;s++) Putch(*s); |
} |
private: |
int cx,cy; |
char * screen_buf; |
int xchars,ychars; |
unsigned long _tcolor,_bcolor; |
void LocalUpdate(); |
}; |
#endif |
/contrib/media/updf/include/mgtk/text.h |
---|
0,0 → 1,49 |
#ifndef __MGTK_TEXT_H |
#define __MGTK_TEXT_H |
#include<mgtk/widget.h> |
#define BIG_FONT_XSZ 7 |
#define BIG_FONT_YSZ 9 |
#define SMALL_FONT_XSZ 5 |
#define SMALL_FONT_YSZ 7 |
class GStaticText: public GWidget |
{ |
public: |
GStaticText(GRect *,char *,unsigned long); |
virtual ~GStaticText(); |
virtual void DrawWidget(); |
private: |
unsigned long color; |
char * text; |
int tlen; |
}; |
class GInputLine: public GWidget |
{ |
public: |
GInputLine(GRect *,char *); |
virtual ~GInputLine(); |
virtual void DrawWidget(); |
virtual void HandleEvent(GEvent * ev); |
virtual void Idle(); |
char * GetData(); |
private: |
int cur_pos,max_len; |
char * text_buffer; |
bool vis; |
int blink_cnt; |
}; |
class GLine: public GWidget |
{ |
public: |
GLine(GRect *,int is_vertical); |
virtual ~GLine(); |
virtual void DrawWidget(); |
private: |
int vert; |
}; |
#endif |
/contrib/media/updf/include/mgtk/types.h |
---|
0,0 → 1,22 |
#ifndef __MGTK_TYPES_H |
#define __MGTK_TYPES_H |
typedef struct { |
int x,y; |
} GPoint; |
typedef struct { |
int x,y; |
int w,h; |
inline void Assign(int _x,int _y,int _w,int _h) |
{ |
x=_x; |
y=_y; |
w=_w; |
h=_h; |
} |
} GRect; |
#define RGB(r,g,b) (((b)&0xff)|(((g)&0x00ff)<<8)|(((r)&0x0000ff)<<16)) |
#endif |
/contrib/media/updf/include/mgtk/widget.h |
---|
0,0 → 1,63 |
#ifndef __MGTK_WIDGET_H |
#define __MGTK_WIDGET_H |
#include<mgtk/event.h> |
#include<mgtk/types.h> |
#define wf_Visible 0x00000001 |
#define wf_Disabled 0x00000002 |
#define wf_Focused 0x00000004 |
#define wf_Selected 0x00000008 |
class GGroup; |
class GWidget |
{ |
public: |
GGroup * Parent; |
GPoint Origin; |
GPoint Size; |
GWidget * WNext; |
GWidget * WPrev; |
unsigned long Flags; |
GWidget(); |
virtual ~GWidget(); |
virtual void HandleEvent(GEvent *); |
void Draw(void); |
virtual void DrawWidget(); |
virtual void ToGlobal(GPoint *); |
virtual void ToLocal(GPoint *); |
virtual void Idle(); |
virtual void SetBounds(GRect *); |
int MouseInWidget(int,int); |
void ClearEvent(GEvent *); |
virtual void Show(); |
virtual void Hide(); |
virtual void Select(bool); |
virtual bool IsGroup(); |
inline bool IsDisabled() { return Flags&wf_Disabled; } |
}; |
class GGroup: public GWidget |
{ |
public: |
GRect Clip; |
GWidget * WFirst; |
GWidget * WSelect; |
GGroup(); |
virtual ~GGroup(); |
virtual void HandleEvent(GEvent *); |
virtual void DrawWidget(); |
virtual void Insert(GWidget *); |
virtual void Remove(GWidget *); |
virtual void ForEach(void (*fn)(GGroup *,GWidget *,void *),void *); |
virtual void Show(); |
virtual void Hide(); |
virtual void Select(GWidget *,bool); |
virtual GWidget * Select(); |
virtual bool IsGroup(); |
virtual void BroadcastEvent(GEvent *); |
virtual void RepaintWhole(); |
}; |
#endif |