home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Inside Multimedia 1995 July
/
IMM0795.ISO
/
share
/
tools
/
freeman
/
disk1
/
awndobj.h_
/
awndobj
Wrap
Text File
|
1995-02-07
|
6KB
|
250 lines
#define __AWNDOBJ_H
#ifndef __STDARG_H
#include "stdarg.h"
#endif
class abswndobj
{
public:
virtual HWND getwnd() = 0;
int gettxtlen()
{
return GetWindowTextLength(getwnd());
}
int begtimer(int id, int timeout)
{
return SetTimer(getwnd(), id, timeout, 0);
}
int endtimer(int id)
{
return KillTimer(getwnd(), id);
}
int totop()
{
return BringWindowToTop(getwnd());
}
int chknull()
{
return getwnd() == 0;
}
int chkpopup()
{
return (getstyle() & WS_POPUP) != 0L;
}
int chkvisible()
{
return IsWindowVisible(getwnd());
}
void gettxt(char s[], int size = 255)
{
GetWindowText(getwnd(), s, size);
}
void clrtxt()
{
settxt("");
}
void settxt(char s[])
{
SetWindowText(getwnd(), s);
}
void setint(int i)
{
settxtfmt("%d", i);
}
void setlng(LONG l)
{
settxtfmt("%ld", l);
}
void setdbl(double d)
{
settxtfmt("%lg", d);
}
void setuint(UINT i)
{
settxtfmt("%u", i);
}
void show(int cmd)
{
ShowWindow(getwnd(), cmd);
}
void update()
{
UpdateWindow(getwnd());
}
void begpaint(PAINTSTRUCT *ps)
{
BeginPaint(getwnd(), (PAINTSTRUCT FAR*)ps);
}
void endpaint(PAINTSTRUCT *ps)
{
EndPaint(getwnd(), ps);
}
void setfont(HFONT f, int isredraw)
{
SendMessage(getwnd(), WM_SETFONT, (WPARAM)f, (LPARAM)MAKELONG(isredraw, 0));
}
void scr2clt(POINT *p)
{
ScreenToClient(getwnd(), p);
}
void clt2scr(POINT *p)
{
ClientToScreen(getwnd(), p);
}
void getclientrect(RECT *clt)
{
GetClientRect(getwnd(), clt);
}
void getrect(RECT *r)
{
GetWindowRect(getwnd(), r);
}
void redraw(int iserase = 1)
{
invalidate(iserase);
update();
}
void invalidate(int iserase = 1)
{
InvalidateRect(getwnd(), NULL, iserase);
}
void invalidate(RECT &r, int iserase = 1)
{
InvalidateRect(getwnd(), &r, iserase);
}
void enable(int isenable = 1)
{
EnableWindow(getwnd(), isenable);
}
void move(int l, int t, int w, int h, int isrepaint = 0)
{
MoveWindow(getwnd(), l, t, w, h, isrepaint);
}
void setredraw(int isredraw = 0)
{
sendmsg(WM_SETREDRAW, isredraw, 0L);
}
void setpos(HWND insertafter, int x, int y, int w, int h, UINT flags)
{
SetWindowPos(getwnd(), insertafter, x, y, w, h, flags);
}
void endcapture()
{
ReleaseCapture();
}
void notifydad(int code)
{
senddadmsg(WM_COMMAND, getword(GWW_ID), MAKELPARAM(getwnd(), code));
}
void setscrollpos(int bar, int pos, int isredraw = 1)
{
SetScrollPos(getwnd(), bar, pos, isredraw);
}
void setscrollrange(int bar, int min, int max, int isredraw = 1)
{
SetScrollRange(getwnd(), bar, min, max, isredraw);
}
void scroll(int dx, int dy, RECT *scrollr = 0, RECT *clipr = 0)
{
ScrollWindow(getwnd(), dx, dy, scrollr, clipr);
}
void showownedpopups(int isshow)
{
ShowOwnedPopups(getwnd(), isshow);
}
operator HWND ()
{
return getwnd();
}
HWND setfocus()
{
return SetFocus(getwnd());
}
HWND begcapture()
{
return SetCapture(getwnd());
}
HWND getdad()
{
return GetParent(getwnd());
}
HWND setdad(HWND dad)
{
return SetParent(getwnd(), dad);
}
HWND getkid(int id)
{
return GetDlgItem(getwnd(), id);
}
HWND getotherwnd(UINT rel)
{
return GetWindow(getwnd(), rel);
}
WORD getword(int off)
{
return GetWindowWord(getwnd(), off);
}
LONG getstyle()
{
return GetWindowLong(getwnd(), GWL_STYLE);
}
HICON seticon(HICON icon)
{
return (HICON)sendmsg(STM_SETICON, (WPARAM)icon, 0L);
}
LRESULT sendmsg(UINT msg, WPARAM wp, LPARAM lp)
{
return SendMessage(getwnd(), msg, wp, lp);
}
LRESULT postmsg(UINT msg, WPARAM wp, LPARAM lp)
{
return PostMessage(getwnd(), msg, wp, lp);
}
LRESULT senddadmsg(UINT msg, WPARAM wp, LPARAM lp)
{
return SendMessage(getdad(), msg, wp, lp);
}
LRESULT postdadmsg(UINT msg, WPARAM wp, LPARAM lp)
{
return PostMessage(getdad(), msg, wp, lp);
}
LRESULT defwndproc(UINT msg, WPARAM wp, LPARAM lp)
{
return DefWindowProc(getwnd(), msg, wp, lp);
}
LRESULT defdlgproc(UINT msg, WPARAM wp, LPARAM lp)
{
return DefDlgProc(getwnd(), msg, wp, lp);
}
HINSTANCE getinst()
{
return (HINSTANCE)getword(GWW_HINSTANCE);
}
int getint(int *i);
int getlng(LONG *l);
int getuint(UINT *i);
int scanf(char fmt[], ...);
void settxtfmt(char fmt[], ...);
void settxtvar(va_list args, char fmt[]);
void setzorder(HWND insafter, UINT flags);
void movecenter(HWND bkwnd = 0);
void movecenter(int x, int y);
void resizekeepc(int w, int h, int isredraw);
void getrectindad(RECT *dr);
void errormsg(char msg[], ...);
void errorvar(va_list args, char msg[]);
void outofmem();
void badctrldata(int id, char msg[], ...);
void transferkids(int toframe, int n, int frframe, int isshow, int tolast = 0, int frthis = 1);
HWND getsibwnd(int i);
static int peekdiscardmsg(int ismore = 0);
static int peekdispatchmsg(int ismore = 0);
};