From: Andrew C. <ac...@us...> - 2002-05-29 22:25:33
|
Update of /cvsroot/planeshift/planeshift/src/client/aws In directory usw-pr-cvs1:/tmp/cvs-serv17415/src/client/aws Modified Files: Makefile.am psaws.cpp psaws.h Added Files: pscommwindow.cpp pscommwindow.h pscomp.cpp pscomp.h Log Message: Added in new chat window --- NEW FILE: pscommwindow.cpp --- #include <config.h> #include <iutil/databuff.h> #include <cssys/sysfunc.h> #include <csutil/scfstr.h> #include <csutil/util.h> #include <ivideo/graph3d.h> #include <ivideo/txtmgr.h> #include "net/message.h" #include "net/msghandler.h" #include "net/cmdhandler.h" #include "interface/subscriber.h" #include "iclient/psengine.h" #include "util/pserror.h" #include "pscomp.h" #include "pscommwindow.h" SCF_IMPLEMENT_IBASE(psCommunicationWindow) SCF_IMPLEMENTS_INTERFACE(iNetSubscriber) SCF_IMPLEMENTS_INTERFACE(iCmdSubscriber) SCF_IMPLEMENT_IBASE_END psCommunicationWindow::psCommunicationWindow(iObjectRegistry* objectReg): psCmdBase(objectReg) { SCF_CONSTRUCT_IBASE(0); sink = NULL; // The GUI components systemTextBox = NULL; chatTextBox = NULL; inputLine = NULL; } bool psCommunicationWindow::Setup(MsgHandler* mh, CmdHandler* ch) { psCmdBase::Setup(mh, ch); msgqueue->Subscribe(this, MSGTYPECHAT); msgqueue->Subscribe(this, MSGTYPESYSTEM); cmdsource->Subscribe("/say", "Talk to the people in your immediate vicinity.", true,this); cmdsource->Subscribe("/shout","Talk to people in your sector.",true,this); cmdsource->Subscribe("/tell","Talk to someone privately.",true,this); cmdsource->Subscribe("/guild", "Talk to everyone in your guild privately.",true,this); cmdsource->Subscribe("/group","Talk to your group privately.",true,this); cmdsource->Subscribe("/me", "Perform an action see by people in your vicinity.", true,this); cmdsource->Subscribe("/auction", "Put an item up for sale or offer to buy something.", true,this); return true; } psCommunicationWindow::~psCommunicationWindow() { SCF_DEC_REF(sink); } void psCommunicationWindow::HandleMessage ( MsgEntry* me ) { if ( systemTextBox == NULL ) systemTextBox = (psComponentTextBox*)mainWindow->FindChild("SystemBox"); if ( chatTextBox == NULL ) chatTextBox = (psComponentTextBox*)mainWindow->FindChild("ChatBox"); if ( me->data->type == MSGTYPESYSTEM ) { psSystemMessage msg(me); if ( msg.msgline != "." ) { char buff[1024]; cs_snprintf(buff,1024,">%s",(const char *)msg.msgline); iPSEngine* psengine = CS_QUERY_REGISTRY (objreg, iPSEngine); int colour = psengine->GetG3D()->GetTextureManager()->FindRGB(204,194,12); psengine->DecRef(); systemTextBox->AddLine(buff, colour); } return; } psChatMessage msg(me); char* pType; char buff[1024]; msg.GetTypeText(pType); switch( msg.iChatType ) { case CHAT_GROUP: case CHAT_SHOUT: case CHAT_GUILD: case CHAT_AUCTION: { cs_snprintf(buff,1024,"%s from %s: %s\n",pType, (const char *)msg.sPerson,(const char *)msg.sText); break; } case CHAT_SAY: { cs_snprintf(buff,1024,"%s says: %s\n", (const char *)msg.sPerson,(const char *)msg.sText); break; } case CHAT_ME: { cs_snprintf(buff,1024,"%s %s\n", (const char *)msg.sPerson,(const char *)msg.sText); break; } case CHAT_TELL: { cs_snprintf(buff,1024,"%s tells you: %s\n", (const char *)msg.sPerson,(const char *)msg.sText); break; } default: { cs_snprintf(buff,1024,"Unknown Chat Type: %d\n",msg.iChatType); break; } } if ( buff[0] ) chatTextBox->AddLine(buff); } const char* psCommunicationWindow::HandleCommand( const char* cmd ) { char* buff = csStrNew(cmd); char* pPerson; char* pText; int chattype; if ( buff[0] != '/' ) { pPerson = ""; pText = buff; *(pText-1) = 0; chattype = CHAT_SAY; } else if ( !strncmp(buff+1, "say ", 4)) { pPerson = ""; pText = buff + 5; chattype = CHAT_SAY; } else if ( !strncmp(buff+1, "guild ", 6)) { pPerson = ""; pText = buff + 7; *(pText-1) = 0; chattype = CHAT_GUILD; } else if ( !strncmp(buff+1, "group ", 6) || !strncmp(buff+1, "shout ", 6)) { pPerson = ""; pText = buff + 7; *(pText-1) = 0; chattype = CHAT_SAY; } else if ( !strncmp(buff+1, "tell ", 5) ) { pPerson = buff + 6; pText = strchr(buff+6, ' ' ); if ( !pText ) pText = ""; else { pText++; *(pText-1) = 0; } chattype = CHAT_TELL; } else if ( !strncmp(buff+1, "auction ", 8)) { pPerson = ""; pText = buff + 9; *(pText-1) = 0; chattype = CHAT_AUCTION; } else if ( !strncmp(buff+1, "me ", 3)) { pPerson = ""; pText = buff + 4; *(pText-1) = 0; chattype = CHAT_ME; } else if ( !strncmp(buff+1, "admin", 5)) { delete[] buff; return "Not implemented yet"; } else if ( !strncmp(buff+1, "help", 4)) { delete[] buff; return "Valid commands: /say, /me, /shout, /group, /guild, " "/auction, /tell, /admin and /help"; } else { delete[] buff; return "Invalid command (use /help)"; } psChatMessage chat(0, pPerson, pText, chattype); msgqueue->SendMessage(chat.msg); delete[] buff; return NULL; } void psCommunicationWindow::SendLineToServer() { if ( systemTextBox == NULL ) systemTextBox = (psComponentTextBox*)mainWindow->FindChild("SystemBox"); if ( inputLine == NULL ) { inputLine = (psComponentCommandInput*)mainWindow->FindChild("ChatInput"); } iString *String; inputLine->GetProperty("Text", (void**)&String); inputLine->SetProperty("Text", new scfString("")); char* Str = String->GetData(); if ( Str && strcmp(Str,"") != 0 ) { if ( Str[0] != '/' ) { char* tmp = new char[strlen(Str)+7]; tmp[0] = '/'; tmp[1] = 's'; tmp[2] = 'a'; tmp[3] = 'y'; tmp[4] = ' '; strcpy(tmp+5, Str); const char* pErr = cmdsource->Publish(tmp); if ( pErr ) systemTextBox->AddLine(pErr); delete[] tmp; } else { const char* pErr = cmdsource->Publish(Str); if ( pErr ) systemTextBox->AddLine(pErr); } } } void psCommunicationWindow::SendToServer(void* sink, iAwsSource* src) { psCommunicationWindow* window = ( psCommunicationWindow*)sink; window->SendLineToServer(); } void psCommunicationWindow::CreateSink(iAws* aws) { sink = aws->GetSinkMgr()->CreateSink(this); sink->RegisterTrigger("SendLineToServer", &psCommunicationWindow::SendToServer); aws->GetSinkMgr()->RegisterSink("CommunicationWindow", sink); } bool psCommunicationWindow::Create(iAws* aws) { mainWindow = aws->CreateWindowFrom("Communication Window"); } --- NEW FILE: pscommwindow.h --- #ifndef PS_COMM_WINDOW #define PS_COMM_WINDOW #include <csutil/scf.h> #include <iutil/objreg.h> #include <iaws/aws.h> #include "interface/subscriber.h" #include "net/msghandler.h" #include "net/messages.h" #include "net/cmdbase.h" #include "pscomp.h" class CmdHandler; class psCommunicationWindow : public psCmdBase { public: SCF_DECLARE_IBASE; psCommunicationWindow(iObjectRegistry* obj); ~psCommunicationWindow(); virtual bool Setup(MsgHandler* mh, CmdHandler* ch); void HandleMessage(MsgEntry* me); const char* HandleCommand( const char* cmd ); void SendLineToServer(); bool Create(iAws* aws); void CreateSink(iAws* aws); // Sink functions static void SendToServer(void* sink, iAwsSource* source); iAwsWindow* mainWindow; protected: MsgHandler* msgHandler; CmdHandler* cmdHandler; iAwsSink* sink; psComponentTextBox* systemTextBox; psComponentTextBox* chatTextBox; psComponentCommandInput* inputLine; }; #endif --- NEW FILE: pscomp.cpp --- #include <config.h> #include <ctype.h> #include <iutil/objreg.h> #include <ivideo/txtmgr.h> #include <ivideo/fontserv.h> #include <iaws/awsdefs.h> #include <iaws/aws.h> #include "psaws.h" #include "pscomp.h" #include "iclient/psengine.h" SCF_IMPLEMENT_IBASE(psComponentTextBox) SCF_IMPLEMENTS_INTERFACE (iAwsComponent) SCF_IMPLEMENTS_INTERFACE (iBase) SCF_IMPLEMENT_IBASE_END psComponentTextBox::psComponentTextBox() { SCF_CONSTRUCT_IBASE (NULL); useScrollBar = false; //scrollBar = NULL; currentTopLine = 0; maxLines = 0; rowCountY = 0; lineHeight = 0; lineStart = 0; } psComponentTextBox::~psComponentTextBox() { } bool psComponentTextBox::Setup( iAws* wmgr, awsComponentNode* settings ) { if ( !awsEmbeddedComponent::Setup(wmgr, settings) ) return false; // Get the default font from the PS window manager iPSEngine* psengine = CS_QUERY_REGISTRY (wmgr->GetObjectRegistry(), iPSEngine); font = psengine->GetWindowManager()->GetDefaultFont(); psengine->DecRef(); defaultColour = wmgr->G3D()->GetTextureManager()->FindRGB(255,255,255); SetFlag(AWSF_CMP_ALWAYSERASE); int dummy; font->GetMaxSize(dummy, lineHeight); // Increase the line height a little bit lineHeight+=3; rowCountY = ( Frame().ymax - Frame().ymin ) / lineHeight; printf("Setup Complete!\n"); return true; } void psComponentTextBox::ScrollChanged( void* sk, iAwsSource* source ) { iAwsComponent* comp = source->GetComponent(); psComponentTextBox* tb = ( psComponentTextBox*)comp->Parent(); float *currVal = 0; comp->GetProperty("Value", (void**)&currVal); int change = 1; comp->SetProperty("Change", &change); tb->SetTopLine((int)*currVal); } void psComponentTextBox::SetText( const char* text, int colour ) { Clear(); AddLine(text, colour); currentTopLine = 0; } void psComponentTextBox::Clear() { while ( lines.Length() > 0 ) { delete lines[0]; lines.Delete(0); } } void psComponentTextBox::AddLine( const char* newText, int colour ) { if ( colour == -1 ) colour = defaultColour; while ( newText[0] != '\0' ) { size_t len = strcspn(newText, "\n"); unsigned int maxlen = font->GetLength(newText, Frame().Width()-16 ); // Only break line after a word if ( maxlen < len ) { len = maxlen; while ( !isspace(*(newText+len)) ) { if ( --len == 0 ) { len = maxlen+1; break; } } } AddSingleLine(newText, len, colour); if ( newText[len] == '\0' ) break; newText+=len+1; } } void psComponentTextBox::SetTopLine(int topLine) { currentTopLine = topLine; } void psComponentTextBox::AddSingleLine(const char* text, size_t size, int colour) { if ( lines.Length() > rowCountY ) useScrollBar = true; TextLine* newLine = new TextLine; newLine->text.Clear(); newLine->text.Append( text, size ); newLine->colour = colour; if ( newLine->text[size-1] == 13 ) newLine->text[size-1] = '\0'; else newLine->text[size] = '\0'; lines.Push(newLine); if ( lines.Length() > rowCountY ) currentTopLine++; iAwsComponent* sb = GetChildAt(0); if ( sb ) { int max = lines.Length()-rowCountY; if ( max < 0 ) max = 0; sb->SetProperty("Max", &max); } } void psComponentTextBox::OnDraw( csRect clip ) { int col = WindowManager()->G3D()->GetTextureManager()->FindRGB(255,0,0); WindowManager()->G2D()->DrawLine( Frame().xmin, Frame().ymin, Frame().xmax , Frame().ymin, col); WindowManager()->G2D()->DrawLine( Frame().xmin, Frame().ymin, Frame().xmin , Frame().ymax, col); WindowManager()->G2D()->DrawLine( Frame().xmax, Frame().ymin, Frame().xmax , Frame().ymax, col); WindowManager()->G2D()->DrawLine( Frame().xmin, Frame().ymax, Frame().xmax , Frame().ymax, col); // if ( useScrollBar ) // scrollBar->Show(); int i; int linePos = currentTopLine; if ( lines.Length() == 0 ) return; for ( i = 0; i < rowCountY; i++ ) { if ( lines.Length() > currentTopLine+i ) { WindowManager()->G2D()->Write( font, Frame().xmin , Frame().ymin+(i*lineHeight), lines[linePos]->colour, -1, (const char*)lines[linePos]->text); } linePos++; if ( linePos == currentTopLine ) break; } } void psComponentTextBox::OnAdded() { //AddChild(scrollBar, false); } SCF_IMPLEMENT_IBASE (psComponentTextBoxFactory) SCF_IMPLEMENTS_INTERFACE (iAwsComponentFactory) SCF_IMPLEMENTS_INTERFACE (iBase) SCF_IMPLEMENT_IBASE_END psComponentTextBoxFactory::psComponentTextBoxFactory ( iAws* mgr ) : awsEmbeddedComponentFactory(mgr) { SCF_CONSTRUCT_IBASE( NULL ); Register("PS TextBox"); } psComponentTextBoxFactory::~psComponentTextBoxFactory() { } iAwsComponent* psComponentTextBoxFactory::Create() { iAwsComponentFactory* fact = wmgr->FindComponentFactory("awsComponent"); iAwsComponent* comp = fact->Create(); psComponentTextBox* textBox = new psComponentTextBox(); textBox->Initialize(comp); comp->DecRef(); return textBox; } //------------------------------------------------------------------- SCF_IMPLEMENT_IBASE(psComponentCommandInput) SCF_IMPLEMENTS_INTERFACE (iAwsComponent) SCF_IMPLEMENTS_INTERFACE (iBase) SCF_IMPLEMENT_IBASE_END const int psComponentCommandInput::commandSent = 0xAC; psComponentCommandInput::psComponentCommandInput() { SCF_CONSTRUCT_IBASE (NULL); } psComponentCommandInput::~psComponentCommandInput() { } bool psComponentCommandInput::Setup( iAws* mgr, awsComponentNode* settings ) { if ( !awsEmbeddedComponent::Setup(mgr, settings) ) return false; return true; } bool psComponentCommandInput::OnKeypress( int key, int modifiers ) { if ( key == CSKEY_ENTER || key == 13 ) { Broadcast(commandSent); return true; } return awsEmbeddedComponent::OnKeypress(key, modifiers); } SCF_IMPLEMENT_IBASE (psComponentCommandInputFactory) SCF_IMPLEMENTS_INTERFACE (iAwsComponentFactory) SCF_IMPLEMENTS_INTERFACE (iBase) SCF_IMPLEMENT_IBASE_END psComponentCommandInputFactory::psComponentCommandInputFactory ( iAws* mgr ) : awsEmbeddedComponentFactory(mgr) { SCF_CONSTRUCT_IBASE( NULL ); Register("PS TextInput"); RegisterConstant("signalCommandSent", psComponentCommandInput::commandSent); } psComponentCommandInputFactory::~psComponentCommandInputFactory() { } iAwsComponent* psComponentCommandInputFactory::Create() { iAwsComponentFactory* fact = wmgr->FindComponentFactory("Text Box"); iAwsComponent* comp = fact->Create(); psComponentCommandInput* cmdIn = new psComponentCommandInput(); cmdIn->Initialize(comp); comp->DecRef(); return cmdIn; } --- NEW FILE: pscomp.h --- #ifndef PS_AWS_COMPONENTS #define PS_AWS_COMPONENTS #include <iaws/aws.h> #include <iaws/awsecomp.h> #include <csutil/garray.h> //------------------------------------------------------------------ // Planeshift Text Box struct iFont; struct TextLine { csString text; int colour; }; CS_TYPEDEF_GROWING_ARRAY(TextLineVector, TextLine*); class psComponentTextBox : public awsEmbeddedComponent { public: SCF_DECLARE_IBASE; psComponentTextBox(); ~psComponentTextBox(); virtual bool Setup( iAws* wmgr, awsComponentNode* settings ); virtual void OnAdded(); virtual void OnDraw( csRect clip ); void SetText( const char* line, int colour=-1 ); void AddLine( const char* line, int colour=-1 ); void SetTopLine( int topLine ); void Clear(); /// Trigger for catching scroll signals static void ScrollChanged ( void *sink, iAwsSource* source ); protected: public: void AddSingleLine( const char* text, size_t size, int colour ); iFont* font; TextLineVector lines; /// The max number of lines in widget before it rolls over int maxLines; int lineStart; /// Height of one character ( ie line height ) int lineHeight; /// Number of rows that can be drawn int rowCountY; /// True if the text will not fit in the current frame. bool useScrollBar; /// The current top line in view to draw int currentTopLine; /// The default colour to use if none given. int defaultColour; /// Holds the embedded scroll bar component iAwsComponent* scrollBar; /// The sink that gets scroll notifications iAwsSink* sink; /// The slot that handles scroll notifications iAwsSlot* slot; }; class psComponentTextBoxFactory : public awsEmbeddedComponentFactory { public: SCF_DECLARE_IBASE; psComponentTextBoxFactory(iAws* mgr); virtual ~psComponentTextBoxFactory(); iAwsComponent* Create(); }; /** A helper class because embedding the scroll bar does not seem * work very well. At least I cannot figure it out yet. */ class psTextBoxSink { public: psTextBoxSink(iAws* aws) { sink = aws->GetSinkMgr()->CreateSink(this); sink->RegisterTrigger("ScrollBarChanged", psComponentTextBox::ScrollChanged); aws->GetSinkMgr()->RegisterSink("psTextBoxSink", sink); } ~psTextBoxSink() { SCF_DEC_REF(sink); } protected: iAwsSink* sink; }; //------------------------------------------------------------------ class psComponentCommandInput : public awsEmbeddedComponent { public: SCF_DECLARE_IBASE; psComponentCommandInput(); ~psComponentCommandInput(); virtual bool Setup( iAws* wmgr, awsComponentNode* settings); virtual bool OnKeypress ( int key, int modifiers ); static const int commandSent; }; class psComponentCommandInputFactory : public awsEmbeddedComponentFactory { public: SCF_DECLARE_IBASE; psComponentCommandInputFactory(iAws* mgr); virtual ~psComponentCommandInputFactory(); iAwsComponent* Create(); }; //------------------------------------------------------------------ #endif Index: Makefile.am =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/aws/Makefile.am,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile.am 24 May 2002 00:37:08 -0000 1.1 --- Makefile.am 29 May 2002 22:25:30 -0000 1.2 *************** *** 6,13 **** CXXFLAGS+= @CS_CXXFLAGS@ -I$(CLIENTSRC) -I$(COMMONSRC) ! GUIBASEHEADERS = psaws.h libpsaws_la_LDFLAGS = ! libpsaws_la_SOURCES = psaws.cpp $(GUIBASEHEADERS) noinst_HEADERS = $(GUIBASEHEADERS) --- 6,14 ---- CXXFLAGS+= @CS_CXXFLAGS@ -I$(CLIENTSRC) -I$(COMMONSRC) ! GUIBASEHEADERS = psaws.h pscomp.h pscommwindow.h libpsaws_la_LDFLAGS = ! libpsaws_la_SOURCES = psaws.cpp pscomp.cpp pscommwindow.cpp \ ! $(GUIBASEHEADERS) noinst_HEADERS = $(GUIBASEHEADERS) Index: psaws.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/aws/psaws.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** psaws.cpp 24 May 2002 00:37:08 -0000 1.1 --- psaws.cpp 29 May 2002 22:25:30 -0000 1.2 *************** *** 7,11 **** --- 7,14 ---- // PS Includes + #include "iclient/psengine.h" #include "psaws.h" + #include "pscomp.h" + #include "pscommwindow.h" //------------------------------------------------------------------- *************** *** 16,23 **** --- 19,32 ---- awsCanvas = NULL; object_reg = NULL; + + commWindow = NULL; + textBoxSink = NULL; } psAwsManager::~psAwsManager() { + delete commWindow; + delete textBoxSink; + SCF_DEC_REF( g2d ); SCF_DEC_REF( g3d ); *************** *** 38,71 **** g3d = CS_QUERY_REGISTRY ( object_reg, iGraphics3D ); if ( !g3d ) - { - SCF_DEC_REF(aws); return false; - } g2d = g3d->GetDriver2D(); ! if ( !g2d ) ! { ! SCF_DEC_REF(g3d); ! SCF_DEC_REF(aws); return false; ! } g2d->IncRef(); awsCanvas = aws->CreateCustomCanvas(g2d, g3d); if ( !awsCanvas ) - { - SCF_DEC_REF(g2d); - SCF_DEC_REF(g3d); - SCF_DEC_REF(aws); return false; - } aws->SetFlag( AWSF_AlwaysRedrawWindows ); aws->SetCanvas( awsCanvas ); return true; } --- 47,163 ---- g3d = CS_QUERY_REGISTRY ( object_reg, iGraphics3D ); if ( !g3d ) return false; g2d = g3d->GetDriver2D(); ! if (!g2d) return false; ! g2d->IncRef(); awsCanvas = aws->CreateCustomCanvas(g2d, g3d); if ( !awsCanvas ) return false; aws->SetFlag( AWSF_AlwaysRedrawWindows ); aws->SetCanvas( awsCanvas ); + + /** + * ------------ Setup Font -------------- + */ + if ( !g2d->GetFontServer() ) + { + return false; + } + + defaultFont = g2d->GetFontServer()->LoadFont("/fonts/ttf/scurlock12.csf"); + if ( !defaultFont ) + { + defaultFont = g2d->GetFontServer()->LoadFont(CSFONT_COURIER); + if ( !defaultFont ) + return false; + } + switch ( g2d->GetWidth() ) + { + case 1024: + defaultFont->SetSize(10); + break; + case 800: + defaultFont->SetSize(9); + break; + case 640: + defaultFont->SetSize(8); + break; + } + /** + * ----------- Font Setup Complete --------- + */ + + RegisterCustomComponents(); + CreateSinks(); + + // Load in the def file. + aws->GetPrefMgr()->Load("/this/data/psgui.def"); + aws->GetPrefMgr()->SelectDefaultSkin("Normal Windows"); + + return true; } + void psAwsManager::Create(const char* window) + { + if ( strcmp(window, "Communication Window") == 0 ) + { + iPSEngine *psengine = CS_QUERY_REGISTRY (object_reg, iPSEngine); + MsgHandler* msg = psengine->GetMsgHandler(); + CmdHandler* ch = psengine->GetCmdHandler(); + psengine->DecRef(); + + // Setup the networking members. + commWindow->Setup(msg, ch); + commWindow->Create(aws); + } + else + { + printf("No window <%s> found!\n", window); + } + } + iAwsWindow* psAwsManager::GetWindow(const char* window ) + { + if ( strcmp(window, "Communication Window") == 0 ) + { + return commWindow->mainWindow; + } + else + { + printf("No window <%s> found!\n", window); + return NULL; + } + } + + + void psAwsManager::RegisterCustomComponents() + { + psComponentTextBoxFactory* fact = new psComponentTextBoxFactory(aws); + + aws->RegisterComponentFactory(fact, "PS TextBox"); + aws->DecRef(); + + psComponentCommandInputFactory* cmdInp = + new psComponentCommandInputFactory(aws); + + aws->RegisterComponentFactory(cmdInp, "PS TextInput"); + aws->DecRef(); + } + + + void psAwsManager::CreateSinks() + { + textBoxSink = new psTextBoxSink(aws); + + commWindow = new psCommunicationWindow(object_reg); + commWindow->CreateSink(aws); + } Index: psaws.h =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/aws/psaws.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** psaws.h 24 May 2002 00:37:08 -0000 1.1 --- psaws.h 29 May 2002 22:25:30 -0000 1.2 *************** *** 14,18 **** --- 14,27 ---- struct iAws; + struct iFont; + + class psCommunicationWindow; + + /** This is a temp hack until I can figure out how to correctlu embed + * components into our own custom components. Ie this sink should be part + * of the psTextBox class but it doesn't seem to work. + */ + class psTextBoxSink; /// General PS window manager *************** *** 29,33 **** --- 38,64 ---- bool Setup( iObjectRegistry* objectReg ); + /// Get the default font that all windows should use. + iFont* GetDefaultFont() { return defaultFont; } + + /// Create a new window + void Create(const char* window); + + /// Get the main AWS object + iAws* GetAws() { return aws; } + + /// Get a particular window ( the iAws Window ) + iAwsWindow* GetWindow(const char* name); + + /// The communication window for system and chat messages/input + psCommunicationWindow* commWindow; + + protected: + /// Register any custom components that we have. + void RegisterCustomComponents(); + + /// Create any sinks that we need. + void CreateSinks(); + iObjectRegistry* object_reg; *************** *** 43,46 **** --- 74,87 ---- /// 2D graphics driver. iGraphics2D *g2d; + + /// The default font to use + iFont* defaultFont; + + /// Default Font colour + int defaultColour; + + /// Temp hack to have a sink for the textboxes + psTextBoxSink* textBoxSink; + }; |