home *** CD-ROM | disk | FTP | other *** search
- #include <classes/Workbench/Workbench.h>
-
- #include <pragma/wb_lib.h>
-
- WBArgC::WBArgC(struct WBArg *arg, WBArgC *def)
- : NodeC(),
- DiskObjectNewC(arg ? arg->wa_Name : NULL, arg ? arg->wa_Lock : NULL)
- {
- argument = arg;
- default_arg = def;
- }
-
- WBArgC::~WBArgC()
- {
- }
-
- STRPTR WBArgC::name()
- {
- if (argument)
- return argument->wa_Name;
- return NULL;
- }
-
- BPTR WBArgC::lock()
- {
- if (argument)
- return argument->wa_Lock;
- return NULL;
- }
-
- // ******************************************************************
-
- WBArgListC::WBArgListC(LONG argNum, struct WBArg *args, WBArgC *def)
- : ListC()
- {
- WBArgC *x;
- while ((argNum--) > 0)
- {
- if (x = new WBArgC(args,def))
- addTail(*x);
- args++;
- };
- }
-
- WBArgListC::~WBArgListC()
- {
- WBArgC *x;
- while (x = remTail())
- {
- delete x;
- };
- }
-
- // *****************************************************************
-
- WBStartupC::WBStartupC(struct WBStartup &msg)
- : wbtool(msg.sm_ArgList),
- projekts(msg.sm_NumArgs-1,msg.sm_ArgList+1,&wbtool)
- {
- }
-
- WBStartupC::~WBStartupC()
- {
- }
-
- // *************************************************************
-
- AppEventHandlerC::AppEventHandlerC(UWORD apptype)
- {
- aType = apptype;
- }
-
- BOOL AppEventHandlerC::handle(MessageC &msg)
- {
- return _handle((AppMessageC &) msg);
- }
-
- BOOL AppEventHandlerC::forMe(MessageC &msg)
- {
- return _forMe((AppMessageC &) msg);
- }
-
- BOOL AppEventHandlerC::_handle(AppMessageC &msg)
- {
- return FALSE;
- }
-
- BOOL AppEventHandlerC::_forMe(AppMessageC &msg)
- {
- return aType == msg.am_Type;
- }
-
- // *************************************************************
-
- AppWindowC::AppWindowC(AppPortC &p, WindowC &w, ULONG id, Tag tag1type, ...)
- : aPort(&p),
- aWindow(&w),
- aID(id),
- inittags((struct TagItem *) tag1type),
- aWin(NULL)
- {
- }
-
- AppWindowC::AppWindowC(AppPortC &p, WindowC &w, ULONG id, struct TagItem *tags)
- : aPort(&p),
- aWindow(&w),
- aID(id),
- inittags(tags),
- aWin(NULL)
- {
- }
-
- AppWindowC::AppWindowC(const AppWindowC &s)
- : inittags(s.inittags)
- {
- aPort = s.aPort;
- aWindow = s.aWindow;
- aID = s.aID;
- aWin = NULL;
- }
-
- AppWindowC::~AppWindowC()
- {
- detach();
- }
-
- AppWindowC &AppWindowC::operator= (const AppWindowC &s)
- {
- if (this != &s)
- {
- detach();
- aPort = s.aPort;
- aWindow = s.aWindow;
- aID = s.aID;
- aWin = NULL;
- };
- return *this;
- }
-
- BOOL AppWindowC::attach(Tag tag1type, ...)
- {
- return attach((struct TagItem *) tag1type);
- }
-
- BOOL AppWindowC::attach(struct TagItem *tags)
- {
- if (aWin)
- return TRUE;
- if (aWindow->window() && aPort->port())
- {
- TagItemC t = inittags;
- t.append(tags);
- if (aWin = AddAppWindowA(aID,(ULONG) this,aWindow->window(),
- aPort->port(),t.tags()))
- return TRUE;
- };
- return FALSE;
- }
-
- VOID AppWindowC::detach()
- {
- if (aWin)
- {
- RemoveAppWindow(aWin);
- aWin = NULL;
- }
- }
-
- // *************************************************************
-
- AppWindowHandlerC::AppWindowHandlerC(AppWindowC &w)
- : AppEventHandlerC(AMTYPE_APPWINDOW),
- aWindow(&w)
- {
- aWindow->port()->add(*this);
- }
-
- BOOL AppWindowHandlerC::_handle(AppMessageC &msg)
- {
- drop(msg);
- return FALSE;
- }
-
- BOOL AppWindowHandlerC::_forMe(AppMessageC &msg)
- {
- return (appType() == msg.am_Type) &&
- (aWindow == (AppWindowC *) msg.am_UserData);
- }
-
- // *************************************************************
-
-