home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
ool.zip
/
OOL
/
source
/
xstatic.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1997-03-07
|
4KB
|
141 lines
#include "XSIcon.h"
#include "XSFrame.h"
#include "XSBitmap.h"
#include "XGroupBx.h"
#include "XSText.h"
#include "xcontrol.h"
#include <stdio.h>
XStatic :: XStatic(const HWND hwnd)
{
winhandle = hwnd;
WinSetWindowPtr(hwnd, 0, this);
}
XStatic :: XStatic(const ULONG style, const char *title, const PSZ classname, XWindow * ow, const XRect * r, const LONG id, char *font)
{
PRES pres;
LONG x = 0, y = 0, cx = 0, cy = 0;
if (r)
{
x = r->GetX();
y = r->GetY();
cx = r->GetWidth();
cy = r->GetHeight();
}
char buffer[100], *ch;
void *p = NULL;
if (font)
{
pres.fcparam.id = PP_FOREGROUNDCOLORINDEX;
pres.fcparam.cb = sizeof(pres.fcparam.ulColor);
pres.fcparam.ulColor = 16;
pres.fntparam.id = PP_FONTNAMESIZE;
pres.fntparam.cb = 20;
pres.cb = sizeof(pres.fcparam) + sizeof(pres.fntparam);
p = (void *) &pres;
strcpy(pres.fntparam.szFontNameSize, font);
}
if ((style & SS_ICON || style & SS_BITMAP) && id > 0 && (!(style & SS_TEXT)))
{
sprintf(buffer, "#%i", (int) id);
ch = buffer;
}
else
ch = (char *) title;
OOL_WINDOWHANDLE handle = ow->GetHandle();
winhandle = WinCreateWindow(handle, classname, (PSZ) ch, style, x, y, cx, cy, handle, HWND_TOP, id, NULL, p);
WinSetWindowPtr(winhandle, 0, this);
XColor color;
ow->GetBackgroundColor(&color);
SetBackgroundColor(&color);
}
/*@ XStaticText :: XStaticText(XWindow * w, const char *text, const XRect * r, const LONG style, const LONG id, char *font)
@group constructors/destructors
@remarks Constructs a static text
@parameters <t '°' c=2>
°XWindow * owner °the owner of the icon
°char * text °text to display
°XRect * rect °the rectangle
°LONG style °the style
°LONG id °the id of the icon in the program resources
°char * font °font to use, eg "8.Helv" (default is NULL)
</t>
*/
XStaticText :: XStaticText(XWindow * w, const char *text, const XRect * r, const LONG style, const LONG id, char *font):XStatic(SS_TEXT | style, (char *) text, WC_STATIC, w, r, id, font)
{
}
/*@ XStaticIcon :: XStaticIcon(XWindow * w, const XRect * r, const LONG id, const LONG style)
@group constructors/destructors
@remarks Constructs a static icon
@parameters <t '°' c=2>
°XWindow * owner °the owner of the icon
°XRect * rect °the rectangle
°LONG id °the id of the icon in the program resources
°LONG style °the style
</t>
*/
XStaticIcon :: XStaticIcon(XWindow * w, const XRect * r, const LONG id, const LONG style):XStatic(SS_ICON | WIN_VISIBLE | style, "", WC_STATIC, w, r, id)
{
}
/*@ XStaticBitmap :: XStaticBitmap(XWindow * w, const XRect * r, const LONG id, const LONG style)
@group constructors/destructors
@remarks Constructs a static bitmap
@parameters <t '°' c=2>
°XWindow * owner °the owner of the bitmap
°XRect * rect °the rectangle
°LONG id °the id of the bitmap in the program resources
°LONG style °the style
</t>
*/
XStaticBitmap :: XStaticBitmap(XWindow * w, const XRect * r, const LONG id, const LONG style):XStatic(SS_BITMAP | WIN_VISIBLE | style, "", WC_STATIC, w, r, id)
{
}
/*@ XStaticFrame :: XStaticFrame(XWindow * w, const XRect * r, LONG id)
@group constructors/destructors
@remarks Constructs a static frame
@parameters <t '°' c=2>
°XWindow * owner °the owner of the frame
°XRect * rect °the rectangle
°LONG id °id for the frame
</t>
*/
XStaticFrame :: XStaticFrame(XWindow * w, const XRect * r, LONG id):XStatic(SS_FGNDFRAME | WIN_VISIBLE, "", WC_STATIC, w, r, id)
{
}
/*@ XGroupBox :: XGroupBox(XWindow * owner, const XRect * rec, const char *string, const LONG id)
@group constructors/destructors
@remarks Constructs a group-box
@parameters <t '°' c=2>
°XWindow * owner °the owner of the box
°XRect * rect °the rectangle
°const char* title °the title of the group-box
</t>
*/
XGroupBox :: XGroupBox(XWindow * owner, const XRect * rec, const char *string, const LONG id):XStatic(SS_GROUPBOX | WS_VISIBLE, (char *) string, WC_STATIC, owner, rec, id)
{
}