From: Manuel A. F. M. <ma...@us...> - 2005-06-30 19:08:33
|
Update of /cvsroot/once/oncecode/src/client/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26239/gui Modified Files: pawsentityslot.h pawsentityslot.cpp Log Message: Formatting changes and a couple of new lines to avoid warnings in the compiler Index: pawsentityslot.h =================================================================== RCS file: /cvsroot/once/oncecode/src/client/gui/pawsentityslot.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pawsentityslot.h 16 Jun 2005 20:50:41 -0000 1.1 --- pawsentityslot.h 30 Jun 2005 19:08:17 -0000 1.2 *************** *** 26,33 **** class pawsTextBox; - class pawsEntitySlot : public pawsWidget { ! public: pawsEntitySlot(PawsManager* manager); ~pawsEntitySlot(); --- 26,32 ---- class pawsTextBox; class pawsEntitySlot : public pawsWidget { ! public: pawsEntitySlot(PawsManager* manager); ~pawsEntitySlot(); *************** *** 43,64 **** void Fill(csString name, csString type, int count); ! int GetID() { return slotID;} ! void SetID(int id) {slotID = id;} ! void SetContainerID(int newID) { containerID = newID;} ! int GetContainerID() { return containerID;} ! csString GetType() { return entityType;} ! void SetType(csString entType) { entityType = entType;} ! bool IsEmpty() {return empty;} ! void SetStackCount(int cnt) { stackCount = cnt;} ! int GetStackCount() { return stackCount;} ! pawsImage* GetImage() { return entityImage;} const char* GetImageName(); ! protected: csString entityType; pawsImage* entityImage; --- 42,63 ---- void Fill(csString name, csString type, int count); ! int GetID() { return slotID; } ! void SetID(int id) { slotID = id; } ! int GetContainerID() { return containerID; } ! void SetContainerID(int newID) { containerID = newID; } ! csString GetType() { return entityType; } ! void SetType(csString entType) { entityType = entType; } ! bool IsEmpty() { return empty; } ! int GetStackCount() { return stackCount; } ! void SetStackCount(int cnt) { stackCount = cnt; } ! pawsImage* GetImage() { return entityImage; } const char* GetImageName(); ! protected: csString entityType; pawsImage* entityImage; *************** *** 73,80 **** bool empty; bool showCount; - }; ! CREATE_PAWS_FACTORY( pawsEntitySlot ); ! #endif \ No newline at end of file --- 72,78 ---- bool empty; bool showCount; }; ! CREATE_PAWS_FACTORY(pawsEntitySlot); ! #endif Index: pawsentityslot.cpp =================================================================== RCS file: /cvsroot/once/oncecode/src/client/gui/pawsentityslot.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pawsentityslot.cpp 16 Jun 2005 20:50:41 -0000 1.1 --- pawsentityslot.cpp 30 Jun 2005 19:08:17 -0000 1.2 *************** *** 24,46 **** ! pawsEntitySlot::pawsEntitySlot(PawsManager *manager) ! :pawsWidget(manager) { empty = true; containerID = -100; ! slotID=0; entityType = "none"; ! SetRelativeFrame( 0,0, GetActualWidth(48), GetActualHeight(48) ); ! entityImage = new pawsImage( manager->GetObjectRegistry() ); ! stackCountLabel = (pawsTextBox*)WindowManager()->CreateWidget( "pawsTextBox" ); AddChild(stackCountLabel); stackCountLabel->SetAlwaysOnTop(true); ! stackCountLabel->SetRelativeFrame( 8, 8, 40, 20 ); ! stackCountLabel->SetFont(NULL,8); ! stackCountLabel->SetColour( graphics2D->FindRGB(0,255,0) ); ! stackCountLabel->Hide(); SetStackCount(0); --- 24,46 ---- ! pawsEntitySlot::pawsEntitySlot(PawsManager *manager) : ! pawsWidget(manager) { empty = true; containerID = -100; ! slotID = 0; entityType = "none"; ! SetRelativeFrame(0, 0, GetActualWidth(48), GetActualHeight(48)); ! entityImage = new pawsImage(manager->GetObjectRegistry()); ! stackCountLabel = (pawsTextBox*) WindowManager()->CreateWidget("pawsTextBox"); AddChild(stackCountLabel); stackCountLabel->SetAlwaysOnTop(true); ! stackCountLabel->SetRelativeFrame(8, 8, 40, 20); ! stackCountLabel->SetFont(NULL, 8); ! stackCountLabel->SetColour(graphics2D->FindRGB(0, 255, 0)); ! stackCountLabel->Hide(); SetStackCount(0); *************** *** 48,66 **** } ! pawsEntitySlot::~pawsEntitySlot(){ delete entityImage; } ! void pawsEntitySlot::Fill(csString imageName, csString type, int count ) { empty = false; entityType = type; // Should be below, thus each item can have unique icon ! // psImageDescription* img = ! //windowManager->GetTextureManager()->GetImageDescription( imageName ); // Sets default icon psImageDescription* img = windowManager->GetTextureManager()->GetImageDescription("Default Item Icon"); ! entityImage->Description( img ); //SetToolTip(imageName); SetToolTip("An Item"); --- 48,68 ---- } ! pawsEntitySlot::~pawsEntitySlot() ! { delete entityImage; } ! void pawsEntitySlot::Fill(csString imageName, csString type, int count) ! { empty = false; entityType = type; // Should be below, thus each item can have unique icon ! // psImageDescription* img = ! //windowManager->GetTextureManager()->GetImageDescription( imageName ); // Sets default icon psImageDescription* img = windowManager->GetTextureManager()->GetImageDescription("Default Item Icon"); ! entityImage->Description( img ); //SetToolTip(imageName); SetToolTip("An Item"); *************** *** 69,76 **** stackCountLabel->Show(); ! stackCount = count; } ! void pawsEntitySlot::DrawCount() { if (showCount) stackCountLabel->Show(); --- 71,79 ---- stackCountLabel->Show(); ! stackCount = count; } ! void pawsEntitySlot::DrawCount() ! { if (showCount) stackCountLabel->Show(); *************** *** 79,128 **** } ! void pawsEntitySlot::Clear() { ! empty = true; ! stackCount = 0; ! stackCountLabel->Hide(); } ! void pawsEntitySlot::Draw() { if (!showCount && stackCountLabel->IsVisible()) ! stackCountLabel->Hide(); ! pawsWidget::Draw(); ! ClipToParent(); ! csRect frame = screenFrame; ! frame.SetSize(36,36); ! frame.Move(4,4); ! if (!empty) ! { ! entityImage->Draw( frame ); ! if (showCount) ! stackCountLabel->Draw(); ! } ! graphics2D->SetClipRect( 0,0, graphics2D->GetWidth(), graphics2D->GetHeight()); } ! void pawsEntitySlot::SetToolTip(const char* text) { ! pawsWidget::SetToolTip( text ); ! stackCountLabel->SetToolTip( text ); } ! bool pawsEntitySlot::OnMouseDown(int button, int modifiers, int x, int y){ ! if ( parent ) ! return parent->OnMouseDown(button, modifiers, x, y); ! else ! return pawsWidget::OnMouseDown(button, modifiers, x, y ); } const char* pawsEntitySlot::GetImageName() { ! if (entityImage->GetDescription() != NULL) ! return entityImage->GetDescription()->resourceName; ! return NULL; } ! bool pawsEntitySlot::PostSetup(){ return true; ! } \ No newline at end of file --- 82,136 ---- } ! void pawsEntitySlot::Clear() ! { ! empty = true; ! stackCount = 0; ! stackCountLabel->Hide(); } ! void pawsEntitySlot::Draw() ! { if (!showCount && stackCountLabel->IsVisible()) ! stackCountLabel->Hide(); ! pawsWidget::Draw(); ! ClipToParent(); ! csRect frame = screenFrame; ! frame.SetSize(36, 36); ! frame.Move(4, 4); ! if (!empty) ! { ! entityImage->Draw(frame); ! if (showCount) ! stackCountLabel->Draw(); ! } ! graphics2D->SetClipRect( 0,0, graphics2D->GetWidth(), graphics2D->GetHeight()); } ! void pawsEntitySlot::SetToolTip(const char* text) ! { ! pawsWidget::SetToolTip(text); ! stackCountLabel->SetToolTip(text); } ! bool pawsEntitySlot::OnMouseDown(int button, int modifiers, int x, int y) ! { ! if (parent) ! return parent->OnMouseDown(button, modifiers, x, y); ! else ! return pawsWidget::OnMouseDown(button, modifiers, x, y); } const char* pawsEntitySlot::GetImageName() { ! if (entityImage->GetDescription() != NULL) ! return entityImage->GetDescription()->resourceName; ! return NULL; } ! bool pawsEntitySlot::PostSetup() ! { return true; ! } |