1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-19 19:59:09 +00:00

Change all CRLF-text files to LF-text files

to match H'uru for patching
This commit is contained in:
rarified
2021-01-28 12:08:00 -07:00
parent 6ae3df25f5
commit a553708b5b
3385 changed files with 1112046 additions and 1112046 deletions

View File

@ -1,408 +1,408 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIButtonMod Definition //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIButtonMod.h"
#include "pfGUIDraggableMod.h"
#include "pfGameGUIMgr.h"
#include "pfGUIControlHandlers.h"
#include "pfGUIDialogMod.h"
#include "../plInputCore/plInputInterface.h"
#include "../pnMessage/plRefMsg.h"
#include "../pfMessage/pfGameGUIMsg.h"
#include "../plMessage/plAnimCmdMsg.h"
#include "../plAvatar/plAGModifier.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Control Proc For Managing the Draggable /////////////////////////////////
class pfGUIButtonDragProc : public pfGUICtrlProcObject
{
protected:
pfGUICtrlProcObject *fOrigProc;
pfGUIButtonMod *fParent;
pfGUIDraggableMod *fDraggable;
hsBool fReportDrag;
public:
pfGUIButtonDragProc( pfGUIButtonMod *parent, pfGUIDraggableMod *draggable, pfGUICtrlProcObject *origProc, hsBool reportDrag )
{
fParent = parent;
fDraggable = draggable;
fOrigProc = origProc;
fReportDrag = reportDrag;
}
virtual void DoSomething( pfGUIControlMod *ctrl )
{
// The draggable was let up, so now we stop dragging, disable the draggable again, and pass
// on the event to our original proc
if( fOrigProc != nil && fParent->IsTriggering() )
fOrigProc->DoSomething( ctrl );
if (!fParent->IsButtonDown())
fParent->StopDragging( false );
}
virtual void HandleExtendedEvent( pfGUIControlMod *ctrl, UInt32 event )
{
if( event == pfGUIDraggableMod::kDragging )
{
// First test if we're inside our button (if so, we stop dragging)
if( fParent->PointInBounds( fDraggable->GetLastMousePt() ) )
{
// Cancel the drag
fParent->StopDragging( true );
return;
}
if( !fReportDrag )
return;
}
if( fOrigProc != nil )
fOrigProc->HandleExtendedEvent( ctrl, event );
}
virtual void UserCallback( UInt32 userValue )
{
if( fOrigProc != nil )
fOrigProc->UserCallback( userValue );
}
};
void pfGUIButtonMod::StopDragging( hsBool cancel )
{
fDraggable->StopDragging( cancel );
fDraggable->SetVisible( false );
fDraggable->SetHandler( fOrigHandler );
fOrigHandler = nil;
if( !fOrigReportedDrag )
fDraggable->ClearFlag( pfGUIDraggableMod::kReportDragging );
// Steal interest back
fDialog->SetControlOfInterest( this );
}
void pfGUIButtonMod::StartDragging( void )
{
fOrigReportedDrag = fDraggable->HasFlag( pfGUIDraggableMod::kReportDragging );
fDraggable->SetFlag( pfGUIDraggableMod::kReportDragging );
fOrigHandler = fDraggable->GetHandler();
fDraggable->SetVisible( true );
fDraggable->SetHandler( TRACKED_NEW pfGUIButtonDragProc( this, fDraggable, fOrigHandler, fOrigReportedDrag ) );
fDraggable->HandleMouseDown( fOrigMouseDownPt, 0 );
}
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIButtonMod::pfGUIButtonMod()
{
fAnimName = nil;
fMouseOverAnimName = nil;
fDraggable = nil;
fOrigHandler = nil;
fClicking = false;
fTriggering = false;
fNotifyType = kNotifyOnUp;
SetFlag( kWantsInterest );
}
pfGUIButtonMod::~pfGUIButtonMod()
{
delete [] fAnimName;
delete [] fMouseOverAnimName;
}
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIButtonMod::IEval( double secs, hsScalar del, UInt32 dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
//// MsgReceive //////////////////////////////////////////////////////////////
hsBool pfGUIButtonMod::MsgReceive( plMessage *msg )
{
plGenRefMsg *refMsg = plGenRefMsg::ConvertNoRef( msg );
if( refMsg != nil && refMsg->fType == kRefDraggable )
{
if( refMsg->GetContext() & ( plRefMsg::kOnCreate | plRefMsg::kOnRequest | plRefMsg::kOnReplace ) )
{
fDraggable = pfGUIDraggableMod::ConvertNoRef( refMsg->GetRef() );
fDraggable->SetVisible( false ); // Disable until we're dragging
}
else
fDraggable = nil;
return true;
}
return pfGUIControlMod::MsgReceive( msg );
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUIButtonMod::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Read(s, mgr);
fAnimationKeys.Reset();
UInt32 i, count = s->ReadSwap32();
for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) );
fAnimName = s->ReadSafeString();
fMouseOverAnimKeys.Reset();
count = s->ReadSwap32();
for( i = 0; i < count; i++ )
fMouseOverAnimKeys.Append( mgr->ReadKey( s ) );
fMouseOverAnimName = s->ReadSafeString();
fNotifyType = s->ReadSwap32();
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDraggable ), plRefFlags::kActiveRef );
}
void pfGUIButtonMod::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Write( s, mgr );
UInt32 i, count = fAnimationKeys.GetCount();
s->WriteSwap32( count );
for( i = 0; i < count; i++ )
mgr->WriteKey( s, fAnimationKeys[ i ] );
s->WriteSafeString( fAnimName );
count = fMouseOverAnimKeys.GetCount();
s->WriteSwap32( count );
for( i = 0; i < count; i++ )
mgr->WriteKey( s, fMouseOverAnimKeys[ i ] );
s->WriteSafeString( fMouseOverAnimName );
s->WriteSwap32( fNotifyType );
mgr->WriteKey( s, fDraggable != nil ? fDraggable->GetKey() : nil );
}
//// UpdateBounds ////////////////////////////////////////////////////////////
void pfGUIButtonMod::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool force )
{
pfGUIControlMod::UpdateBounds( invXformMatrix, force );
if( fAnimationKeys.GetCount() > 0 || fMouseOverAnimKeys.GetCount() > 0 )
fBoundsValid = false;
}
//// HandleMouseDown/Up //////////////////////////////////////////////////////
void pfGUIButtonMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
{
fClicking = true;
if( fAnimationKeys.GetCount() > 0 )
{
plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg();
msg->SetCmd( plAnimCmdMsg::kContinue );
msg->SetCmd( plAnimCmdMsg::kSetForewards );
msg->SetCmd( plAnimCmdMsg::kGoToBegin );
msg->SetAnimName( fAnimName );
msg->AddReceivers( fAnimationKeys );
plgDispatch::MsgSend( msg );
}
IPlaySound( kMouseDown );
fOrigMouseDownPt = mousePt;
if ( fNotifyType == kNotifyOnDown || fNotifyType == kNotifyOnUpAndDown)
{
fTriggering = true;
DoSomething();
fTriggering = false;
}
}
void pfGUIButtonMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
{
// make sure that we got the down click first
if ( !fClicking )
return;
fClicking = false;
if( fAnimationKeys.GetCount() > 0 )
{
plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg();
msg->SetCmd( plAnimCmdMsg::kContinue );
msg->SetCmd( plAnimCmdMsg::kSetBackwards );
msg->SetCmd( plAnimCmdMsg::kGoToEnd );
msg->SetAnimName( fAnimName );
msg->AddReceivers( fAnimationKeys );
plgDispatch::MsgSend( msg );
}
IPlaySound( kMouseUp );
// Don't run the command if the mouse is outside our bounds
if( !fBounds.IsInside( &mousePt ) && fNotifyType != kNotifyOnUpAndDown )
return;
if ( fNotifyType == kNotifyOnUp || fNotifyType == kNotifyOnUpAndDown)
fTriggering = true;
DoSomething();
fTriggering = false;
}
void pfGUIButtonMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
{
if( !fClicking )
return;
if( fDraggable == nil )
return;
if( !fDraggable->IsVisible() )
{
// Are we outside ourselves?
if( !PointInBounds( mousePt ) )
{
// Yes, start dragging
StartDragging();
// Hand off our interest to the draggable
fDialog->SetControlOfInterest( fDraggable );
}
}
}
void pfGUIButtonMod::SetNotifyType(Int32 kind)
{
fNotifyType = kind;
}
Int32 pfGUIButtonMod::GetNotifyType()
{
return fNotifyType;
}
hsBool pfGUIButtonMod::IsButtonDown()
{
return fClicking;
}
//// SetInteresting //////////////////////////////////////////////////////////
// Overridden to play mouse over animation when we're interesting
void pfGUIButtonMod::SetInteresting( hsBool i )
{
pfGUIControlMod::SetInteresting( i );
if( fMouseOverAnimKeys.GetCount() )
{
plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg();
msg->SetCmd( plAnimCmdMsg::kContinue );
msg->SetCmd( fInteresting ? plAnimCmdMsg::kSetForewards : plAnimCmdMsg::kSetBackwards );
msg->SetAnimName( fMouseOverAnimName );
msg->AddReceivers( fMouseOverAnimKeys );
plgDispatch::MsgSend( msg );
}
if( i )
IPlaySound( kMouseOver );
else
IPlaySound( kMouseOff );
}
void pfGUIButtonMod::SetAnimationKeys( hsTArray<plKey> &keys, const char *name )
{
fAnimationKeys = keys;
delete [] fAnimName;
if( name != nil )
{
fAnimName = TRACKED_NEW char[ strlen( name ) + 1 ];
strcpy( fAnimName, name );
}
else
fAnimName = nil;
}
void pfGUIButtonMod::SetMouseOverAnimKeys( hsTArray<plKey> &keys, const char *name )
{
fMouseOverAnimKeys = keys;
delete [] fMouseOverAnimName;
if( name != nil )
{
fMouseOverAnimName = TRACKED_NEW char[ strlen( name ) + 1 ];
strcpy( fMouseOverAnimName, name );
}
else
fMouseOverAnimName = nil;
}
//// IGetDesiredCursor ///////////////////////////////////////////////////////
UInt32 pfGUIButtonMod::IGetDesiredCursor( void ) const
{
if( fHandler == nil )
return 0;
if( fClicking )
return plInputInterface::kCursorClicked;
return plInputInterface::kCursorPoised;
}
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIButtonMod Definition //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIButtonMod.h"
#include "pfGUIDraggableMod.h"
#include "pfGameGUIMgr.h"
#include "pfGUIControlHandlers.h"
#include "pfGUIDialogMod.h"
#include "../plInputCore/plInputInterface.h"
#include "../pnMessage/plRefMsg.h"
#include "../pfMessage/pfGameGUIMsg.h"
#include "../plMessage/plAnimCmdMsg.h"
#include "../plAvatar/plAGModifier.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Control Proc For Managing the Draggable /////////////////////////////////
class pfGUIButtonDragProc : public pfGUICtrlProcObject
{
protected:
pfGUICtrlProcObject *fOrigProc;
pfGUIButtonMod *fParent;
pfGUIDraggableMod *fDraggable;
hsBool fReportDrag;
public:
pfGUIButtonDragProc( pfGUIButtonMod *parent, pfGUIDraggableMod *draggable, pfGUICtrlProcObject *origProc, hsBool reportDrag )
{
fParent = parent;
fDraggable = draggable;
fOrigProc = origProc;
fReportDrag = reportDrag;
}
virtual void DoSomething( pfGUIControlMod *ctrl )
{
// The draggable was let up, so now we stop dragging, disable the draggable again, and pass
// on the event to our original proc
if( fOrigProc != nil && fParent->IsTriggering() )
fOrigProc->DoSomething( ctrl );
if (!fParent->IsButtonDown())
fParent->StopDragging( false );
}
virtual void HandleExtendedEvent( pfGUIControlMod *ctrl, UInt32 event )
{
if( event == pfGUIDraggableMod::kDragging )
{
// First test if we're inside our button (if so, we stop dragging)
if( fParent->PointInBounds( fDraggable->GetLastMousePt() ) )
{
// Cancel the drag
fParent->StopDragging( true );
return;
}
if( !fReportDrag )
return;
}
if( fOrigProc != nil )
fOrigProc->HandleExtendedEvent( ctrl, event );
}
virtual void UserCallback( UInt32 userValue )
{
if( fOrigProc != nil )
fOrigProc->UserCallback( userValue );
}
};
void pfGUIButtonMod::StopDragging( hsBool cancel )
{
fDraggable->StopDragging( cancel );
fDraggable->SetVisible( false );
fDraggable->SetHandler( fOrigHandler );
fOrigHandler = nil;
if( !fOrigReportedDrag )
fDraggable->ClearFlag( pfGUIDraggableMod::kReportDragging );
// Steal interest back
fDialog->SetControlOfInterest( this );
}
void pfGUIButtonMod::StartDragging( void )
{
fOrigReportedDrag = fDraggable->HasFlag( pfGUIDraggableMod::kReportDragging );
fDraggable->SetFlag( pfGUIDraggableMod::kReportDragging );
fOrigHandler = fDraggable->GetHandler();
fDraggable->SetVisible( true );
fDraggable->SetHandler( TRACKED_NEW pfGUIButtonDragProc( this, fDraggable, fOrigHandler, fOrigReportedDrag ) );
fDraggable->HandleMouseDown( fOrigMouseDownPt, 0 );
}
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIButtonMod::pfGUIButtonMod()
{
fAnimName = nil;
fMouseOverAnimName = nil;
fDraggable = nil;
fOrigHandler = nil;
fClicking = false;
fTriggering = false;
fNotifyType = kNotifyOnUp;
SetFlag( kWantsInterest );
}
pfGUIButtonMod::~pfGUIButtonMod()
{
delete [] fAnimName;
delete [] fMouseOverAnimName;
}
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIButtonMod::IEval( double secs, hsScalar del, UInt32 dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
//// MsgReceive //////////////////////////////////////////////////////////////
hsBool pfGUIButtonMod::MsgReceive( plMessage *msg )
{
plGenRefMsg *refMsg = plGenRefMsg::ConvertNoRef( msg );
if( refMsg != nil && refMsg->fType == kRefDraggable )
{
if( refMsg->GetContext() & ( plRefMsg::kOnCreate | plRefMsg::kOnRequest | plRefMsg::kOnReplace ) )
{
fDraggable = pfGUIDraggableMod::ConvertNoRef( refMsg->GetRef() );
fDraggable->SetVisible( false ); // Disable until we're dragging
}
else
fDraggable = nil;
return true;
}
return pfGUIControlMod::MsgReceive( msg );
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUIButtonMod::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Read(s, mgr);
fAnimationKeys.Reset();
UInt32 i, count = s->ReadSwap32();
for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) );
fAnimName = s->ReadSafeString();
fMouseOverAnimKeys.Reset();
count = s->ReadSwap32();
for( i = 0; i < count; i++ )
fMouseOverAnimKeys.Append( mgr->ReadKey( s ) );
fMouseOverAnimName = s->ReadSafeString();
fNotifyType = s->ReadSwap32();
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDraggable ), plRefFlags::kActiveRef );
}
void pfGUIButtonMod::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Write( s, mgr );
UInt32 i, count = fAnimationKeys.GetCount();
s->WriteSwap32( count );
for( i = 0; i < count; i++ )
mgr->WriteKey( s, fAnimationKeys[ i ] );
s->WriteSafeString( fAnimName );
count = fMouseOverAnimKeys.GetCount();
s->WriteSwap32( count );
for( i = 0; i < count; i++ )
mgr->WriteKey( s, fMouseOverAnimKeys[ i ] );
s->WriteSafeString( fMouseOverAnimName );
s->WriteSwap32( fNotifyType );
mgr->WriteKey( s, fDraggable != nil ? fDraggable->GetKey() : nil );
}
//// UpdateBounds ////////////////////////////////////////////////////////////
void pfGUIButtonMod::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool force )
{
pfGUIControlMod::UpdateBounds( invXformMatrix, force );
if( fAnimationKeys.GetCount() > 0 || fMouseOverAnimKeys.GetCount() > 0 )
fBoundsValid = false;
}
//// HandleMouseDown/Up //////////////////////////////////////////////////////
void pfGUIButtonMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
{
fClicking = true;
if( fAnimationKeys.GetCount() > 0 )
{
plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg();
msg->SetCmd( plAnimCmdMsg::kContinue );
msg->SetCmd( plAnimCmdMsg::kSetForewards );
msg->SetCmd( plAnimCmdMsg::kGoToBegin );
msg->SetAnimName( fAnimName );
msg->AddReceivers( fAnimationKeys );
plgDispatch::MsgSend( msg );
}
IPlaySound( kMouseDown );
fOrigMouseDownPt = mousePt;
if ( fNotifyType == kNotifyOnDown || fNotifyType == kNotifyOnUpAndDown)
{
fTriggering = true;
DoSomething();
fTriggering = false;
}
}
void pfGUIButtonMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
{
// make sure that we got the down click first
if ( !fClicking )
return;
fClicking = false;
if( fAnimationKeys.GetCount() > 0 )
{
plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg();
msg->SetCmd( plAnimCmdMsg::kContinue );
msg->SetCmd( plAnimCmdMsg::kSetBackwards );
msg->SetCmd( plAnimCmdMsg::kGoToEnd );
msg->SetAnimName( fAnimName );
msg->AddReceivers( fAnimationKeys );
plgDispatch::MsgSend( msg );
}
IPlaySound( kMouseUp );
// Don't run the command if the mouse is outside our bounds
if( !fBounds.IsInside( &mousePt ) && fNotifyType != kNotifyOnUpAndDown )
return;
if ( fNotifyType == kNotifyOnUp || fNotifyType == kNotifyOnUpAndDown)
fTriggering = true;
DoSomething();
fTriggering = false;
}
void pfGUIButtonMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
{
if( !fClicking )
return;
if( fDraggable == nil )
return;
if( !fDraggable->IsVisible() )
{
// Are we outside ourselves?
if( !PointInBounds( mousePt ) )
{
// Yes, start dragging
StartDragging();
// Hand off our interest to the draggable
fDialog->SetControlOfInterest( fDraggable );
}
}
}
void pfGUIButtonMod::SetNotifyType(Int32 kind)
{
fNotifyType = kind;
}
Int32 pfGUIButtonMod::GetNotifyType()
{
return fNotifyType;
}
hsBool pfGUIButtonMod::IsButtonDown()
{
return fClicking;
}
//// SetInteresting //////////////////////////////////////////////////////////
// Overridden to play mouse over animation when we're interesting
void pfGUIButtonMod::SetInteresting( hsBool i )
{
pfGUIControlMod::SetInteresting( i );
if( fMouseOverAnimKeys.GetCount() )
{
plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg();
msg->SetCmd( plAnimCmdMsg::kContinue );
msg->SetCmd( fInteresting ? plAnimCmdMsg::kSetForewards : plAnimCmdMsg::kSetBackwards );
msg->SetAnimName( fMouseOverAnimName );
msg->AddReceivers( fMouseOverAnimKeys );
plgDispatch::MsgSend( msg );
}
if( i )
IPlaySound( kMouseOver );
else
IPlaySound( kMouseOff );
}
void pfGUIButtonMod::SetAnimationKeys( hsTArray<plKey> &keys, const char *name )
{
fAnimationKeys = keys;
delete [] fAnimName;
if( name != nil )
{
fAnimName = TRACKED_NEW char[ strlen( name ) + 1 ];
strcpy( fAnimName, name );
}
else
fAnimName = nil;
}
void pfGUIButtonMod::SetMouseOverAnimKeys( hsTArray<plKey> &keys, const char *name )
{
fMouseOverAnimKeys = keys;
delete [] fMouseOverAnimName;
if( name != nil )
{
fMouseOverAnimName = TRACKED_NEW char[ strlen( name ) + 1 ];
strcpy( fMouseOverAnimName, name );
}
else
fMouseOverAnimName = nil;
}
//// IGetDesiredCursor ///////////////////////////////////////////////////////
UInt32 pfGUIButtonMod::IGetDesiredCursor( void ) const
{
if( fHandler == nil )
return 0;
if( fClicking )
return plInputInterface::kCursorClicked;
return plInputInterface::kCursorPoised;
}

View File

@ -1,137 +1,137 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIButtonMod Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIButtonMod_h
#define _pfGUIButtonMod_h
#include "pfGUIControlMod.h"
class plMessage;
class plPostEffectMod;
class plAGMasterMod;
class pfGUIDraggableMod;
class pfGUIButtonMod : public pfGUIControlMod
{
protected:
hsTArray<plKey> fAnimationKeys;
char *fAnimName;
hsTArray<plKey> fMouseOverAnimKeys;
char *fMouseOverAnimName;
hsBool fClicking;
hsBool fTriggering;
hsPoint3 fOrigMouseDownPt;
pfGUIDraggableMod *fDraggable;
pfGUICtrlProcObject *fOrigHandler;
hsBool fOrigReportedDrag;
Int32 fNotifyType;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual UInt32 IGetDesiredCursor( void ) const; // As specified in plInputInterface.h
public:
pfGUIButtonMod();
virtual ~pfGUIButtonMod();
CLASSNAME_REGISTER( pfGUIButtonMod );
GETINTERFACE_ANY( pfGUIButtonMod, pfGUIControlMod );
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void SetInteresting( hsBool i );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false );
virtual void SetNotifyType(Int32 kind);
virtual Int32 GetNotifyType();
virtual hsBool IsButtonDown();
virtual hsBool IsTriggering() { return fTriggering; }
enum SoundEvents
{
kMouseDown,
kMouseUp,
kMouseOver,
kMouseOff
};
enum
{
kRefDraggable = kRefDerivedStart
};
enum NotifyType
{
kNotifyOnUp = 0,
kNotifyOnDown,
kNotifyOnUpAndDown
};
void StartDragging( void );
void StopDragging( hsBool cancel );
// Export only
void SetAnimationKeys( hsTArray<plKey> &keys, const char *name );
void SetMouseOverAnimKeys( hsTArray<plKey> &keys, const char *name );
};
#endif // _pfGUIButtonMod_h
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIButtonMod Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIButtonMod_h
#define _pfGUIButtonMod_h
#include "pfGUIControlMod.h"
class plMessage;
class plPostEffectMod;
class plAGMasterMod;
class pfGUIDraggableMod;
class pfGUIButtonMod : public pfGUIControlMod
{
protected:
hsTArray<plKey> fAnimationKeys;
char *fAnimName;
hsTArray<plKey> fMouseOverAnimKeys;
char *fMouseOverAnimName;
hsBool fClicking;
hsBool fTriggering;
hsPoint3 fOrigMouseDownPt;
pfGUIDraggableMod *fDraggable;
pfGUICtrlProcObject *fOrigHandler;
hsBool fOrigReportedDrag;
Int32 fNotifyType;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual UInt32 IGetDesiredCursor( void ) const; // As specified in plInputInterface.h
public:
pfGUIButtonMod();
virtual ~pfGUIButtonMod();
CLASSNAME_REGISTER( pfGUIButtonMod );
GETINTERFACE_ANY( pfGUIButtonMod, pfGUIControlMod );
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void SetInteresting( hsBool i );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false );
virtual void SetNotifyType(Int32 kind);
virtual Int32 GetNotifyType();
virtual hsBool IsButtonDown();
virtual hsBool IsTriggering() { return fTriggering; }
enum SoundEvents
{
kMouseDown,
kMouseUp,
kMouseOver,
kMouseOff
};
enum
{
kRefDraggable = kRefDerivedStart
};
enum NotifyType
{
kNotifyOnUp = 0,
kNotifyOnDown,
kNotifyOnUpAndDown
};
void StartDragging( void );
void StopDragging( hsBool cancel );
// Export only
void SetAnimationKeys( hsTArray<plKey> &keys, const char *name );
void SetMouseOverAnimKeys( hsTArray<plKey> &keys, const char *name );
};
#endif // _pfGUIButtonMod_h

View File

@ -1,222 +1,222 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUICheckBoxCtrl Definition //
// //
// Almost like buttons, only they keep their stated (pressed/unpressed) //
// when you click them, instead of reverting on mouse up. //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUICheckBoxCtrl.h"
#include "pfGameGUIMgr.h"
#include "../plInputCore/plInputInterface.h"
#include "../pnMessage/plRefMsg.h"
#include "../pfMessage/pfGameGUIMsg.h"
#include "../plMessage/plAnimCmdMsg.h"
#include "../plAvatar/plAGModifier.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUICheckBoxCtrl::pfGUICheckBoxCtrl()
{
fAnimName = nil;
SetFlag( kWantsInterest );
fChecked = false;
fClicking = false;
fPlaySound = true;
}
pfGUICheckBoxCtrl::~pfGUICheckBoxCtrl()
{
delete [] fAnimName;
}
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUICheckBoxCtrl::IEval( double secs, hsScalar del, UInt32 dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
//// MsgReceive //////////////////////////////////////////////////////////////
hsBool pfGUICheckBoxCtrl::MsgReceive( plMessage *msg )
{
return pfGUIControlMod::MsgReceive( msg );
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUICheckBoxCtrl::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Read(s, mgr);
fAnimationKeys.Reset();
UInt32 i, count = s->ReadSwap32();
for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) );
fAnimName = s->ReadSafeString();
fChecked = s->ReadBool();
}
void pfGUICheckBoxCtrl::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Write( s, mgr );
UInt32 i, count = fAnimationKeys.GetCount();
s->WriteSwap32( count );
for( i = 0; i < count; i++ )
mgr->WriteKey( s, fAnimationKeys[ i ] );
s->WriteSafeString( fAnimName );
s->WriteBool( fChecked );
}
//// UpdateBounds ////////////////////////////////////////////////////////////
void pfGUICheckBoxCtrl::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool force )
{
pfGUIControlMod::UpdateBounds( invXformMatrix, force );
if( fAnimationKeys.GetCount() > 0 )
fBoundsValid = false;
}
//// HandleMouseDown/Up //////////////////////////////////////////////////////
void pfGUICheckBoxCtrl::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
{
fClicking = true;
if(fPlaySound)
IPlaySound( kMouseDown );
}
void pfGUICheckBoxCtrl::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
{
if( fClicking )
{
fClicking = false;
if(fPlaySound)
IPlaySound( kMouseUp );
// Don't run the command if the mouse is outside our bounds
if( fBounds.IsInside( &mousePt ) )
{
SetChecked( !fChecked );
DoSomething();
}
}
}
//// SetChecked //////////////////////////////////////////////////////////////
void pfGUICheckBoxCtrl::SetChecked( hsBool checked, hsBool immediate /*= false*/ )
{
fChecked = checked;
if( fAnimationKeys.GetCount() > 0 )
{
plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg();
if( fChecked )
{
// Moving to true
if( immediate )
{
msg->SetCmd( plAnimCmdMsg::kGoToEnd );
}
else
{
msg->SetCmd( plAnimCmdMsg::kContinue );
msg->SetCmd( plAnimCmdMsg::kSetForewards );
msg->SetCmd( plAnimCmdMsg::kGoToBegin );
}
}
else
{
// Moving to false
if( immediate )
{
msg->SetCmd( plAnimCmdMsg::kGoToBegin );
}
else
{
msg->SetCmd( plAnimCmdMsg::kContinue );
msg->SetCmd( plAnimCmdMsg::kSetBackwards );
msg->SetCmd( plAnimCmdMsg::kGoToEnd );
}
}
msg->SetAnimName( fAnimName );
msg->AddReceivers( fAnimationKeys );
plgDispatch::MsgSend( msg );
}
}
void pfGUICheckBoxCtrl::SetAnimationKeys( hsTArray<plKey> &keys, const char *name )
{
fAnimationKeys = keys;
delete [] fAnimName;
if( name != nil )
{
fAnimName = TRACKED_NEW char[ strlen( name ) + 1 ];
strcpy( fAnimName, name );
}
else
fAnimName = nil;
}
//// IGetDesiredCursor ///////////////////////////////////////////////////////
UInt32 pfGUICheckBoxCtrl::IGetDesiredCursor( void ) const
{
if( fClicking )
return plInputInterface::kCursorClicked;
return plInputInterface::kCursorPoised;
}
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUICheckBoxCtrl Definition //
// //
// Almost like buttons, only they keep their stated (pressed/unpressed) //
// when you click them, instead of reverting on mouse up. //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUICheckBoxCtrl.h"
#include "pfGameGUIMgr.h"
#include "../plInputCore/plInputInterface.h"
#include "../pnMessage/plRefMsg.h"
#include "../pfMessage/pfGameGUIMsg.h"
#include "../plMessage/plAnimCmdMsg.h"
#include "../plAvatar/plAGModifier.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUICheckBoxCtrl::pfGUICheckBoxCtrl()
{
fAnimName = nil;
SetFlag( kWantsInterest );
fChecked = false;
fClicking = false;
fPlaySound = true;
}
pfGUICheckBoxCtrl::~pfGUICheckBoxCtrl()
{
delete [] fAnimName;
}
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUICheckBoxCtrl::IEval( double secs, hsScalar del, UInt32 dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
//// MsgReceive //////////////////////////////////////////////////////////////
hsBool pfGUICheckBoxCtrl::MsgReceive( plMessage *msg )
{
return pfGUIControlMod::MsgReceive( msg );
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUICheckBoxCtrl::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Read(s, mgr);
fAnimationKeys.Reset();
UInt32 i, count = s->ReadSwap32();
for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) );
fAnimName = s->ReadSafeString();
fChecked = s->ReadBool();
}
void pfGUICheckBoxCtrl::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Write( s, mgr );
UInt32 i, count = fAnimationKeys.GetCount();
s->WriteSwap32( count );
for( i = 0; i < count; i++ )
mgr->WriteKey( s, fAnimationKeys[ i ] );
s->WriteSafeString( fAnimName );
s->WriteBool( fChecked );
}
//// UpdateBounds ////////////////////////////////////////////////////////////
void pfGUICheckBoxCtrl::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool force )
{
pfGUIControlMod::UpdateBounds( invXformMatrix, force );
if( fAnimationKeys.GetCount() > 0 )
fBoundsValid = false;
}
//// HandleMouseDown/Up //////////////////////////////////////////////////////
void pfGUICheckBoxCtrl::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
{
fClicking = true;
if(fPlaySound)
IPlaySound( kMouseDown );
}
void pfGUICheckBoxCtrl::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
{
if( fClicking )
{
fClicking = false;
if(fPlaySound)
IPlaySound( kMouseUp );
// Don't run the command if the mouse is outside our bounds
if( fBounds.IsInside( &mousePt ) )
{
SetChecked( !fChecked );
DoSomething();
}
}
}
//// SetChecked //////////////////////////////////////////////////////////////
void pfGUICheckBoxCtrl::SetChecked( hsBool checked, hsBool immediate /*= false*/ )
{
fChecked = checked;
if( fAnimationKeys.GetCount() > 0 )
{
plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg();
if( fChecked )
{
// Moving to true
if( immediate )
{
msg->SetCmd( plAnimCmdMsg::kGoToEnd );
}
else
{
msg->SetCmd( plAnimCmdMsg::kContinue );
msg->SetCmd( plAnimCmdMsg::kSetForewards );
msg->SetCmd( plAnimCmdMsg::kGoToBegin );
}
}
else
{
// Moving to false
if( immediate )
{
msg->SetCmd( plAnimCmdMsg::kGoToBegin );
}
else
{
msg->SetCmd( plAnimCmdMsg::kContinue );
msg->SetCmd( plAnimCmdMsg::kSetBackwards );
msg->SetCmd( plAnimCmdMsg::kGoToEnd );
}
}
msg->SetAnimName( fAnimName );
msg->AddReceivers( fAnimationKeys );
plgDispatch::MsgSend( msg );
}
}
void pfGUICheckBoxCtrl::SetAnimationKeys( hsTArray<plKey> &keys, const char *name )
{
fAnimationKeys = keys;
delete [] fAnimName;
if( name != nil )
{
fAnimName = TRACKED_NEW char[ strlen( name ) + 1 ];
strcpy( fAnimName, name );
}
else
fAnimName = nil;
}
//// IGetDesiredCursor ///////////////////////////////////////////////////////
UInt32 pfGUICheckBoxCtrl::IGetDesiredCursor( void ) const
{
if( fClicking )
return plInputInterface::kCursorClicked;
return plInputInterface::kCursorPoised;
}

View File

@ -1,111 +1,111 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUICheckBoxCtrl Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUICheckBoxCtrl_h
#define _pfGUICheckBoxCtrl_h
#include "pfGUIControlMod.h"
class plMessage;
class plPostEffectMod;
class plAGMasterMod;
class pfGUICheckBoxCtrl : public pfGUIControlMod
{
protected:
hsTArray<plKey> fAnimationKeys;
char *fAnimName;
hsBool fClicking;
hsBool fChecked;
hsBool fPlaySound;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual UInt32 IGetDesiredCursor( void ) const; // As specified in plInputInterface.h
public:
pfGUICheckBoxCtrl();
virtual ~pfGUICheckBoxCtrl();
CLASSNAME_REGISTER( pfGUICheckBoxCtrl );
GETINTERFACE_ANY( pfGUICheckBoxCtrl, pfGUIControlMod );
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false );
void SetChecked( hsBool checked, hsBool immediate = false );
hsBool IsChecked( void ) { return fChecked; }
void DontPlaySounds() { fPlaySound = false; } // should the checkbox play sounds?
const hsTArray<plKey> &GetAnimationKeys( void ) const { return fAnimationKeys; }
const char *GetAnimationName( void ) const { return fAnimName; }
enum SoundEvents
{
kMouseDown,
kMouseUp,
kMouseOver,
kMouseOff
};
// Export only
void SetAnimationKeys( hsTArray<plKey> &keys, const char *name );
};
#endif // _pfGUICheckBoxCtrl_h
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUICheckBoxCtrl Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUICheckBoxCtrl_h
#define _pfGUICheckBoxCtrl_h
#include "pfGUIControlMod.h"
class plMessage;
class plPostEffectMod;
class plAGMasterMod;
class pfGUICheckBoxCtrl : public pfGUIControlMod
{
protected:
hsTArray<plKey> fAnimationKeys;
char *fAnimName;
hsBool fClicking;
hsBool fChecked;
hsBool fPlaySound;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual UInt32 IGetDesiredCursor( void ) const; // As specified in plInputInterface.h
public:
pfGUICheckBoxCtrl();
virtual ~pfGUICheckBoxCtrl();
CLASSNAME_REGISTER( pfGUICheckBoxCtrl );
GETINTERFACE_ANY( pfGUICheckBoxCtrl, pfGUIControlMod );
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false );
void SetChecked( hsBool checked, hsBool immediate = false );
hsBool IsChecked( void ) { return fChecked; }
void DontPlaySounds() { fPlaySound = false; } // should the checkbox play sounds?
const hsTArray<plKey> &GetAnimationKeys( void ) const { return fAnimationKeys; }
const char *GetAnimationName( void ) const { return fAnimName; }
enum SoundEvents
{
kMouseDown,
kMouseUp,
kMouseOver,
kMouseOff
};
// Export only
void SetAnimationKeys( hsTArray<plKey> &keys, const char *name );
};
#endif // _pfGUICheckBoxCtrl_h

View File

@ -1,146 +1,146 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIClickMapCtrl Definition //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIClickMapCtrl.h"
#include "pfGameGUIMgr.h"
#include "pfGUIDialogMod.h"
#include "../plInputCore/plInputInterface.h"
#include "../pnMessage/plRefMsg.h"
#include "../pfMessage/pfGameGUIMsg.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIClickMapCtrl::pfGUIClickMapCtrl()
{
fTracking = false;
fCustomCursor = -1;
}
pfGUIClickMapCtrl::~pfGUIClickMapCtrl()
{
}
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIClickMapCtrl::IEval( double secs, hsScalar del, UInt32 dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
//// MsgReceive //////////////////////////////////////////////////////////////
hsBool pfGUIClickMapCtrl::MsgReceive( plMessage *msg )
{
return pfGUIControlMod::MsgReceive( msg );
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUIClickMapCtrl::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Read(s, mgr);
}
void pfGUIClickMapCtrl::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Write( s, mgr );
}
void pfGUIClickMapCtrl::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
{
IScreenToLocalPt( mousePt );
fLastMousePt = fLastMouseDragPt = mousePt;
fTracking = true;
}
void pfGUIClickMapCtrl::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
{
if( fTracking )
{
IScreenToLocalPt( mousePt );
fLastMousePt = fLastMouseUpPt = fLastMouseDragPt = mousePt;
DoSomething();
fTracking = false;
}
}
void pfGUIClickMapCtrl::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
{
if( fTracking )
{
IScreenToLocalPt( mousePt );
fLastMousePt = fLastMouseDragPt = mousePt;
if( HasFlag( kReportDragging ) )
HandleExtendedEvent( kMouseDragged );
}
}
void pfGUIClickMapCtrl::HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers )
{
IScreenToLocalPt( mousePt );
fLastMousePt = mousePt;
if( HasFlag( kReportHovering ) )
HandleExtendedEvent( kMouseHovered );
}
//// IGetDesiredCursor ///////////////////////////////////////////////////////
UInt32 pfGUIClickMapCtrl::IGetDesiredCursor( void ) const
{
if( fCustomCursor != -1 )
return (UInt32)fCustomCursor;
return plInputInterface::kCursorPoised;
}
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIClickMapCtrl Definition //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIClickMapCtrl.h"
#include "pfGameGUIMgr.h"
#include "pfGUIDialogMod.h"
#include "../plInputCore/plInputInterface.h"
#include "../pnMessage/plRefMsg.h"
#include "../pfMessage/pfGameGUIMsg.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIClickMapCtrl::pfGUIClickMapCtrl()
{
fTracking = false;
fCustomCursor = -1;
}
pfGUIClickMapCtrl::~pfGUIClickMapCtrl()
{
}
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIClickMapCtrl::IEval( double secs, hsScalar del, UInt32 dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
//// MsgReceive //////////////////////////////////////////////////////////////
hsBool pfGUIClickMapCtrl::MsgReceive( plMessage *msg )
{
return pfGUIControlMod::MsgReceive( msg );
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUIClickMapCtrl::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Read(s, mgr);
}
void pfGUIClickMapCtrl::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Write( s, mgr );
}
void pfGUIClickMapCtrl::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
{
IScreenToLocalPt( mousePt );
fLastMousePt = fLastMouseDragPt = mousePt;
fTracking = true;
}
void pfGUIClickMapCtrl::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
{
if( fTracking )
{
IScreenToLocalPt( mousePt );
fLastMousePt = fLastMouseUpPt = fLastMouseDragPt = mousePt;
DoSomething();
fTracking = false;
}
}
void pfGUIClickMapCtrl::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
{
if( fTracking )
{
IScreenToLocalPt( mousePt );
fLastMousePt = fLastMouseDragPt = mousePt;
if( HasFlag( kReportDragging ) )
HandleExtendedEvent( kMouseDragged );
}
}
void pfGUIClickMapCtrl::HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers )
{
IScreenToLocalPt( mousePt );
fLastMousePt = mousePt;
if( HasFlag( kReportHovering ) )
HandleExtendedEvent( kMouseHovered );
}
//// IGetDesiredCursor ///////////////////////////////////////////////////////
UInt32 pfGUIClickMapCtrl::IGetDesiredCursor( void ) const
{
if( fCustomCursor != -1 )
return (UInt32)fCustomCursor;
return plInputInterface::kCursorPoised;
}

View File

@ -1,105 +1,105 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIClickMapCtrl Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIClickMapCtrl_h
#define _pfGUIClickMapCtrl_h
#include "pfGUIControlMod.h"
class plMessage;
class pfGUIClickMapCtrl : public pfGUIControlMod
{
protected:
hsPoint3 fLastMousePt, fLastMouseUpPt, fLastMouseDragPt;
hsBool fTracking;
Int32 fCustomCursor;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual UInt32 IGetDesiredCursor( void ) const; // As specified in plInputInterface.h
public:
pfGUIClickMapCtrl();
virtual ~pfGUIClickMapCtrl();
CLASSNAME_REGISTER( pfGUIClickMapCtrl );
GETINTERFACE_ANY( pfGUIClickMapCtrl, pfGUIControlMod );
enum OurFlags
{
kReportDragging = kDerivedFlagsStart,
kReportHovering
};
// Extended event types
enum ExtendedEvents
{
kMouseDragged,
kMouseHovered
};
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers );
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
const hsPoint3 &GetLastMousePt( void ) const { return fLastMousePt; }
const hsPoint3 &GetLastMouseUpPt( void ) const { return fLastMouseUpPt; }
const hsPoint3 &GetLastMouseDragPt( void ) const { return fLastMouseDragPt; }
void SetCustomCursor( Int32 cursor = -1 ) { fCustomCursor = cursor; }
};
#endif // _pfGUIClickMapCtrl_h
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIClickMapCtrl Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIClickMapCtrl_h
#define _pfGUIClickMapCtrl_h
#include "pfGUIControlMod.h"
class plMessage;
class pfGUIClickMapCtrl : public pfGUIControlMod
{
protected:
hsPoint3 fLastMousePt, fLastMouseUpPt, fLastMouseDragPt;
hsBool fTracking;
Int32 fCustomCursor;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual UInt32 IGetDesiredCursor( void ) const; // As specified in plInputInterface.h
public:
pfGUIClickMapCtrl();
virtual ~pfGUIClickMapCtrl();
CLASSNAME_REGISTER( pfGUIClickMapCtrl );
GETINTERFACE_ANY( pfGUIClickMapCtrl, pfGUIControlMod );
enum OurFlags
{
kReportDragging = kDerivedFlagsStart,
kReportHovering
};
// Extended event types
enum ExtendedEvents
{
kMouseDragged,
kMouseHovered
};
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers );
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
const hsPoint3 &GetLastMousePt( void ) const { return fLastMousePt; }
const hsPoint3 &GetLastMouseUpPt( void ) const { return fLastMouseUpPt; }
const hsPoint3 &GetLastMouseDragPt( void ) const { return fLastMouseDragPt; }
void SetCustomCursor( Int32 cursor = -1 ) { fCustomCursor = cursor; }
};
#endif // _pfGUIClickMapCtrl_h

View File

@ -1,202 +1,202 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIControl Handler Definitions //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIControlHandlers.h"
#include "pfGUIControlMod.h"
#include "pfGUIDialogMod.h"
#include "../plMessage/plConsoleMsg.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Writeable Stuff /////////////////////////////////////////////////////////
void pfGUICtrlProcWriteableObject::Write( pfGUICtrlProcWriteableObject *obj, hsStream *s )
{
if( obj != nil )
{
s->WriteSwap32( obj->fType );
obj->IWrite( s );
}
else
s->WriteSwap32( kNull );
}
pfGUICtrlProcWriteableObject *pfGUICtrlProcWriteableObject::Read( hsStream *s )
{
pfGUICtrlProcWriteableObject *obj;
UInt32 type = s->ReadSwap32();
switch( type )
{
case kConsoleCmd:
obj = TRACKED_NEW pfGUIConsoleCmdProc;
break;
case kPythonScript:
obj = TRACKED_NEW pfGUIPythonScriptProc;
break;
case kCloseDlg:
obj = TRACKED_NEW pfGUICloseDlgProc;
break;
case kNull:
return nil;
default:
hsAssert( false, "Invalid proc type in Read()" );
return nil;
}
obj->IRead( s );
return obj;
}
//////////////////////////////////////////////////////////////////////////////
//// Predefined Exportables //////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//// pfGUIConsoleCmdProc /////////////////////////////////////////////////////
pfGUIConsoleCmdProc::pfGUIConsoleCmdProc() : pfGUICtrlProcWriteableObject( kConsoleCmd )
{
fCommand = nil;
}
pfGUIConsoleCmdProc::pfGUIConsoleCmdProc( const char *cmd )
: pfGUICtrlProcWriteableObject( kConsoleCmd )
{
fCommand = nil;
SetCommand( cmd );
}
pfGUIConsoleCmdProc::~pfGUIConsoleCmdProc()
{
delete [] fCommand;
}
void pfGUIConsoleCmdProc::IRead( hsStream *s )
{
int i = s->ReadSwap32();
if( i > 0 )
{
fCommand = TRACKED_NEW char[ i + 1 ];
memset( fCommand, 0, i + 1 );
s->Read( i, fCommand );
}
else
fCommand = nil;
}
void pfGUIConsoleCmdProc::IWrite( hsStream *s )
{
if( fCommand != nil )
{
s->WriteSwap32( strlen( fCommand ) );
s->Write( strlen( fCommand ), fCommand );
}
else
s->WriteSwap32( 0 );
}
void pfGUIConsoleCmdProc::DoSomething( pfGUIControlMod *ctrl )
{
if( fCommand != nil )
{
plConsoleMsg *cMsg = TRACKED_NEW plConsoleMsg( plConsoleMsg::kExecuteLine, fCommand );
plgDispatch::MsgSend( cMsg );
}
}
void pfGUIConsoleCmdProc::SetCommand( const char *cmd )
{
delete [] fCommand;
if( cmd == nil )
fCommand = nil;
else
{
fCommand = TRACKED_NEW char[ strlen( cmd ) + 1 ];
memset( fCommand, 0, strlen( cmd ) + 1 );
strcpy( fCommand, cmd );
}
}
//// pfGUIPythonScriptProc ///////////////////////////////////////////////////
pfGUIPythonScriptProc::pfGUIPythonScriptProc() : pfGUICtrlProcWriteableObject( kPythonScript )
{
}
pfGUIPythonScriptProc::~pfGUIPythonScriptProc()
{
}
void pfGUIPythonScriptProc::IRead( hsStream *s )
{
}
void pfGUIPythonScriptProc::IWrite( hsStream *s )
{
}
void pfGUIPythonScriptProc::DoSomething( pfGUIControlMod *ctrl )
{
}
//////////////////////////////////////////////////////////////////////////////
//// Simple Runtime Ones /////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
void pfGUICloseDlgProc::DoSomething( pfGUIControlMod *ctrl )
{
ctrl->GetOwnerDlg()->Hide();
}
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIControl Handler Definitions //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIControlHandlers.h"
#include "pfGUIControlMod.h"
#include "pfGUIDialogMod.h"
#include "../plMessage/plConsoleMsg.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Writeable Stuff /////////////////////////////////////////////////////////
void pfGUICtrlProcWriteableObject::Write( pfGUICtrlProcWriteableObject *obj, hsStream *s )
{
if( obj != nil )
{
s->WriteSwap32( obj->fType );
obj->IWrite( s );
}
else
s->WriteSwap32( kNull );
}
pfGUICtrlProcWriteableObject *pfGUICtrlProcWriteableObject::Read( hsStream *s )
{
pfGUICtrlProcWriteableObject *obj;
UInt32 type = s->ReadSwap32();
switch( type )
{
case kConsoleCmd:
obj = TRACKED_NEW pfGUIConsoleCmdProc;
break;
case kPythonScript:
obj = TRACKED_NEW pfGUIPythonScriptProc;
break;
case kCloseDlg:
obj = TRACKED_NEW pfGUICloseDlgProc;
break;
case kNull:
return nil;
default:
hsAssert( false, "Invalid proc type in Read()" );
return nil;
}
obj->IRead( s );
return obj;
}
//////////////////////////////////////////////////////////////////////////////
//// Predefined Exportables //////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//// pfGUIConsoleCmdProc /////////////////////////////////////////////////////
pfGUIConsoleCmdProc::pfGUIConsoleCmdProc() : pfGUICtrlProcWriteableObject( kConsoleCmd )
{
fCommand = nil;
}
pfGUIConsoleCmdProc::pfGUIConsoleCmdProc( const char *cmd )
: pfGUICtrlProcWriteableObject( kConsoleCmd )
{
fCommand = nil;
SetCommand( cmd );
}
pfGUIConsoleCmdProc::~pfGUIConsoleCmdProc()
{
delete [] fCommand;
}
void pfGUIConsoleCmdProc::IRead( hsStream *s )
{
int i = s->ReadSwap32();
if( i > 0 )
{
fCommand = TRACKED_NEW char[ i + 1 ];
memset( fCommand, 0, i + 1 );
s->Read( i, fCommand );
}
else
fCommand = nil;
}
void pfGUIConsoleCmdProc::IWrite( hsStream *s )
{
if( fCommand != nil )
{
s->WriteSwap32( strlen( fCommand ) );
s->Write( strlen( fCommand ), fCommand );
}
else
s->WriteSwap32( 0 );
}
void pfGUIConsoleCmdProc::DoSomething( pfGUIControlMod *ctrl )
{
if( fCommand != nil )
{
plConsoleMsg *cMsg = TRACKED_NEW plConsoleMsg( plConsoleMsg::kExecuteLine, fCommand );
plgDispatch::MsgSend( cMsg );
}
}
void pfGUIConsoleCmdProc::SetCommand( const char *cmd )
{
delete [] fCommand;
if( cmd == nil )
fCommand = nil;
else
{
fCommand = TRACKED_NEW char[ strlen( cmd ) + 1 ];
memset( fCommand, 0, strlen( cmd ) + 1 );
strcpy( fCommand, cmd );
}
}
//// pfGUIPythonScriptProc ///////////////////////////////////////////////////
pfGUIPythonScriptProc::pfGUIPythonScriptProc() : pfGUICtrlProcWriteableObject( kPythonScript )
{
}
pfGUIPythonScriptProc::~pfGUIPythonScriptProc()
{
}
void pfGUIPythonScriptProc::IRead( hsStream *s )
{
}
void pfGUIPythonScriptProc::IWrite( hsStream *s )
{
}
void pfGUIPythonScriptProc::DoSomething( pfGUIControlMod *ctrl )
{
}
//////////////////////////////////////////////////////////////////////////////
//// Simple Runtime Ones /////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
void pfGUICloseDlgProc::DoSomething( pfGUIControlMod *ctrl )
{
ctrl->GetOwnerDlg()->Hide();
}

View File

@ -1,196 +1,196 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIControlHandlers Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIControlHandlers_h
#define _pfGUIControlHandlers_h
#include "hsStream.h"
//// pfGUICtrlProcObject Definition //////////////////////////////////////////
// Any control which "does something" (buttons, edit boxes on Enter/Return,
// etc) uses this in some form. Basically, each control will have an (optional?)
// pointer to an object derived from this class type. The class has a single
// standard, virtual function that gets called on the "do something" event.
// Derive from this class, override the virtual and set the control's handler
// to your object and you're all set. Kinda like windowProcs wrapped in a
// C++ object.
// Note: there are some predefined objects for simple, common events. See
// below.
// Note the second: DoSomething() takes a parameter--namely, a pointer to
// the control that called it. Thus, you can make one object handle
// several controls by just switch()ing on that parameter and save yourself
// some object creation.
//
// UserCallback() is an additional function for use in communicating between
// procs. Basically, if you want another proc to do something (another dialog),
// and want you to get called once it's done, set the callback on the other
// proc/whatever to you and override UserCallback().
//
// HandleExtendedEvent() is similar to DoSomething(), but is called for extended
// event types, such as value changing (for an edit control while typing) or
// list scrolled. The event parameter is control-type-specific.
//
// Dialogs will use a similar functionality, but with more functions available.
class pfGUIControlMod;
class pfGUICtrlProcObject
{
protected:
UInt32 fRefCnt;
public:
pfGUICtrlProcObject() { fRefCnt = 0; }
virtual ~pfGUICtrlProcObject() { ; }
virtual void DoSomething( pfGUIControlMod *ctrl ) = 0;
virtual void HandleExtendedEvent( pfGUIControlMod *ctrl, UInt32 event ) { ; }
virtual void UserCallback( UInt32 userValue ) { ; }
// ONLY THE GUI SYSTEM SHOULD CALL THESE
void IncRef( void ) { fRefCnt++; }
hsBool DecRef( void ) { fRefCnt--; return ( fRefCnt > 0 ) ? false : true; }
};
//// pfGUICtrlProcWriteableObject ////////////////////////////////////////////
// This one is a read/writeable version of the above. Basically, you can just
// call Read/Write() and it'll do all the mini-functionality of the factory
// stuff so you don't have to worry about the derived type at runtime. Do
// NOT derive from this class for your own handlers; this is just for the
// handfull that will get added on export.
class pfGUICtrlProcWriteableObject : public pfGUICtrlProcObject
{
protected:
UInt32 fType;
virtual void IRead( hsStream *s ) = 0;
virtual void IWrite( hsStream *s ) = 0;
public:
enum Types
{
kNull,
kConsoleCmd,
kPythonScript,
kCloseDlg
};
pfGUICtrlProcWriteableObject() { fType = kNull; }
pfGUICtrlProcWriteableObject( UInt32 type ) : fType( type ) { ; }
virtual ~pfGUICtrlProcWriteableObject() { ; }
virtual void DoSomething( pfGUIControlMod *ctrl ) = 0;
static void Write( pfGUICtrlProcWriteableObject *obj, hsStream *s );
static pfGUICtrlProcWriteableObject *Read( hsStream *s );
};
//// pfGUIConsoleCmdProc /////////////////////////////////////////////////////
// Simply runs the console command specified. Exportable.
class pfGUIConsoleCmdProc : public pfGUICtrlProcWriteableObject
{
protected:
char *fCommand;
virtual void IRead( hsStream *s );
virtual void IWrite( hsStream *s );
public:
pfGUIConsoleCmdProc();
pfGUIConsoleCmdProc( const char *cmd );
virtual ~pfGUIConsoleCmdProc();
virtual void DoSomething( pfGUIControlMod *ctrl );
void SetCommand( const char *cmd );
};
//// pfGUIPythonScriptProc ///////////////////////////////////////////////////
class pfGUIPythonScriptProc : public pfGUICtrlProcWriteableObject
{
protected:
virtual void IRead( hsStream *s );
virtual void IWrite( hsStream *s );
public:
pfGUIPythonScriptProc();
virtual ~pfGUIPythonScriptProc();
virtual void DoSomething( pfGUIControlMod *ctrl );
};
//// Simple Runtime Ones /////////////////////////////////////////////////////
class pfGUICloseDlgProc : public pfGUICtrlProcWriteableObject
{
protected:
virtual void IRead( hsStream *s ) {}
virtual void IWrite( hsStream *s ) {}
public:
pfGUICloseDlgProc() : pfGUICtrlProcWriteableObject( kCloseDlg ) {}
virtual ~pfGUICloseDlgProc() {}
virtual void DoSomething( pfGUIControlMod *ctrl );
};
#endif // _pfGUIControlHandlers_h
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIControlHandlers Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIControlHandlers_h
#define _pfGUIControlHandlers_h
#include "hsStream.h"
//// pfGUICtrlProcObject Definition //////////////////////////////////////////
// Any control which "does something" (buttons, edit boxes on Enter/Return,
// etc) uses this in some form. Basically, each control will have an (optional?)
// pointer to an object derived from this class type. The class has a single
// standard, virtual function that gets called on the "do something" event.
// Derive from this class, override the virtual and set the control's handler
// to your object and you're all set. Kinda like windowProcs wrapped in a
// C++ object.
// Note: there are some predefined objects for simple, common events. See
// below.
// Note the second: DoSomething() takes a parameter--namely, a pointer to
// the control that called it. Thus, you can make one object handle
// several controls by just switch()ing on that parameter and save yourself
// some object creation.
//
// UserCallback() is an additional function for use in communicating between
// procs. Basically, if you want another proc to do something (another dialog),
// and want you to get called once it's done, set the callback on the other
// proc/whatever to you and override UserCallback().
//
// HandleExtendedEvent() is similar to DoSomething(), but is called for extended
// event types, such as value changing (for an edit control while typing) or
// list scrolled. The event parameter is control-type-specific.
//
// Dialogs will use a similar functionality, but with more functions available.
class pfGUIControlMod;
class pfGUICtrlProcObject
{
protected:
UInt32 fRefCnt;
public:
pfGUICtrlProcObject() { fRefCnt = 0; }
virtual ~pfGUICtrlProcObject() { ; }
virtual void DoSomething( pfGUIControlMod *ctrl ) = 0;
virtual void HandleExtendedEvent( pfGUIControlMod *ctrl, UInt32 event ) { ; }
virtual void UserCallback( UInt32 userValue ) { ; }
// ONLY THE GUI SYSTEM SHOULD CALL THESE
void IncRef( void ) { fRefCnt++; }
hsBool DecRef( void ) { fRefCnt--; return ( fRefCnt > 0 ) ? false : true; }
};
//// pfGUICtrlProcWriteableObject ////////////////////////////////////////////
// This one is a read/writeable version of the above. Basically, you can just
// call Read/Write() and it'll do all the mini-functionality of the factory
// stuff so you don't have to worry about the derived type at runtime. Do
// NOT derive from this class for your own handlers; this is just for the
// handfull that will get added on export.
class pfGUICtrlProcWriteableObject : public pfGUICtrlProcObject
{
protected:
UInt32 fType;
virtual void IRead( hsStream *s ) = 0;
virtual void IWrite( hsStream *s ) = 0;
public:
enum Types
{
kNull,
kConsoleCmd,
kPythonScript,
kCloseDlg
};
pfGUICtrlProcWriteableObject() { fType = kNull; }
pfGUICtrlProcWriteableObject( UInt32 type ) : fType( type ) { ; }
virtual ~pfGUICtrlProcWriteableObject() { ; }
virtual void DoSomething( pfGUIControlMod *ctrl ) = 0;
static void Write( pfGUICtrlProcWriteableObject *obj, hsStream *s );
static pfGUICtrlProcWriteableObject *Read( hsStream *s );
};
//// pfGUIConsoleCmdProc /////////////////////////////////////////////////////
// Simply runs the console command specified. Exportable.
class pfGUIConsoleCmdProc : public pfGUICtrlProcWriteableObject
{
protected:
char *fCommand;
virtual void IRead( hsStream *s );
virtual void IWrite( hsStream *s );
public:
pfGUIConsoleCmdProc();
pfGUIConsoleCmdProc( const char *cmd );
virtual ~pfGUIConsoleCmdProc();
virtual void DoSomething( pfGUIControlMod *ctrl );
void SetCommand( const char *cmd );
};
//// pfGUIPythonScriptProc ///////////////////////////////////////////////////
class pfGUIPythonScriptProc : public pfGUICtrlProcWriteableObject
{
protected:
virtual void IRead( hsStream *s );
virtual void IWrite( hsStream *s );
public:
pfGUIPythonScriptProc();
virtual ~pfGUIPythonScriptProc();
virtual void DoSomething( pfGUIControlMod *ctrl );
};
//// Simple Runtime Ones /////////////////////////////////////////////////////
class pfGUICloseDlgProc : public pfGUICtrlProcWriteableObject
{
protected:
virtual void IRead( hsStream *s ) {}
virtual void IWrite( hsStream *s ) {}
public:
pfGUICloseDlgProc() : pfGUICtrlProcWriteableObject( kCloseDlg ) {}
virtual ~pfGUICloseDlgProc() {}
virtual void DoSomething( pfGUIControlMod *ctrl );
};
#endif // _pfGUIControlHandlers_h

File diff suppressed because it is too large Load Diff

View File

@ -1,268 +1,268 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIControlMod Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIControlMod_h
#define _pfGUIControlMod_h
#include "../pnModifier/plSingleModifier.h"
#include "hsBounds.h"
#include "../plMessage/plInputEventMsg.h"
#include "pfGameGUIMgr.h"
#include "hsColorRGBA.h"
#include "hsRefCnt.h"
class plMessage;
class plPostEffectMod;
class pfGUIDialogMod;
class pfGUICtrlProcObject;
class pfGUIDropTargetProc;
class plDynamicTextMap;
class plLayerInterface;
//// pfGUIColorScheme ////////////////////////////////////////////////////////
// Tiny helper wrapper for a set of colors used to draw various controls
class pfGUIColorScheme : public hsRefCnt
{
public:
hsColorRGBA fForeColor, fBackColor;
hsColorRGBA fSelForeColor, fSelBackColor;
hsBool fTransparent;
char *fFontFace;
UInt8 fFontSize;
UInt8 fFontFlags;
enum FontFlags
{
kFontBold = 0x01,
kFontItalic = 0x02,
kFontShadowed = 0x04
};
pfGUIColorScheme();
~pfGUIColorScheme();
pfGUIColorScheme( hsColorRGBA &foreColor, hsColorRGBA &backColor );
pfGUIColorScheme( const char *face, UInt8 size, UInt8 fontFlags );
void SetFontFace( const char *face );
void Read( hsStream *s );
void Write( hsStream *s );
hsBool IsBold( void ) { return ( fFontFlags & kFontBold ) ? true : false; }
hsBool IsItalic( void ) { return ( fFontFlags & kFontItalic ) ? true : false; }
hsBool IsShadowed( void ) { return ( fFontFlags & kFontShadowed ) ? true : false; }
protected:
void IReset( void );
};
//// Class Def ///////////////////////////////////////////////////////////////
class pfGUISkin;
class pfGUIControlMod : public plSingleModifier
{
friend class pfGUIDialogMod;
protected:
UInt32 fTagID;
hsBool fEnabled, fFocused, fVisible, fInteresting;
hsBool fNotifyOnInteresting;
pfGUIDialogMod *fDialog;
hsBounds3 fBounds, fInitialBounds; // Z component is 0-1
hsScalar fScreenMinZ; // Closest Z coordinate in screen space
hsPoint3 fScreenCenter;
hsBool fBoundsValid, fCenterValid;
hsMatrix44 fXformMatrix; // Only used for doing drag work, etc.
pfGUICtrlProcObject *fHandler;
pfGUIDropTargetProc *fDropTargetHdlr;
plDynamicTextMap *fDynTextMap; // Some controls use this; for others, it'll be nil
plLayerInterface *fDynTextLayer; // Juse so we can reset the transform. Sheesh!
pfGUIColorScheme *fColorScheme;
plSceneObject *fProxy;
hsTArray<hsPoint3> fBoundsPoints; // For more accurate bounds tests
hsTArray<int> fSoundIndices; // Indices of sounds to trigger on the target SO's audible interface
pfGUISkin *fSkin;
hsBool ISetUpDynTextMap( plPipeline *pipe );
virtual void IPostSetUpDynTextMap( void ) {}
virtual void IGrowDTMDimsToDesiredSize( UInt16 &width, UInt16 &height ) { }
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
void ISetDialog( pfGUIDialogMod *mod ) { fDialog = mod; }
void IScreenToLocalPt( hsPoint3 &pt );
virtual void IUpdate( void ) {;}
void ISetHandler( pfGUICtrlProcObject *h, hsBool clearInheritFlag = false );
void IPlaySound( UInt8 guiCtrlEvent, hsBool loop = false );
void IStopSound( UInt8 guiCtrlEvent );
virtual UInt32 IGetDesiredCursor( void ) const { return 0; } // As specified in plInputInterface.h
public:
pfGUIControlMod();
virtual ~pfGUIControlMod();
CLASSNAME_REGISTER( pfGUIControlMod );
GETINTERFACE_ANY( pfGUIControlMod, plSingleModifier );
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
UInt32 GetTagID( void ) { return fTagID; }
virtual void SetEnabled( hsBool e );
virtual hsBool IsEnabled( void ) { return fEnabled; }
virtual void SetFocused( hsBool e );
virtual hsBool IsFocused( void ) { return fFocused; }
virtual void SetVisible( hsBool vis );
virtual hsBool IsVisible( void ) { return fVisible; }
virtual void SetInteresting( hsBool i );
hsBool IsInteresting( void ) { return fInteresting; }
virtual void SetNotifyOnInteresting( hsBool state ) { fNotifyOnInteresting = state; }
pfGUIDialogMod *GetOwnerDlg( void ) { return fDialog; }
virtual void Refresh( void );
virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false );
void SetObjectCenter( hsScalar x, hsScalar y );
virtual hsPoint3 GetObjectCenter() { return fScreenCenter; }
hsScalar GetScreenMinZ( void ) { return fScreenMinZ; }
void CalcInitialBounds( void );
const hsBounds3 &GetBounds( void );
hsBool PointInBounds( const hsPoint3 &point );
virtual void SetTarget( plSceneObject *object );
// Return false if you actually DON'T want the mouse clicked at this point (should only be used for non-rectangular region rejection)
virtual hsBool FilterMousePosition( hsPoint3 &mousePt ) { return true; }
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ) {;}
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ) {;}
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ) {;}
virtual void HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers ) {;}
virtual void HandleMouseDblClick( hsPoint3 &mousePt, UInt8 modifiers ) {;}
virtual hsBool HandleKeyPress( char key, UInt8 modifiers );
virtual hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers );
void SetHandler( pfGUICtrlProcObject *h ) { ISetHandler( h, true ); }
void DoSomething( void ); // Will call the handler
void HandleExtendedEvent( UInt32 event ); // Will call the handler
pfGUICtrlProcObject *GetHandler( void ) const { return fHandler; }
void SetDropTargetHdlr( pfGUIDropTargetProc *drop );
pfGUIDropTargetProc *GetDropTargetHdlr( void ) { return fDropTargetHdlr; }
enum
{
kRefDynTextMap,
kRefDynTextLayer,
kRefProxy,
kRefSkin,
kRefDerivedStart = 32
};
enum Flags // plSingleModifier already has SetFlag()/HasFlag()
{
kWantsInterest,
kInheritProcFromDlg,
kIntangible, // I.E. it doesn't exists on the screen/can't be clicked on.
// Used for group objects like the up/down pair
kXparentBgnd,
kScaleTextWithResolution, // I.E. take up the same space on screen no matter the resolution
kTakesSpecialKeys, // I.E. disable bindings for keys like backspace because we want them
kHasProxy,
kBetterHitTesting,
kDerivedFlagsStart = 32
};
virtual void SetColorScheme( pfGUIColorScheme *newScheme );
pfGUIColorScheme *GetColorScheme( void ) const;
virtual void UpdateColorScheme() { IPostSetUpDynTextMap(); IUpdate(); }
// should be override by specific GUIcontrol
virtual void PurgeDynaTextMapImage() {;}
// Override from plModifier so we can update our bounds
virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l);
// Forces an immediate play of the given GUI control event sound
void PlaySound( UInt8 guiCtrlEvent, hsBool loop = false ) { IPlaySound( guiCtrlEvent, loop ); }
void StopSound( UInt8 guiCtrlEvent ) { IStopSound( guiCtrlEvent ); }
// Export only
void SetTagID( UInt32 id ) { fTagID = id; }
void SetDynTextMap( plLayerInterface *layer, plDynamicTextMap *dynText );
void SetSoundIndex( UInt8 guiCtrlEvent, int soundIndex );
};
#endif // _pfGUIControlMod_h
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIControlMod Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIControlMod_h
#define _pfGUIControlMod_h
#include "../pnModifier/plSingleModifier.h"
#include "hsBounds.h"
#include "../plMessage/plInputEventMsg.h"
#include "pfGameGUIMgr.h"
#include "hsColorRGBA.h"
#include "hsRefCnt.h"
class plMessage;
class plPostEffectMod;
class pfGUIDialogMod;
class pfGUICtrlProcObject;
class pfGUIDropTargetProc;
class plDynamicTextMap;
class plLayerInterface;
//// pfGUIColorScheme ////////////////////////////////////////////////////////
// Tiny helper wrapper for a set of colors used to draw various controls
class pfGUIColorScheme : public hsRefCnt
{
public:
hsColorRGBA fForeColor, fBackColor;
hsColorRGBA fSelForeColor, fSelBackColor;
hsBool fTransparent;
char *fFontFace;
UInt8 fFontSize;
UInt8 fFontFlags;
enum FontFlags
{
kFontBold = 0x01,
kFontItalic = 0x02,
kFontShadowed = 0x04
};
pfGUIColorScheme();
~pfGUIColorScheme();
pfGUIColorScheme( hsColorRGBA &foreColor, hsColorRGBA &backColor );
pfGUIColorScheme( const char *face, UInt8 size, UInt8 fontFlags );
void SetFontFace( const char *face );
void Read( hsStream *s );
void Write( hsStream *s );
hsBool IsBold( void ) { return ( fFontFlags & kFontBold ) ? true : false; }
hsBool IsItalic( void ) { return ( fFontFlags & kFontItalic ) ? true : false; }
hsBool IsShadowed( void ) { return ( fFontFlags & kFontShadowed ) ? true : false; }
protected:
void IReset( void );
};
//// Class Def ///////////////////////////////////////////////////////////////
class pfGUISkin;
class pfGUIControlMod : public plSingleModifier
{
friend class pfGUIDialogMod;
protected:
UInt32 fTagID;
hsBool fEnabled, fFocused, fVisible, fInteresting;
hsBool fNotifyOnInteresting;
pfGUIDialogMod *fDialog;
hsBounds3 fBounds, fInitialBounds; // Z component is 0-1
hsScalar fScreenMinZ; // Closest Z coordinate in screen space
hsPoint3 fScreenCenter;
hsBool fBoundsValid, fCenterValid;
hsMatrix44 fXformMatrix; // Only used for doing drag work, etc.
pfGUICtrlProcObject *fHandler;
pfGUIDropTargetProc *fDropTargetHdlr;
plDynamicTextMap *fDynTextMap; // Some controls use this; for others, it'll be nil
plLayerInterface *fDynTextLayer; // Juse so we can reset the transform. Sheesh!
pfGUIColorScheme *fColorScheme;
plSceneObject *fProxy;
hsTArray<hsPoint3> fBoundsPoints; // For more accurate bounds tests
hsTArray<int> fSoundIndices; // Indices of sounds to trigger on the target SO's audible interface
pfGUISkin *fSkin;
hsBool ISetUpDynTextMap( plPipeline *pipe );
virtual void IPostSetUpDynTextMap( void ) {}
virtual void IGrowDTMDimsToDesiredSize( UInt16 &width, UInt16 &height ) { }
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
void ISetDialog( pfGUIDialogMod *mod ) { fDialog = mod; }
void IScreenToLocalPt( hsPoint3 &pt );
virtual void IUpdate( void ) {;}
void ISetHandler( pfGUICtrlProcObject *h, hsBool clearInheritFlag = false );
void IPlaySound( UInt8 guiCtrlEvent, hsBool loop = false );
void IStopSound( UInt8 guiCtrlEvent );
virtual UInt32 IGetDesiredCursor( void ) const { return 0; } // As specified in plInputInterface.h
public:
pfGUIControlMod();
virtual ~pfGUIControlMod();
CLASSNAME_REGISTER( pfGUIControlMod );
GETINTERFACE_ANY( pfGUIControlMod, plSingleModifier );
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
UInt32 GetTagID( void ) { return fTagID; }
virtual void SetEnabled( hsBool e );
virtual hsBool IsEnabled( void ) { return fEnabled; }
virtual void SetFocused( hsBool e );
virtual hsBool IsFocused( void ) { return fFocused; }
virtual void SetVisible( hsBool vis );
virtual hsBool IsVisible( void ) { return fVisible; }
virtual void SetInteresting( hsBool i );
hsBool IsInteresting( void ) { return fInteresting; }
virtual void SetNotifyOnInteresting( hsBool state ) { fNotifyOnInteresting = state; }
pfGUIDialogMod *GetOwnerDlg( void ) { return fDialog; }
virtual void Refresh( void );
virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false );
void SetObjectCenter( hsScalar x, hsScalar y );
virtual hsPoint3 GetObjectCenter() { return fScreenCenter; }
hsScalar GetScreenMinZ( void ) { return fScreenMinZ; }
void CalcInitialBounds( void );
const hsBounds3 &GetBounds( void );
hsBool PointInBounds( const hsPoint3 &point );
virtual void SetTarget( plSceneObject *object );
// Return false if you actually DON'T want the mouse clicked at this point (should only be used for non-rectangular region rejection)
virtual hsBool FilterMousePosition( hsPoint3 &mousePt ) { return true; }
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers ) {;}
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers ) {;}
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers ) {;}
virtual void HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers ) {;}
virtual void HandleMouseDblClick( hsPoint3 &mousePt, UInt8 modifiers ) {;}
virtual hsBool HandleKeyPress( char key, UInt8 modifiers );
virtual hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers );
void SetHandler( pfGUICtrlProcObject *h ) { ISetHandler( h, true ); }
void DoSomething( void ); // Will call the handler
void HandleExtendedEvent( UInt32 event ); // Will call the handler
pfGUICtrlProcObject *GetHandler( void ) const { return fHandler; }
void SetDropTargetHdlr( pfGUIDropTargetProc *drop );
pfGUIDropTargetProc *GetDropTargetHdlr( void ) { return fDropTargetHdlr; }
enum
{
kRefDynTextMap,
kRefDynTextLayer,
kRefProxy,
kRefSkin,
kRefDerivedStart = 32
};
enum Flags // plSingleModifier already has SetFlag()/HasFlag()
{
kWantsInterest,
kInheritProcFromDlg,
kIntangible, // I.E. it doesn't exists on the screen/can't be clicked on.
// Used for group objects like the up/down pair
kXparentBgnd,
kScaleTextWithResolution, // I.E. take up the same space on screen no matter the resolution
kTakesSpecialKeys, // I.E. disable bindings for keys like backspace because we want them
kHasProxy,
kBetterHitTesting,
kDerivedFlagsStart = 32
};
virtual void SetColorScheme( pfGUIColorScheme *newScheme );
pfGUIColorScheme *GetColorScheme( void ) const;
virtual void UpdateColorScheme() { IPostSetUpDynTextMap(); IUpdate(); }
// should be override by specific GUIcontrol
virtual void PurgeDynaTextMapImage() {;}
// Override from plModifier so we can update our bounds
virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l);
// Forces an immediate play of the given GUI control event sound
void PlaySound( UInt8 guiCtrlEvent, hsBool loop = false ) { IPlaySound( guiCtrlEvent, loop ); }
void StopSound( UInt8 guiCtrlEvent ) { IStopSound( guiCtrlEvent ); }
// Export only
void SetTagID( UInt32 id ) { fTagID = id; }
void SetDynTextMap( plLayerInterface *layer, plDynamicTextMap *dynText );
void SetSoundIndex( UInt8 guiCtrlEvent, int soundIndex );
};
#endif // _pfGUIControlMod_h

File diff suppressed because it is too large Load Diff

View File

@ -1,129 +1,129 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUICtrlGenerator Header //
// Generates really primitive GUI controls (and dialogs) at runtime. //
// Useful for, well, generating really primitive GUI controls and dialogs //
// at runtime...
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUICtrlGenerator_h
#define _pfGUICtrlGenerator_h
#include "hsStream.h"
#include "hsTemplates.h"
//// pfGUICtrlGenerator Definition ///////////////////////////////////////////
class pfGUIDialogMod;
class pfGUIButtonMod;
class pfGUIDragBarCtrl;
class hsGMaterial;
struct hsColorRGBA;
class plSceneNode;
class hsKeyedObject;
class plKey;
class plTextGenerator;
class plSceneObject;
class plDrawable;
struct hsMatrix44;
class pfGUICtrlGenerator
{
protected:
char fFontFace[ 256 ];
UInt32 fFontSize;
hsTArray<plTextGenerator *> fTextGens;
hsTArray<plSceneNode *> fDynDlgNodes;
hsTArray<pfGUIDialogMod *> fDynDialogs;
hsTArray<plSceneObject *> fDynDragBars;
plKey IAddKey( hsKeyedObject *ko, const char *prefix );
void IGetNextKeyName( char *name, const char *prefix );
hsGMaterial *ICreateSolidMaterial( hsColorRGBA &color );
hsGMaterial *ICreateTextMaterial( const char *text, hsColorRGBA &bgColor,
hsColorRGBA &textColor, float objWidth, float objHeight );
pfGUIDialogMod *IGetDialog( void );
pfGUIDialogMod *IGenerateDialog( const char *name, float scrnWidth, hsBool show = true );
plSceneObject *IGenSceneObject( pfGUIDialogMod *dlg, plDrawable *myDraw, plSceneObject *parent = nil, hsMatrix44 *l2w = nil, hsMatrix44 *w2l = nil );
public:
pfGUICtrlGenerator();
~pfGUICtrlGenerator();
void Shutdown( void );
void SetFont( const char *face, UInt16 size );
pfGUIButtonMod *GenerateRectButton( const char *title, float x, float y, float width, float height,
const char *consoleCmd, hsColorRGBA &color, hsColorRGBA &textColor );
pfGUIButtonMod *GenerateSphereButton( float x, float y, float radius,
const char *consoleCmd, hsColorRGBA &color );
pfGUIDragBarCtrl *GenerateDragBar( float x, float y, float width, float height, hsColorRGBA &color );
void GenerateDialog( const char *name );
pfGUIButtonMod *CreateRectButton( pfGUIDialogMod *parent, const char *title, float x, float y,
float width, float height, hsGMaterial *material, hsBool asMenuItem = false );
pfGUIButtonMod *CreateRectButton( pfGUIDialogMod *parent, const wchar_t *title, float x, float y,
float width, float height, hsGMaterial *material, hsBool asMenuItem = false );
static pfGUICtrlGenerator &Instance( void );
};
#endif // _pfGUICtrlGenerator_h
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUICtrlGenerator Header //
// Generates really primitive GUI controls (and dialogs) at runtime. //
// Useful for, well, generating really primitive GUI controls and dialogs //
// at runtime...
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUICtrlGenerator_h
#define _pfGUICtrlGenerator_h
#include "hsStream.h"
#include "hsTemplates.h"
//// pfGUICtrlGenerator Definition ///////////////////////////////////////////
class pfGUIDialogMod;
class pfGUIButtonMod;
class pfGUIDragBarCtrl;
class hsGMaterial;
struct hsColorRGBA;
class plSceneNode;
class hsKeyedObject;
class plKey;
class plTextGenerator;
class plSceneObject;
class plDrawable;
struct hsMatrix44;
class pfGUICtrlGenerator
{
protected:
char fFontFace[ 256 ];
UInt32 fFontSize;
hsTArray<plTextGenerator *> fTextGens;
hsTArray<plSceneNode *> fDynDlgNodes;
hsTArray<pfGUIDialogMod *> fDynDialogs;
hsTArray<plSceneObject *> fDynDragBars;
plKey IAddKey( hsKeyedObject *ko, const char *prefix );
void IGetNextKeyName( char *name, const char *prefix );
hsGMaterial *ICreateSolidMaterial( hsColorRGBA &color );
hsGMaterial *ICreateTextMaterial( const char *text, hsColorRGBA &bgColor,
hsColorRGBA &textColor, float objWidth, float objHeight );
pfGUIDialogMod *IGetDialog( void );
pfGUIDialogMod *IGenerateDialog( const char *name, float scrnWidth, hsBool show = true );
plSceneObject *IGenSceneObject( pfGUIDialogMod *dlg, plDrawable *myDraw, plSceneObject *parent = nil, hsMatrix44 *l2w = nil, hsMatrix44 *w2l = nil );
public:
pfGUICtrlGenerator();
~pfGUICtrlGenerator();
void Shutdown( void );
void SetFont( const char *face, UInt16 size );
pfGUIButtonMod *GenerateRectButton( const char *title, float x, float y, float width, float height,
const char *consoleCmd, hsColorRGBA &color, hsColorRGBA &textColor );
pfGUIButtonMod *GenerateSphereButton( float x, float y, float radius,
const char *consoleCmd, hsColorRGBA &color );
pfGUIDragBarCtrl *GenerateDragBar( float x, float y, float width, float height, hsColorRGBA &color );
void GenerateDialog( const char *name );
pfGUIButtonMod *CreateRectButton( pfGUIDialogMod *parent, const char *title, float x, float y,
float width, float height, hsGMaterial *material, hsBool asMenuItem = false );
pfGUIButtonMod *CreateRectButton( pfGUIDialogMod *parent, const wchar_t *title, float x, float y,
float width, float height, hsGMaterial *material, hsBool asMenuItem = false );
static pfGUICtrlGenerator &Instance( void );
};
#endif // _pfGUICtrlGenerator_h

View File

@ -1,113 +1,113 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIDialogHandlers Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIDialogHandlers_h
#define _pfGUIDialogHandlers_h
#include "hsStream.h"
#include "pfGUIControlHandlers.h"
//// pfGUIDialogProc Definition //////////////////////////////////////////////
// This works very much like the control proc objects. The idea is, if you
// want to do some custom work on a dialog (and who doesn't?), you create an
// object derived from this type, override the functions, and do as you
// please. The class type also derives from the control proc type, meaning
// that you can implement DoSomething() as well and use the same object for
// both your dialog and your control procs. (DoSomething() is overloaded here
// so that it's no longer pure virtual, so you can use it for only handling
// dialogs if you prefer).
class pfGUIDialogMod;
class pfGUIDialogProc : public pfGUICtrlProcObject
{
protected:
pfGUIDialogMod *fDialog;
public:
pfGUIDialogProc() { }
virtual ~pfGUIDialogProc() { ; }
// Called by the mgr--don't call yourself!
void SetDialog( pfGUIDialogMod *dlg ) { fDialog = dlg; }
// Enums for OnControlEvent
enum ControlEvt
{
kExitMode
};
//////// FUNCTIONS TO OVERLOAD ////////
// Overloaded here so you don't have to unless you want to. Overload
// it if you want to use this for a control handler as well.
virtual void DoSomething( pfGUIControlMod *ctrl ) {;}
// Called on dialog init (i.e. first showing, before OnShow() is called), only ever called once
virtual void OnInit( void ) { ; }
// Called before the dialog is shown, always after OnInit()
virtual void OnShow( void ) { ; }
// Called before the dialog is hidden
virtual void OnHide( void ) { ; }
// Called on the dialog's destructor, before it's unregistered with the game GUI manager
virtual void OnDestroy( void ) { ; }
// Called when the dialog's focused control changes
virtual void OnCtrlFocusChange( pfGUIControlMod *oldCtrl, pfGUIControlMod *newCtrl ) { ; }
// Called when the key bound to a GUI event is pressed. Only called on the top modal dialog
virtual void OnControlEvent( ControlEvt event ) { ; }
// Called when the GUI changes interesting state
virtual void OnInterestingEvent( pfGUIControlMod *ctrl ) { ; }
};
#endif // _pfGUIDialogHandlers_h
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIDialogHandlers Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIDialogHandlers_h
#define _pfGUIDialogHandlers_h
#include "hsStream.h"
#include "pfGUIControlHandlers.h"
//// pfGUIDialogProc Definition //////////////////////////////////////////////
// This works very much like the control proc objects. The idea is, if you
// want to do some custom work on a dialog (and who doesn't?), you create an
// object derived from this type, override the functions, and do as you
// please. The class type also derives from the control proc type, meaning
// that you can implement DoSomething() as well and use the same object for
// both your dialog and your control procs. (DoSomething() is overloaded here
// so that it's no longer pure virtual, so you can use it for only handling
// dialogs if you prefer).
class pfGUIDialogMod;
class pfGUIDialogProc : public pfGUICtrlProcObject
{
protected:
pfGUIDialogMod *fDialog;
public:
pfGUIDialogProc() { }
virtual ~pfGUIDialogProc() { ; }
// Called by the mgr--don't call yourself!
void SetDialog( pfGUIDialogMod *dlg ) { fDialog = dlg; }
// Enums for OnControlEvent
enum ControlEvt
{
kExitMode
};
//////// FUNCTIONS TO OVERLOAD ////////
// Overloaded here so you don't have to unless you want to. Overload
// it if you want to use this for a control handler as well.
virtual void DoSomething( pfGUIControlMod *ctrl ) {;}
// Called on dialog init (i.e. first showing, before OnShow() is called), only ever called once
virtual void OnInit( void ) { ; }
// Called before the dialog is shown, always after OnInit()
virtual void OnShow( void ) { ; }
// Called before the dialog is hidden
virtual void OnHide( void ) { ; }
// Called on the dialog's destructor, before it's unregistered with the game GUI manager
virtual void OnDestroy( void ) { ; }
// Called when the dialog's focused control changes
virtual void OnCtrlFocusChange( pfGUIControlMod *oldCtrl, pfGUIControlMod *newCtrl ) { ; }
// Called when the key bound to a GUI event is pressed. Only called on the top modal dialog
virtual void OnControlEvent( ControlEvt event ) { ; }
// Called when the GUI changes interesting state
virtual void OnInterestingEvent( pfGUIControlMod *ctrl ) { ; }
};
#endif // _pfGUIDialogHandlers_h

File diff suppressed because it is too large Load Diff

View File

@ -1,214 +1,214 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIDialogMod Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIDialogMod_h
#define _pfGUIDialogMod_h
#include "../pnModifier/plSingleModifier.h"
#include "pfGameGUIMgr.h"
#include "hsMatrix44.h"
class plMessage;
class plPostEffectMod;
class pfGUIControlMod;
class pfGUIDialogProc;
class pfGUIListElement;
class pfGUIColorScheme;
class pfGUIDialogMod : public plSingleModifier
{
private:
pfGUIDialogMod *fNext, **fPrevPtr;
protected:
UInt32 fTagID; // 0 if none
UInt32 fVersion; // Nice for syncing to C++ code
plPostEffectMod *fRenderMod;
hsBool fEnabled;
char fName[ 128 ];
hsTArray<pfGUIControlMod *> fControls;
pfGUIControlMod *fControlOfInterest;
pfGUIControlMod *fFocusCtrl;
pfGUIControlMod *fMousedCtrl; // Which one is the mouse over?
pfGUIColorScheme *fColorScheme;
pfGUIDialogProc *fHandler;
plKey fProcReceiver; // Non-nil means we handle everything by creating notify messages and sending them to this key
hsTArray<pfGUIListElement *> fDragElements;
hsBool fDragMode, fDragReceptive;
pfGUIControlMod *fDragTarget;
pfGUIControlMod *fDragSource;
plKey fSceneNodeKey;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
void IHandleDrag( hsPoint3 &mousePt, pfGameGUIMgr::EventType event, UInt8 modifiers );
public:
enum
{
kRenderModRef = 0,
kControlRef,
kRefDerviedStart
};
enum Flags
{
kModal,
kDerivedFlagsStart
};
pfGUIDialogMod();
virtual ~pfGUIDialogMod();
CLASSNAME_REGISTER( pfGUIDialogMod );
GETINTERFACE_ANY( pfGUIDialogMod, plSingleModifier );
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
void SetSceneNodeKey( plKey &key ) { fSceneNodeKey = key; }
plKey GetSceneNodeKey( void );
virtual void SetEnabled( hsBool e );
hsBool IsEnabled( void ) { return fEnabled; }
const char *GetName( void ) { return fName; }
void ScreenToWorldPoint( hsScalar x, hsScalar y, hsScalar z, hsPoint3 &outPt );
hsPoint3 WorldToScreenPoint( const hsPoint3 &inPt );
virtual hsBool HandleMouseEvent( pfGameGUIMgr::EventType event, hsScalar mouseX, hsScalar mouseY, UInt8 modifiers );
hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers );
hsBool HandleKeyPress( char key, UInt8 modifiers );
void UpdateInterestingThings( hsScalar mouseX, hsScalar mouseY, UInt8 modifiers, hsBool modalPreset );
void SetControlOfInterest( pfGUIControlMod *c );
pfGUIControlMod *GetControlOfInterest( void ) const { return fControlOfInterest; }
UInt32 GetDesiredCursor( void ) const;
void UpdateAspectRatio( void );
void UpdateAllBounds( void );
void RefreshAllControls( void );
void AddControl( pfGUIControlMod *ctrl );
UInt32 GetNumControls( void ) { return fControls.GetCount(); }
pfGUIControlMod *GetControl( UInt32 idx ) { return fControls[ idx ]; }
pfGUIColorScheme *GetColorScheme( void ) const { return fColorScheme; }
void LinkToList( pfGUIDialogMod **prevPtr )
{
fNext = *prevPtr;
if( *prevPtr )
(*prevPtr)->fPrevPtr = &fNext;
fPrevPtr = prevPtr;
*prevPtr = this;
}
void Unlink( void )
{
if( fNext )
fNext->fPrevPtr = fPrevPtr;
*fPrevPtr = fNext;
fPrevPtr = nil;
fNext = nil;
}
void SetFocus( pfGUIControlMod *ctrl );
void Show( void );
void ShowNoReset( void );
void Hide( void );
hsBool IsVisible( void ) { return IsEnabled(); }
pfGUIControlMod *GetFocus( void ) { return fFocusCtrl; }
pfGUIDialogMod *GetNext( void ) { return fNext; }
UInt32 GetTagID( void ) { return fTagID; }
pfGUIControlMod *GetControlFromTag( UInt32 tagID );
void SetHandler( pfGUIDialogProc *hdlr );
pfGUIDialogProc *GetHandler( void ) const { return fHandler; }
plPostEffectMod *GetRenderMod( void ) const { return fRenderMod; }
// This sets the handler for the dialog and ALL of its controls
void SetHandlerForAll( pfGUIDialogProc *hdlr );
// Just a little macro-type thing here
void SetControlHandler( UInt32 tagID, pfGUIDialogProc *hdlr );
/// Methods for doing drag & drop of listElements
void ClearDragList( void );
void AddToDragList( pfGUIListElement *e );
void EnterDragMode( pfGUIControlMod *source );
UInt32 GetVersion( void ) const { return fVersion; }
// Export only
void SetRenderMod( plPostEffectMod *mod ) { fRenderMod = mod; }
void SetName( const char *name ) { hsStrncpy( fName, name, sizeof( fName ) - 1 ); }
void AddControlOnExport( pfGUIControlMod *ctrl );
void SetTagID( UInt32 id ) { fTagID = id; }
void SetProcReceiver( plKey key ) { fProcReceiver = key; }
void SetVersion( UInt32 version ) { fVersion = version; }
};
#endif // _pfGUIDialogMod_h
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIDialogMod Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIDialogMod_h
#define _pfGUIDialogMod_h
#include "../pnModifier/plSingleModifier.h"
#include "pfGameGUIMgr.h"
#include "hsMatrix44.h"
class plMessage;
class plPostEffectMod;
class pfGUIControlMod;
class pfGUIDialogProc;
class pfGUIListElement;
class pfGUIColorScheme;
class pfGUIDialogMod : public plSingleModifier
{
private:
pfGUIDialogMod *fNext, **fPrevPtr;
protected:
UInt32 fTagID; // 0 if none
UInt32 fVersion; // Nice for syncing to C++ code
plPostEffectMod *fRenderMod;
hsBool fEnabled;
char fName[ 128 ];
hsTArray<pfGUIControlMod *> fControls;
pfGUIControlMod *fControlOfInterest;
pfGUIControlMod *fFocusCtrl;
pfGUIControlMod *fMousedCtrl; // Which one is the mouse over?
pfGUIColorScheme *fColorScheme;
pfGUIDialogProc *fHandler;
plKey fProcReceiver; // Non-nil means we handle everything by creating notify messages and sending them to this key
hsTArray<pfGUIListElement *> fDragElements;
hsBool fDragMode, fDragReceptive;
pfGUIControlMod *fDragTarget;
pfGUIControlMod *fDragSource;
plKey fSceneNodeKey;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
void IHandleDrag( hsPoint3 &mousePt, pfGameGUIMgr::EventType event, UInt8 modifiers );
public:
enum
{
kRenderModRef = 0,
kControlRef,
kRefDerviedStart
};
enum Flags
{
kModal,
kDerivedFlagsStart
};
pfGUIDialogMod();
virtual ~pfGUIDialogMod();
CLASSNAME_REGISTER( pfGUIDialogMod );
GETINTERFACE_ANY( pfGUIDialogMod, plSingleModifier );
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
void SetSceneNodeKey( plKey &key ) { fSceneNodeKey = key; }
plKey GetSceneNodeKey( void );
virtual void SetEnabled( hsBool e );
hsBool IsEnabled( void ) { return fEnabled; }
const char *GetName( void ) { return fName; }
void ScreenToWorldPoint( hsScalar x, hsScalar y, hsScalar z, hsPoint3 &outPt );
hsPoint3 WorldToScreenPoint( const hsPoint3 &inPt );
virtual hsBool HandleMouseEvent( pfGameGUIMgr::EventType event, hsScalar mouseX, hsScalar mouseY, UInt8 modifiers );
hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers );
hsBool HandleKeyPress( char key, UInt8 modifiers );
void UpdateInterestingThings( hsScalar mouseX, hsScalar mouseY, UInt8 modifiers, hsBool modalPreset );
void SetControlOfInterest( pfGUIControlMod *c );
pfGUIControlMod *GetControlOfInterest( void ) const { return fControlOfInterest; }
UInt32 GetDesiredCursor( void ) const;
void UpdateAspectRatio( void );
void UpdateAllBounds( void );
void RefreshAllControls( void );
void AddControl( pfGUIControlMod *ctrl );
UInt32 GetNumControls( void ) { return fControls.GetCount(); }
pfGUIControlMod *GetControl( UInt32 idx ) { return fControls[ idx ]; }
pfGUIColorScheme *GetColorScheme( void ) const { return fColorScheme; }
void LinkToList( pfGUIDialogMod **prevPtr )
{
fNext = *prevPtr;
if( *prevPtr )
(*prevPtr)->fPrevPtr = &fNext;
fPrevPtr = prevPtr;
*prevPtr = this;
}
void Unlink( void )
{
if( fNext )
fNext->fPrevPtr = fPrevPtr;
*fPrevPtr = fNext;
fPrevPtr = nil;
fNext = nil;
}
void SetFocus( pfGUIControlMod *ctrl );
void Show( void );
void ShowNoReset( void );
void Hide( void );
hsBool IsVisible( void ) { return IsEnabled(); }
pfGUIControlMod *GetFocus( void ) { return fFocusCtrl; }
pfGUIDialogMod *GetNext( void ) { return fNext; }
UInt32 GetTagID( void ) { return fTagID; }
pfGUIControlMod *GetControlFromTag( UInt32 tagID );
void SetHandler( pfGUIDialogProc *hdlr );
pfGUIDialogProc *GetHandler( void ) const { return fHandler; }
plPostEffectMod *GetRenderMod( void ) const { return fRenderMod; }
// This sets the handler for the dialog and ALL of its controls
void SetHandlerForAll( pfGUIDialogProc *hdlr );
// Just a little macro-type thing here
void SetControlHandler( UInt32 tagID, pfGUIDialogProc *hdlr );
/// Methods for doing drag & drop of listElements
void ClearDragList( void );
void AddToDragList( pfGUIListElement *e );
void EnterDragMode( pfGUIControlMod *source );
UInt32 GetVersion( void ) const { return fVersion; }
// Export only
void SetRenderMod( plPostEffectMod *mod ) { fRenderMod = mod; }
void SetName( const char *name ) { hsStrncpy( fName, name, sizeof( fName ) - 1 ); }
void AddControlOnExport( pfGUIControlMod *ctrl );
void SetTagID( UInt32 id ) { fTagID = id; }
void SetProcReceiver( plKey key ) { fProcReceiver = key; }
void SetVersion( UInt32 version ) { fVersion = version; }
};
#endif // _pfGUIDialogMod_h

View File

@ -1,147 +1,147 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIDialogNotifyProc //
// //
// Helper dialog proc that takes all control events and turns them into //
// notify messages that get sent out. //
//////////////////////////////////////////////////////////////////////////////
#include "pfGUIDialogNotifyProc.h"
#include "hsTypes.h"
#include "pfGameGUIMgr.h"
#include "pfGUIDialogMod.h"
#include "pfGUIControlMod.h"
#include "pfGUIDialogHandlers.h"
#include "pfGUIListElement.h"
#include "pfGUIButtonMod.h" // Next three are for notify stuff
#include "pfGUIListBoxMod.h"
#include "pfGUIEditBoxMod.h"
#include "../pfMessage/pfGUINotifyMsg.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
pfGUIDialogNotifyProc::pfGUIDialogNotifyProc( plKey &r )
{
fReceiver = r;
}
void pfGUIDialogNotifyProc::ISendNotify( plKey ctrlKey, UInt32 event )
{
pfGUINotifyMsg *notify = TRACKED_NEW pfGUINotifyMsg( fDialog->GetKey(), fReceiver, nil );
notify->SetEvent( ctrlKey, event );
plgDispatch::MsgSend( notify );
}
void pfGUIDialogNotifyProc::DoSomething( pfGUIControlMod *ctrl )
{
if( pfGUIButtonMod::ConvertNoRef( ctrl ) != nil ||
pfGUIListBoxMod::ConvertNoRef( ctrl ) != nil ||
pfGUIEditBoxMod::ConvertNoRef( ctrl ) != nil )
{
// only fire the button if it is triggering
// ... all other types just fire
pfGUIButtonMod* btn = pfGUIButtonMod::ConvertNoRef( ctrl );
if ( !btn || btn->IsTriggering() )
ISendNotify( ctrl->GetKey(), pfGUINotifyMsg::kAction );
}
else
ISendNotify( ctrl->GetKey(), pfGUINotifyMsg::kValueChanged );
}
void pfGUIDialogNotifyProc::OnInit( void )
{
if ( fDialog )
ISendNotify( fDialog->GetKey(), pfGUINotifyMsg::kDialogLoaded );
else
ISendNotify( nil, pfGUINotifyMsg::kDialogLoaded );
}
void pfGUIDialogNotifyProc::OnShow( void )
{
if ( fDialog )
ISendNotify( fDialog->GetKey(), pfGUINotifyMsg::kShowHide );
else
ISendNotify( nil, pfGUINotifyMsg::kShowHide );
}
void pfGUIDialogNotifyProc::OnHide( void )
{
if ( fDialog )
ISendNotify( fDialog->GetKey(), pfGUINotifyMsg::kShowHide );
else
ISendNotify( nil, pfGUINotifyMsg::kShowHide );
}
void pfGUIDialogNotifyProc::OnDestroy( void )
{
}
void pfGUIDialogNotifyProc::OnControlEvent( ControlEvt event )
{
if( event == kExitMode )
ISendNotify( ( fDialog != nil ) ? fDialog->GetKey() : nil, pfGUINotifyMsg::kExitMode );
}
// Called when the dialog's focused control changes
void pfGUIDialogNotifyProc::OnCtrlFocusChange( pfGUIControlMod *oldCtrl, pfGUIControlMod *newCtrl )
{
if ( newCtrl )
ISendNotify( newCtrl->GetKey(), pfGUINotifyMsg::kFocusChange);
else
ISendNotify( nil, pfGUINotifyMsg::kFocusChange);
}
void pfGUIDialogNotifyProc::OnInterestingEvent( pfGUIControlMod *ctrl )
{
ISendNotify( ( ctrl != nil ) ? ctrl->GetKey() : nil, pfGUINotifyMsg::kInterestingEvent );
}
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIDialogNotifyProc //
// //
// Helper dialog proc that takes all control events and turns them into //
// notify messages that get sent out. //
//////////////////////////////////////////////////////////////////////////////
#include "pfGUIDialogNotifyProc.h"
#include "hsTypes.h"
#include "pfGameGUIMgr.h"
#include "pfGUIDialogMod.h"
#include "pfGUIControlMod.h"
#include "pfGUIDialogHandlers.h"
#include "pfGUIListElement.h"
#include "pfGUIButtonMod.h" // Next three are for notify stuff
#include "pfGUIListBoxMod.h"
#include "pfGUIEditBoxMod.h"
#include "../pfMessage/pfGUINotifyMsg.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
pfGUIDialogNotifyProc::pfGUIDialogNotifyProc( plKey &r )
{
fReceiver = r;
}
void pfGUIDialogNotifyProc::ISendNotify( plKey ctrlKey, UInt32 event )
{
pfGUINotifyMsg *notify = TRACKED_NEW pfGUINotifyMsg( fDialog->GetKey(), fReceiver, nil );
notify->SetEvent( ctrlKey, event );
plgDispatch::MsgSend( notify );
}
void pfGUIDialogNotifyProc::DoSomething( pfGUIControlMod *ctrl )
{
if( pfGUIButtonMod::ConvertNoRef( ctrl ) != nil ||
pfGUIListBoxMod::ConvertNoRef( ctrl ) != nil ||
pfGUIEditBoxMod::ConvertNoRef( ctrl ) != nil )
{
// only fire the button if it is triggering
// ... all other types just fire
pfGUIButtonMod* btn = pfGUIButtonMod::ConvertNoRef( ctrl );
if ( !btn || btn->IsTriggering() )
ISendNotify( ctrl->GetKey(), pfGUINotifyMsg::kAction );
}
else
ISendNotify( ctrl->GetKey(), pfGUINotifyMsg::kValueChanged );
}
void pfGUIDialogNotifyProc::OnInit( void )
{
if ( fDialog )
ISendNotify( fDialog->GetKey(), pfGUINotifyMsg::kDialogLoaded );
else
ISendNotify( nil, pfGUINotifyMsg::kDialogLoaded );
}
void pfGUIDialogNotifyProc::OnShow( void )
{
if ( fDialog )
ISendNotify( fDialog->GetKey(), pfGUINotifyMsg::kShowHide );
else
ISendNotify( nil, pfGUINotifyMsg::kShowHide );
}
void pfGUIDialogNotifyProc::OnHide( void )
{
if ( fDialog )
ISendNotify( fDialog->GetKey(), pfGUINotifyMsg::kShowHide );
else
ISendNotify( nil, pfGUINotifyMsg::kShowHide );
}
void pfGUIDialogNotifyProc::OnDestroy( void )
{
}
void pfGUIDialogNotifyProc::OnControlEvent( ControlEvt event )
{
if( event == kExitMode )
ISendNotify( ( fDialog != nil ) ? fDialog->GetKey() : nil, pfGUINotifyMsg::kExitMode );
}
// Called when the dialog's focused control changes
void pfGUIDialogNotifyProc::OnCtrlFocusChange( pfGUIControlMod *oldCtrl, pfGUIControlMod *newCtrl )
{
if ( newCtrl )
ISendNotify( newCtrl->GetKey(), pfGUINotifyMsg::kFocusChange);
else
ISendNotify( nil, pfGUINotifyMsg::kFocusChange);
}
void pfGUIDialogNotifyProc::OnInterestingEvent( pfGUIControlMod *ctrl )
{
ISendNotify( ( ctrl != nil ) ? ctrl->GetKey() : nil, pfGUINotifyMsg::kInterestingEvent );
}

View File

@ -1,82 +1,82 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIDialogNotifyProc Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIDialogNotifyProc_h
#define _pfGUIDialogNotifyProc_h
#include "pfGUIDialogHandlers.h"
#include "../pnKeyedObject/plKey.h"
class plGUIControlMod;
//// pfGUIDialogNotifyProc Definition ////////////////////////////////////////
// Helper dialog proc that takes all control events and turns them into
// notify messages that get sent out.
class pfGUIDialogNotifyProc : public pfGUIDialogProc
{
protected:
plKey fReceiver;
void ISendNotify( plKey ctrlKey, UInt32 event );
public:
pfGUIDialogNotifyProc( plKey &r );
virtual void DoSomething( pfGUIControlMod *ctrl );
virtual void OnInit( void );
virtual void OnShow( void );
virtual void OnHide( void );
virtual void OnDestroy( void );
virtual void OnCtrlFocusChange( pfGUIControlMod *oldCtrl, pfGUIControlMod *newCtrl );
virtual void OnControlEvent( ControlEvt event );
virtual void OnInterestingEvent( pfGUIControlMod *ctrl );
};
#endif // _pfGUIDialogNotifyProc_h
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIDialogNotifyProc Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIDialogNotifyProc_h
#define _pfGUIDialogNotifyProc_h
#include "pfGUIDialogHandlers.h"
#include "../pnKeyedObject/plKey.h"
class plGUIControlMod;
//// pfGUIDialogNotifyProc Definition ////////////////////////////////////////
// Helper dialog proc that takes all control events and turns them into
// notify messages that get sent out.
class pfGUIDialogNotifyProc : public pfGUIDialogProc
{
protected:
plKey fReceiver;
void ISendNotify( plKey ctrlKey, UInt32 event );
public:
pfGUIDialogNotifyProc( plKey &r );
virtual void DoSomething( pfGUIControlMod *ctrl );
virtual void OnInit( void );
virtual void OnShow( void );
virtual void OnHide( void );
virtual void OnDestroy( void );
virtual void OnCtrlFocusChange( pfGUIControlMod *oldCtrl, pfGUIControlMod *newCtrl );
virtual void OnControlEvent( ControlEvt event );
virtual void OnInterestingEvent( pfGUIControlMod *ctrl );
};
#endif // _pfGUIDialogNotifyProc_h

View File

@ -1,165 +1,165 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIDragBarCtrl Definition //
// //
// DragBars are draggable controls that take their dialogs along with //
// them. Because they're essentially part of the dialog directly (the part //
// that can be dragged), they're processed after the normal hit testing. //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIDragBarCtrl.h"
#include "pfGameGUIMgr.h"
#include "pfGUIDialogMod.h"
#include "../plInputCore/plInputInterface.h"
#include "../pnMessage/plRefMsg.h"
#include "../pfMessage/pfGameGUIMsg.h"
#include "../plMessage/plAnimCmdMsg.h"
#include "../plAvatar/plAGModifier.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIDragBarCtrl::pfGUIDragBarCtrl()
{
SetFlag( kWantsInterest );
fDragging = false;
fAnchored = false;
}
pfGUIDragBarCtrl::~pfGUIDragBarCtrl()
{
}
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIDragBarCtrl::IEval( double secs, hsScalar del, UInt32 dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
//// MsgReceive //////////////////////////////////////////////////////////////
hsBool pfGUIDragBarCtrl::MsgReceive( plMessage *msg )
{
return pfGUIControlMod::MsgReceive( msg );
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUIDragBarCtrl::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Read(s, mgr);
}
void pfGUIDragBarCtrl::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Write( s, mgr );
}
//// UpdateBounds ////////////////////////////////////////////////////////////
void pfGUIDragBarCtrl::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool force )
{
pfGUIControlMod::UpdateBounds( invXformMatrix, force );
fBoundsValid = false;
}
//// HandleMouseDown/Up //////////////////////////////////////////////////////
void pfGUIDragBarCtrl::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
{
// if we are anchored <to the floor> then don't let it be moved
if ( fAnchored )
return;
fDragging = true;
fDragOffset = fScreenCenter - mousePt;
SetObjectCenter( mousePt.fX + fDragOffset.fX, mousePt.fY + fDragOffset.fY );
// We know that the entire dialog is going to move, so we better make
// sure to update the bounds on all the controls
fDialog->UpdateAllBounds();
}
void pfGUIDragBarCtrl::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
{
// if we are anchored <to the floor> then don't let it be moved
if ( fAnchored )
return;
fDragging = false;
SetObjectCenter( mousePt.fX + fDragOffset.fX, mousePt.fY + fDragOffset.fY );
fDialog->UpdateAllBounds();
}
void pfGUIDragBarCtrl::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
{
// if we are anchored <to the floor> then don't let it be moved
if ( fAnchored )
return;
SetObjectCenter( mousePt.fX + fDragOffset.fX, mousePt.fY + fDragOffset.fY );
fDialog->UpdateAllBounds();
}
//// IGetDesiredCursor ///////////////////////////////////////////////////////
UInt32 pfGUIDragBarCtrl::IGetDesiredCursor( void ) const
{
// if we are anchored, then no cursors that say we can move
if ( fAnchored )
return 0;
if( fDragging )
return plInputInterface::kCursor4WayDragging;
return plInputInterface::kCursor4WayDraggable;
}
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIDragBarCtrl Definition //
// //
// DragBars are draggable controls that take their dialogs along with //
// them. Because they're essentially part of the dialog directly (the part //
// that can be dragged), they're processed after the normal hit testing. //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIDragBarCtrl.h"
#include "pfGameGUIMgr.h"
#include "pfGUIDialogMod.h"
#include "../plInputCore/plInputInterface.h"
#include "../pnMessage/plRefMsg.h"
#include "../pfMessage/pfGameGUIMsg.h"
#include "../plMessage/plAnimCmdMsg.h"
#include "../plAvatar/plAGModifier.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIDragBarCtrl::pfGUIDragBarCtrl()
{
SetFlag( kWantsInterest );
fDragging = false;
fAnchored = false;
}
pfGUIDragBarCtrl::~pfGUIDragBarCtrl()
{
}
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIDragBarCtrl::IEval( double secs, hsScalar del, UInt32 dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
//// MsgReceive //////////////////////////////////////////////////////////////
hsBool pfGUIDragBarCtrl::MsgReceive( plMessage *msg )
{
return pfGUIControlMod::MsgReceive( msg );
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUIDragBarCtrl::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Read(s, mgr);
}
void pfGUIDragBarCtrl::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Write( s, mgr );
}
//// UpdateBounds ////////////////////////////////////////////////////////////
void pfGUIDragBarCtrl::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool force )
{
pfGUIControlMod::UpdateBounds( invXformMatrix, force );
fBoundsValid = false;
}
//// HandleMouseDown/Up //////////////////////////////////////////////////////
void pfGUIDragBarCtrl::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
{
// if we are anchored <to the floor> then don't let it be moved
if ( fAnchored )
return;
fDragging = true;
fDragOffset = fScreenCenter - mousePt;
SetObjectCenter( mousePt.fX + fDragOffset.fX, mousePt.fY + fDragOffset.fY );
// We know that the entire dialog is going to move, so we better make
// sure to update the bounds on all the controls
fDialog->UpdateAllBounds();
}
void pfGUIDragBarCtrl::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
{
// if we are anchored <to the floor> then don't let it be moved
if ( fAnchored )
return;
fDragging = false;
SetObjectCenter( mousePt.fX + fDragOffset.fX, mousePt.fY + fDragOffset.fY );
fDialog->UpdateAllBounds();
}
void pfGUIDragBarCtrl::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
{
// if we are anchored <to the floor> then don't let it be moved
if ( fAnchored )
return;
SetObjectCenter( mousePt.fX + fDragOffset.fX, mousePt.fY + fDragOffset.fY );
fDialog->UpdateAllBounds();
}
//// IGetDesiredCursor ///////////////////////////////////////////////////////
UInt32 pfGUIDragBarCtrl::IGetDesiredCursor( void ) const
{
// if we are anchored, then no cursors that say we can move
if ( fAnchored )
return 0;
if( fDragging )
return plInputInterface::kCursor4WayDragging;
return plInputInterface::kCursor4WayDraggable;
}

View File

@ -1,93 +1,93 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIDragBarCtrl Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIDragBarCtrl_h
#define _pfGUIDragBarCtrl_h
#include "pfGUIControlMod.h"
class plMessage;
class pfGUIDragBarCtrl : public pfGUIControlMod
{
protected:
hsPoint3 fDragOffset;
hsBool fDragging;
hsBool fAnchored;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual UInt32 IGetDesiredCursor( void ) const; // As specified in plInputInterface.h
public:
pfGUIDragBarCtrl();
virtual ~pfGUIDragBarCtrl();
CLASSNAME_REGISTER( pfGUIDragBarCtrl );
GETINTERFACE_ANY( pfGUIDragBarCtrl, pfGUIControlMod );
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void SetAnchored( hsBool anchored ) { fAnchored = anchored; }
virtual hsBool IsAnchored(void) { return fAnchored; }
virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false );
// Export only
};
#endif // _pfGUIDragBarCtrl_h
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIDragBarCtrl Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIDragBarCtrl_h
#define _pfGUIDragBarCtrl_h
#include "pfGUIControlMod.h"
class plMessage;
class pfGUIDragBarCtrl : public pfGUIControlMod
{
protected:
hsPoint3 fDragOffset;
hsBool fDragging;
hsBool fAnchored;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual UInt32 IGetDesiredCursor( void ) const; // As specified in plInputInterface.h
public:
pfGUIDragBarCtrl();
virtual ~pfGUIDragBarCtrl();
CLASSNAME_REGISTER( pfGUIDragBarCtrl );
GETINTERFACE_ANY( pfGUIDragBarCtrl, pfGUIControlMod );
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void SetAnchored( hsBool anchored ) { fAnchored = anchored; }
virtual hsBool IsAnchored(void) { return fAnchored; }
virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false );
// Export only
};
#endif // _pfGUIDragBarCtrl_h

View File

@ -1,181 +1,181 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIDraggableMod Definition //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIDraggableMod.h"
#include "pfGameGUIMgr.h"
#include "../pnMessage/plRefMsg.h"
#include "../pfMessage/pfGameGUIMsg.h"
#include "../plMessage/plAnimCmdMsg.h"
#include "../plAvatar/plAGModifier.h"
#include "../plInputCore/plInputInterface.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIDraggableMod::pfGUIDraggableMod()
{
SetFlag( kWantsInterest );
fDragging = false;
}
pfGUIDraggableMod::~pfGUIDraggableMod()
{
}
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIDraggableMod::IEval( double secs, hsScalar del, UInt32 dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
//// MsgReceive //////////////////////////////////////////////////////////////
hsBool pfGUIDraggableMod::MsgReceive( plMessage *msg )
{
return pfGUIControlMod::MsgReceive( msg );
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUIDraggableMod::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Read(s, mgr);
}
void pfGUIDraggableMod::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Write( s, mgr );
}
//// UpdateBounds ////////////////////////////////////////////////////////////
void pfGUIDraggableMod::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool force )
{
pfGUIControlMod::UpdateBounds( invXformMatrix, force );
fBoundsValid = false;
}
//// HandleMouseDown/Up //////////////////////////////////////////////////////
void pfGUIDraggableMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
{
if( !fDragging )
{
fLastMousePt = mousePt;
fOrigCenter = fScreenCenter;
fDragging = true;
fDragOffset = fScreenCenter - mousePt;
SetObjectCenter( mousePt.fX + fDragOffset.fX, mousePt.fY + fDragOffset.fY );
HandleExtendedEvent( kStartingDrag );
}
}
void pfGUIDraggableMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
{
if( fDragging )
{
fLastMousePt = mousePt;
fDragging = false;
SetObjectCenter( mousePt.fX + fDragOffset.fX, mousePt.fY + fDragOffset.fY );
DoSomething();
if( HasFlag( kAlwaysSnapBackToStart ) )
SetObjectCenter( fOrigCenter.fX, fOrigCenter.fY );
}
}
void pfGUIDraggableMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
{
if( fDragging )
{
fLastMousePt = mousePt;
SetObjectCenter( mousePt.fX + fDragOffset.fX, mousePt.fY + fDragOffset.fY );
if( HasFlag( kReportDragging ) )
HandleExtendedEvent( kDragging );
}
}
//// IGetDesiredCursor ///////////////////////////////////////////////////////
UInt32 pfGUIDraggableMod::IGetDesiredCursor( void ) const
{
// if we are anchored, then no cursors that say we can move
if( fDragging )
{
if( HasFlag( kHideCursorWhileDragging ) )
return plInputInterface::kCursorHidden;
return plInputInterface::kCursor4WayDragging;
}
return plInputInterface::kCursor4WayDraggable;
}
void pfGUIDraggableMod::StopDragging( hsBool cancel )
{
if( fDragging )
{
fDragging = false;
if( cancel )
HandleExtendedEvent( kCancelled );
if( HasFlag( kAlwaysSnapBackToStart ) )
SetObjectCenter( fOrigCenter.fX, fOrigCenter.fY );
}
}
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIDraggableMod Definition //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIDraggableMod.h"
#include "pfGameGUIMgr.h"
#include "../pnMessage/plRefMsg.h"
#include "../pfMessage/pfGameGUIMsg.h"
#include "../plMessage/plAnimCmdMsg.h"
#include "../plAvatar/plAGModifier.h"
#include "../plInputCore/plInputInterface.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIDraggableMod::pfGUIDraggableMod()
{
SetFlag( kWantsInterest );
fDragging = false;
}
pfGUIDraggableMod::~pfGUIDraggableMod()
{
}
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIDraggableMod::IEval( double secs, hsScalar del, UInt32 dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
//// MsgReceive //////////////////////////////////////////////////////////////
hsBool pfGUIDraggableMod::MsgReceive( plMessage *msg )
{
return pfGUIControlMod::MsgReceive( msg );
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUIDraggableMod::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Read(s, mgr);
}
void pfGUIDraggableMod::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Write( s, mgr );
}
//// UpdateBounds ////////////////////////////////////////////////////////////
void pfGUIDraggableMod::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool force )
{
pfGUIControlMod::UpdateBounds( invXformMatrix, force );
fBoundsValid = false;
}
//// HandleMouseDown/Up //////////////////////////////////////////////////////
void pfGUIDraggableMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
{
if( !fDragging )
{
fLastMousePt = mousePt;
fOrigCenter = fScreenCenter;
fDragging = true;
fDragOffset = fScreenCenter - mousePt;
SetObjectCenter( mousePt.fX + fDragOffset.fX, mousePt.fY + fDragOffset.fY );
HandleExtendedEvent( kStartingDrag );
}
}
void pfGUIDraggableMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
{
if( fDragging )
{
fLastMousePt = mousePt;
fDragging = false;
SetObjectCenter( mousePt.fX + fDragOffset.fX, mousePt.fY + fDragOffset.fY );
DoSomething();
if( HasFlag( kAlwaysSnapBackToStart ) )
SetObjectCenter( fOrigCenter.fX, fOrigCenter.fY );
}
}
void pfGUIDraggableMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
{
if( fDragging )
{
fLastMousePt = mousePt;
SetObjectCenter( mousePt.fX + fDragOffset.fX, mousePt.fY + fDragOffset.fY );
if( HasFlag( kReportDragging ) )
HandleExtendedEvent( kDragging );
}
}
//// IGetDesiredCursor ///////////////////////////////////////////////////////
UInt32 pfGUIDraggableMod::IGetDesiredCursor( void ) const
{
// if we are anchored, then no cursors that say we can move
if( fDragging )
{
if( HasFlag( kHideCursorWhileDragging ) )
return plInputInterface::kCursorHidden;
return plInputInterface::kCursor4WayDragging;
}
return plInputInterface::kCursor4WayDraggable;
}
void pfGUIDraggableMod::StopDragging( hsBool cancel )
{
if( fDragging )
{
fDragging = false;
if( cancel )
HandleExtendedEvent( kCancelled );
if( HasFlag( kAlwaysSnapBackToStart ) )
SetObjectCenter( fOrigCenter.fX, fOrigCenter.fY );
}
}

View File

@ -1,106 +1,106 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIDraggableMod Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIDraggableMod_h
#define _pfGUIDraggableMod_h
#include "pfGUIControlMod.h"
class plMessage;
class pfGUIDraggableMod : public pfGUIControlMod
{
protected:
hsPoint3 fDragOffset, fLastMousePt;
hsPoint3 fOrigCenter;
hsBool fDragging;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual UInt32 IGetDesiredCursor( void ) const; // As specified in plInputInterface.h
public:
pfGUIDraggableMod();
virtual ~pfGUIDraggableMod();
CLASSNAME_REGISTER( pfGUIDraggableMod );
GETINTERFACE_ANY( pfGUIDraggableMod, pfGUIControlMod );
enum OurFlags
{
kReportDragging = kDerivedFlagsStart,
kHideCursorWhileDragging,
kAlwaysSnapBackToStart
};
// Extended event types (endDrag is the default event)
enum ExtendedEvents
{
kDragging,
kCancelled,
kStartingDrag
};
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false );
void StopDragging( hsBool cancel );
const hsPoint3 &GetLastMousePt( void ) const { return fLastMousePt; }
};
#endif // _pfGUIDraggableMod_h
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIDraggableMod Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIDraggableMod_h
#define _pfGUIDraggableMod_h
#include "pfGUIControlMod.h"
class plMessage;
class pfGUIDraggableMod : public pfGUIControlMod
{
protected:
hsPoint3 fDragOffset, fLastMousePt;
hsPoint3 fOrigCenter;
hsBool fDragging;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual UInt32 IGetDesiredCursor( void ) const; // As specified in plInputInterface.h
public:
pfGUIDraggableMod();
virtual ~pfGUIDraggableMod();
CLASSNAME_REGISTER( pfGUIDraggableMod );
GETINTERFACE_ANY( pfGUIDraggableMod, pfGUIControlMod );
enum OurFlags
{
kReportDragging = kDerivedFlagsStart,
kHideCursorWhileDragging,
kAlwaysSnapBackToStart
};
// Extended event types (endDrag is the default event)
enum ExtendedEvents
{
kDragging,
kCancelled,
kStartingDrag
};
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false );
void StopDragging( hsBool cancel );
const hsPoint3 &GetLastMousePt( void ) const { return fLastMousePt; }
};
#endif // _pfGUIDraggableMod_h

View File

@ -1,185 +1,185 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIDynDisplayCtrl Definition //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIDynDisplayCtrl.h"
#include "pfGameGUIMgr.h"
#include "../pnMessage/plRefMsg.h"
#include "../plGImage/plDynamicTextMap.h"
#include "../plSurface/plLayerInterface.h"
#include "../plSurface/hsGMaterial.h"
#include "../plPipeline/plTextGenerator.h"
#include "plPipeline.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIDynDisplayCtrl::pfGUIDynDisplayCtrl()
{
SetFlag( kIntangible );
}
pfGUIDynDisplayCtrl::~pfGUIDynDisplayCtrl()
{
}
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIDynDisplayCtrl::IEval( double secs, hsScalar del, UInt32 dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
//// MsgReceive //////////////////////////////////////////////////////////////
hsBool pfGUIDynDisplayCtrl::MsgReceive( plMessage *msg )
{
plGenRefMsg *refMsg = plGenRefMsg::ConvertNoRef( msg );
if( refMsg != nil )
{
if( refMsg->fType == kRefTextMap )
{
if( refMsg->GetContext() & ( plRefMsg::kOnCreate | plRefMsg::kOnRequest | plRefMsg::kOnReplace ) )
fTextMaps[ refMsg->fWhich ] = plDynamicTextMap::ConvertNoRef( refMsg->GetRef() );
else
fTextMaps[ refMsg->fWhich ] = nil;
return true;
}
else if( refMsg->fType == kRefLayer )
{
if( refMsg->GetContext() & ( plRefMsg::kOnCreate | plRefMsg::kOnRequest | plRefMsg::kOnReplace ) )
fLayers[ refMsg->fWhich ] = plLayerInterface::ConvertNoRef( refMsg->GetRef() );
else
fLayers[ refMsg->fWhich ] = nil;
return true;
}
else if( refMsg->fType == kRefMaterial )
{
if( refMsg->GetContext() & ( plRefMsg::kOnCreate | plRefMsg::kOnRequest | plRefMsg::kOnReplace ) )
fMaterials[ refMsg->fWhich ] = hsGMaterial::ConvertNoRef( refMsg->GetRef() );
else
fMaterials[ refMsg->fWhich ] = nil;
}
}
return pfGUIControlMod::MsgReceive( msg );
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUIDynDisplayCtrl::Read( hsStream *s, hsResMgr *mgr )
{
UInt32 count, i;
pfGUIControlMod::Read(s, mgr);
count = s->ReadSwap32();
fTextMaps.SetCountAndZero( count );
for( i = 0; i < count; i++ )
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefTextMap ), plRefFlags::kActiveRef );
count = s->ReadSwap32();
fLayers.SetCountAndZero( count );
for( i = 0; i < count; i++ )
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefLayer ), plRefFlags::kActiveRef );
count = s->ReadSwap32();
fMaterials.SetCountAndZero( count );
for( i = 0; i < count; i++ )
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefMaterial ), plRefFlags::kActiveRef );
}
void pfGUIDynDisplayCtrl::Write( hsStream *s, hsResMgr *mgr )
{
UInt32 i;
pfGUIControlMod::Write( s, mgr );
s->WriteSwap32( fTextMaps.GetCount() );
for( i = 0; i < fTextMaps.GetCount(); i++ )
mgr->WriteKey( s, fTextMaps[ i ]->GetKey() );
s->WriteSwap32( fLayers.GetCount() );
for( i = 0; i < fLayers.GetCount(); i++ )
mgr->WriteKey( s, fLayers[ i ]->GetKey() );
s->WriteSwap32( fMaterials.GetCount() );
for( i = 0; i < fMaterials.GetCount(); i++ )
mgr->WriteKey( s, fMaterials[ i ]->GetKey() );
}
//// AddMap //////////////////////////////////////////////////////////////////
// Export only
void pfGUIDynDisplayCtrl::AddMap( plDynamicTextMap *map )
{
fTextMaps.Append( map );
hsgResMgr::ResMgr()->AddViaNotify( map->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, fTextMaps.GetCount() - 1, kRefTextMap ), plRefFlags::kActiveRef );
}
//// AddLayer ////////////////////////////////////////////////////////////////
// Export only
void pfGUIDynDisplayCtrl::AddLayer( plLayerInterface *layer )
{
fLayers.Append( layer );
hsgResMgr::ResMgr()->AddViaNotify( layer->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, fLayers.GetCount() - 1, kRefLayer ), plRefFlags::kActiveRef );
}
//// AddMaterial /////////////////////////////////////////////////////////////
// Export only
void pfGUIDynDisplayCtrl::AddMaterial( hsGMaterial *material )
{
fMaterials.Append( material );
hsgResMgr::ResMgr()->AddViaNotify( material->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, fMaterials.GetCount() - 1, kRefMaterial ), plRefFlags::kActiveRef );
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIDynDisplayCtrl Definition //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIDynDisplayCtrl.h"
#include "pfGameGUIMgr.h"
#include "../pnMessage/plRefMsg.h"
#include "../plGImage/plDynamicTextMap.h"
#include "../plSurface/plLayerInterface.h"
#include "../plSurface/hsGMaterial.h"
#include "../plPipeline/plTextGenerator.h"
#include "plPipeline.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIDynDisplayCtrl::pfGUIDynDisplayCtrl()
{
SetFlag( kIntangible );
}
pfGUIDynDisplayCtrl::~pfGUIDynDisplayCtrl()
{
}
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIDynDisplayCtrl::IEval( double secs, hsScalar del, UInt32 dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
//// MsgReceive //////////////////////////////////////////////////////////////
hsBool pfGUIDynDisplayCtrl::MsgReceive( plMessage *msg )
{
plGenRefMsg *refMsg = plGenRefMsg::ConvertNoRef( msg );
if( refMsg != nil )
{
if( refMsg->fType == kRefTextMap )
{
if( refMsg->GetContext() & ( plRefMsg::kOnCreate | plRefMsg::kOnRequest | plRefMsg::kOnReplace ) )
fTextMaps[ refMsg->fWhich ] = plDynamicTextMap::ConvertNoRef( refMsg->GetRef() );
else
fTextMaps[ refMsg->fWhich ] = nil;
return true;
}
else if( refMsg->fType == kRefLayer )
{
if( refMsg->GetContext() & ( plRefMsg::kOnCreate | plRefMsg::kOnRequest | plRefMsg::kOnReplace ) )
fLayers[ refMsg->fWhich ] = plLayerInterface::ConvertNoRef( refMsg->GetRef() );
else
fLayers[ refMsg->fWhich ] = nil;
return true;
}
else if( refMsg->fType == kRefMaterial )
{
if( refMsg->GetContext() & ( plRefMsg::kOnCreate | plRefMsg::kOnRequest | plRefMsg::kOnReplace ) )
fMaterials[ refMsg->fWhich ] = hsGMaterial::ConvertNoRef( refMsg->GetRef() );
else
fMaterials[ refMsg->fWhich ] = nil;
}
}
return pfGUIControlMod::MsgReceive( msg );
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUIDynDisplayCtrl::Read( hsStream *s, hsResMgr *mgr )
{
UInt32 count, i;
pfGUIControlMod::Read(s, mgr);
count = s->ReadSwap32();
fTextMaps.SetCountAndZero( count );
for( i = 0; i < count; i++ )
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefTextMap ), plRefFlags::kActiveRef );
count = s->ReadSwap32();
fLayers.SetCountAndZero( count );
for( i = 0; i < count; i++ )
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefLayer ), plRefFlags::kActiveRef );
count = s->ReadSwap32();
fMaterials.SetCountAndZero( count );
for( i = 0; i < count; i++ )
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefMaterial ), plRefFlags::kActiveRef );
}
void pfGUIDynDisplayCtrl::Write( hsStream *s, hsResMgr *mgr )
{
UInt32 i;
pfGUIControlMod::Write( s, mgr );
s->WriteSwap32( fTextMaps.GetCount() );
for( i = 0; i < fTextMaps.GetCount(); i++ )
mgr->WriteKey( s, fTextMaps[ i ]->GetKey() );
s->WriteSwap32( fLayers.GetCount() );
for( i = 0; i < fLayers.GetCount(); i++ )
mgr->WriteKey( s, fLayers[ i ]->GetKey() );
s->WriteSwap32( fMaterials.GetCount() );
for( i = 0; i < fMaterials.GetCount(); i++ )
mgr->WriteKey( s, fMaterials[ i ]->GetKey() );
}
//// AddMap //////////////////////////////////////////////////////////////////
// Export only
void pfGUIDynDisplayCtrl::AddMap( plDynamicTextMap *map )
{
fTextMaps.Append( map );
hsgResMgr::ResMgr()->AddViaNotify( map->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, fTextMaps.GetCount() - 1, kRefTextMap ), plRefFlags::kActiveRef );
}
//// AddLayer ////////////////////////////////////////////////////////////////
// Export only
void pfGUIDynDisplayCtrl::AddLayer( plLayerInterface *layer )
{
fLayers.Append( layer );
hsgResMgr::ResMgr()->AddViaNotify( layer->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, fLayers.GetCount() - 1, kRefLayer ), plRefFlags::kActiveRef );
}
//// AddMaterial /////////////////////////////////////////////////////////////
// Export only
void pfGUIDynDisplayCtrl::AddMaterial( hsGMaterial *material )
{
fMaterials.Append( material );
hsgResMgr::ResMgr()->AddViaNotify( material->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, fMaterials.GetCount() - 1, kRefMaterial ), plRefFlags::kActiveRef );
}

View File

@ -1,113 +1,113 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIDynDisplayCtrl Header //
// //
// Fun little helper control that just stores a pointer to a single //
// plDynamicTextMap, chosen in MAX. Note that we could also just search //
// for the right key name, but that requires a StupidSearch(tm), while //
// this way just requires an extra dummy control that automatically reads //
// in the right ref (and searching for controls by TagID is a lot faster //
// than searching for keys). //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIDynDisplayCtrl_h
#define _pfGUIDynDisplayCtrl_h
#include "pfGUIControlMod.h"
#include "hsTemplates.h"
class plMessage;
class plDynamicTextMap;
class plLayerInterface;
class hsGMaterial;
class pfGUIDynDisplayCtrl : public pfGUIControlMod
{
protected:
enum
{
kRefTextMap = kRefDerivedStart,
kRefLayer,
kRefMaterial
};
hsTArray<plDynamicTextMap *> fTextMaps;
hsTArray<plLayerInterface *> fLayers;
hsTArray<hsGMaterial *> fMaterials;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
public:
pfGUIDynDisplayCtrl();
virtual ~pfGUIDynDisplayCtrl();
CLASSNAME_REGISTER( pfGUIDynDisplayCtrl );
GETINTERFACE_ANY( pfGUIDynDisplayCtrl, pfGUIControlMod );
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
UInt32 GetNumMaps( void ) const { return fTextMaps.GetCount(); }
plDynamicTextMap *GetMap( UInt32 i ) const { return fTextMaps[ i ]; }
UInt32 GetNumLayers( void ) const { return fLayers.GetCount(); }
plLayerInterface *GetLayer( UInt32 i ) const { return fLayers[ i ]; }
UInt32 GetNumMaterials( void ) const { return fMaterials.GetCount(); }
hsGMaterial *GetMaterial( UInt32 i ) const { return fMaterials[ i ]; }
// Export only
void AddMap( plDynamicTextMap *map );
void AddLayer( plLayerInterface *layer );
void AddMaterial( hsGMaterial *material );
};
#endif // _pfGUIDynDisplayCtrl_h
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIDynDisplayCtrl Header //
// //
// Fun little helper control that just stores a pointer to a single //
// plDynamicTextMap, chosen in MAX. Note that we could also just search //
// for the right key name, but that requires a StupidSearch(tm), while //
// this way just requires an extra dummy control that automatically reads //
// in the right ref (and searching for controls by TagID is a lot faster //
// than searching for keys). //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIDynDisplayCtrl_h
#define _pfGUIDynDisplayCtrl_h
#include "pfGUIControlMod.h"
#include "hsTemplates.h"
class plMessage;
class plDynamicTextMap;
class plLayerInterface;
class hsGMaterial;
class pfGUIDynDisplayCtrl : public pfGUIControlMod
{
protected:
enum
{
kRefTextMap = kRefDerivedStart,
kRefLayer,
kRefMaterial
};
hsTArray<plDynamicTextMap *> fTextMaps;
hsTArray<plLayerInterface *> fLayers;
hsTArray<hsGMaterial *> fMaterials;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
public:
pfGUIDynDisplayCtrl();
virtual ~pfGUIDynDisplayCtrl();
CLASSNAME_REGISTER( pfGUIDynDisplayCtrl );
GETINTERFACE_ANY( pfGUIDynDisplayCtrl, pfGUIControlMod );
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
UInt32 GetNumMaps( void ) const { return fTextMaps.GetCount(); }
plDynamicTextMap *GetMap( UInt32 i ) const { return fTextMaps[ i ]; }
UInt32 GetNumLayers( void ) const { return fLayers.GetCount(); }
plLayerInterface *GetLayer( UInt32 i ) const { return fLayers[ i ]; }
UInt32 GetNumMaterials( void ) const { return fMaterials.GetCount(); }
hsGMaterial *GetMaterial( UInt32 i ) const { return fMaterials[ i ]; }
// Export only
void AddMap( plDynamicTextMap *map );
void AddLayer( plLayerInterface *layer );
void AddMaterial( hsGMaterial *material );
};
#endif // _pfGUIDynDisplayCtrl_h

File diff suppressed because it is too large Load Diff

View File

@ -1,141 +1,141 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIEditBoxMod Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIEditBoxMod_h
#define _pfGUIEditBoxMod_h
#include "hsStlUtils.h"
#include "pfGUIControlMod.h"
#include "../pnInputCore/plKeyDef.h"
#include "../plInputCore/plInputDevice.h"
class plMessage;
class hsGMaterial;
class plTextGenerator;
class pfGUIEditBoxMod : public pfGUIControlMod
{
protected:
wchar_t *fBuffer;
UInt32 fBufferSize, fCursorPos;
Int32 fScrollPos;
hsBool fIgnoreNextKey, fEscapedFlag;
hsBool fFirstHalfExitKeyPushed;
hsBool fSpecialCaptureKeyEventMode;
plKeyDef fSavedKey;
UInt8 fSavedModifiers;
wchar_t fLastDeadKey; // if the previous key was a dead key, its value goes here
wchar_t fDeadKeyConverter[256][256]; // first index is the dead key, second index is the char to combine it with
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual void IPostSetUpDynTextMap( void );
virtual void IUpdate( void );
void SetupDeadKeyConverter();
public:
enum
{
kShift = 0x01,
kCtrl = 0x02
};
pfGUIEditBoxMod();
virtual ~pfGUIEditBoxMod();
CLASSNAME_REGISTER( pfGUIEditBoxMod );
GETINTERFACE_ANY( pfGUIEditBoxMod, pfGUIControlMod );
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual hsBool HandleKeyPress( char key, UInt8 modifiers );
virtual hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers );
virtual void PurgeDynaTextMapImage();
void SetBufferSize( UInt32 size );
std::string GetBuffer( void );
std::wstring GetBufferW( void ) { return fBuffer; }
void ClearBuffer( void );
void SetText( const char *str );
void SetText( const wchar_t *str );
void SetCursorToHome( void );
void SetCursorToEnd( void );
hsBool WasEscaped( void ) { hsBool e = fEscapedFlag; fEscapedFlag = false; return e; }
void SetSpecialCaptureKeyMode(hsBool state) { fSpecialCaptureKeyEventMode = state; }
UInt32 GetLastKeyCaptured() { return (UInt32)fSavedKey; }
UInt8 GetLastModifiersCaptured() { return fSavedModifiers; }
void SetLastKeyCapture(UInt32 key, UInt8 modifiers);
void SetChatMode(hsBool state) { plKeyboardDevice::IgnoreCapsLock(state); }
// Extended event types
enum ExtendedEvents
{
kValueChanging
};
};
#endif // _pfGUIEditBoxMod_h
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIEditBoxMod Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIEditBoxMod_h
#define _pfGUIEditBoxMod_h
#include "hsStlUtils.h"
#include "pfGUIControlMod.h"
#include "../pnInputCore/plKeyDef.h"
#include "../plInputCore/plInputDevice.h"
class plMessage;
class hsGMaterial;
class plTextGenerator;
class pfGUIEditBoxMod : public pfGUIControlMod
{
protected:
wchar_t *fBuffer;
UInt32 fBufferSize, fCursorPos;
Int32 fScrollPos;
hsBool fIgnoreNextKey, fEscapedFlag;
hsBool fFirstHalfExitKeyPushed;
hsBool fSpecialCaptureKeyEventMode;
plKeyDef fSavedKey;
UInt8 fSavedModifiers;
wchar_t fLastDeadKey; // if the previous key was a dead key, its value goes here
wchar_t fDeadKeyConverter[256][256]; // first index is the dead key, second index is the char to combine it with
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual void IPostSetUpDynTextMap( void );
virtual void IUpdate( void );
void SetupDeadKeyConverter();
public:
enum
{
kShift = 0x01,
kCtrl = 0x02
};
pfGUIEditBoxMod();
virtual ~pfGUIEditBoxMod();
CLASSNAME_REGISTER( pfGUIEditBoxMod );
GETINTERFACE_ANY( pfGUIEditBoxMod, pfGUIControlMod );
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual hsBool HandleKeyPress( char key, UInt8 modifiers );
virtual hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers );
virtual void PurgeDynaTextMapImage();
void SetBufferSize( UInt32 size );
std::string GetBuffer( void );
std::wstring GetBufferW( void ) { return fBuffer; }
void ClearBuffer( void );
void SetText( const char *str );
void SetText( const wchar_t *str );
void SetCursorToHome( void );
void SetCursorToEnd( void );
hsBool WasEscaped( void ) { hsBool e = fEscapedFlag; fEscapedFlag = false; return e; }
void SetSpecialCaptureKeyMode(hsBool state) { fSpecialCaptureKeyEventMode = state; }
UInt32 GetLastKeyCaptured() { return (UInt32)fSavedKey; }
UInt8 GetLastModifiersCaptured() { return fSavedModifiers; }
void SetLastKeyCapture(UInt32 key, UInt8 modifiers);
void SetChatMode(hsBool state) { plKeyboardDevice::IgnoreCapsLock(state); }
// Extended event types
enum ExtendedEvents
{
kValueChanging
};
};
#endif // _pfGUIEditBoxMod_h

View File

@ -1,384 +1,384 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIKnobCtrl Definition //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIKnobCtrl.h"
#include "pfGameGUIMgr.h"
#include "pfGUIDialogMod.h"
#include "../plInputCore/plInputInterface.h"
#include "../pnMessage/plRefMsg.h"
#include "../pfMessage/pfGameGUIMsg.h"
#include "../plMessage/plAnimCmdMsg.h"
// #include "../plAvatar/plAGModifier.h"
#include "../plAvatar/plAGMasterMod.h"
#include "../plAvatar/plAGAnimInstance.h"
#include "../plSurface/plLayerAnimation.h"
#include "../pnSceneObject/plSceneObject.h"
#include "../pnSceneObject/plCoordinateInterface.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIKnobCtrl::pfGUIKnobCtrl() :
fAnimName(nil),
fDragStart(0.f, 0.f, 0.f),
fDragging(false),
fAnimStartPos(0.f, 0.f, 0.f),
fAnimEndPos(0.f, 0.f, 0.f),
fDragRangeMin(0.f),
fDragRangeMax(0.f),
fAnimBegin(0.f),
fAnimEnd(0.f),
fAnimTimesCalced(false)
{
SetFlag( kWantsInterest );
}
pfGUIKnobCtrl::~pfGUIKnobCtrl()
{
delete [] fAnimName;
}
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIKnobCtrl::IEval( double secs, hsScalar del, UInt32 dirty )
{
return pfGUIValueCtrl::IEval( secs, del, dirty );
}
//// MsgReceive //////////////////////////////////////////////////////////////
hsBool pfGUIKnobCtrl::MsgReceive( plMessage *msg )
{
return pfGUIValueCtrl::MsgReceive( msg );
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUIKnobCtrl::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIValueCtrl::Read(s, mgr);
fAnimationKeys.Reset();
UInt32 i, count = s->ReadSwap32();
for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) );
fAnimName = s->ReadSafeString();
fAnimTimesCalced = false;
fAnimStartPos.Read( s );
fAnimEndPos.Read( s );
}
void pfGUIKnobCtrl::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIValueCtrl::Write( s, mgr );
UInt32 i, count = fAnimationKeys.GetCount();
s->WriteSwap32( count );
for( i = 0; i < count; i++ )
mgr->WriteKey( s, fAnimationKeys[ i ] );
s->WriteSafeString( fAnimName );
fAnimStartPos.Write( s );
fAnimEndPos.Write( s );
}
//// UpdateBounds ////////////////////////////////////////////////////////////
void pfGUIKnobCtrl::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool force )
{
pfGUIValueCtrl::UpdateBounds( invXformMatrix, force );
if( fAnimationKeys.GetCount() > 0 )
fBoundsValid = false;
}
//// HandleMouseDown/Up //////////////////////////////////////////////////////
void pfGUIKnobCtrl::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
{
fDragStart = mousePt;
fDragValue = fValue;
fDragging = true;
if( HasFlag( kMapToAnimationRange ) )
{
hsPoint3 scrnStart, scrnEnd;
// At mouse-down, we take our local-space start and end points and
// translate them by our parent object's local-to-world to get the
// right points in world-space. We do this now because our parent
// might be animated, which could complicate matters a tad.
scrnStart = fAnimStartPos;
scrnEnd = fAnimEndPos;
plSceneObject *target = GetTarget();
if( target != nil )
{
const plCoordinateInterface *ci = target->GetCoordinateInterface();
if( ci != nil )
{
const plCoordinateInterface *parentCI = ci->GetParent();
if( parentCI != nil )
{
const hsMatrix44 &parentLocalToWorld = parentCI->GetLocalToWorld();
scrnStart = parentLocalToWorld * scrnStart;
scrnEnd = parentLocalToWorld * scrnEnd;
}
}
}
scrnStart = fDialog->WorldToScreenPoint( scrnStart );
scrnEnd = fDialog->WorldToScreenPoint( scrnEnd );
if( HasFlag( kLeftRightOrientation ) )
{
fDragRangeMin = scrnStart.fX;
fDragRangeMax = scrnEnd.fX;
}
else
{
fDragRangeMin = scrnStart.fY;
fDragRangeMax = scrnEnd.fY;
}
}
else if( HasFlag( kMapToScreenRange ) )
{
fDragRangeMin = 0.f;
fDragRangeMax = 1.f;
}
else
fDragRangeMin = -1;
}
void pfGUIKnobCtrl::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
{
fDragging = false;
HandleMouseDrag( mousePt, modifiers );
}
void pfGUIKnobCtrl::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
{
hsScalar oldValue = fValue, newValue = fDragValue;
if( fDragRangeMin != -1 )
{
if( HasFlag( kLeftRightOrientation ) )
{
if( mousePt.fX < fDragRangeMin )
newValue = fMin;
else if( mousePt.fX > fDragRangeMax )
newValue = fMax;
else
newValue = ( ( mousePt.fX - fDragRangeMin ) / ( fDragRangeMax - fDragRangeMin ) ) *
( fMax - fMin ) + fMin;
}
else
{
if( mousePt.fY > fDragRangeMin )
newValue = fMin;
else if( mousePt.fY < fDragRangeMax )
newValue = fMax;
else
newValue = ( ( fDragRangeMin - mousePt.fY) / ( fDragRangeMin - fDragRangeMax ) ) *
( fMax - fMin ) + fMin;
}
if( HasFlag( kReverseValues ) )
SetCurrValue( fMax - ( newValue - fMin ) );
else
SetCurrValue( newValue );
}
else
{
hsScalar diff;
if( HasFlag( kLeftRightOrientation ) )
diff = ( mousePt.fX - fDragStart.fX ) * 20.f;
else
diff = ( fDragStart.fY - mousePt.fY ) * 20.f;
if( HasFlag( kReverseValues ) )
SetCurrValue( fDragValue - diff );
else
SetCurrValue( fDragValue + diff );
}
// !fDragging = We're mousing-up, so if we're still dragging, we need to not have the only-
// on-mouse-up flag set. Just FYI
if( !fDragging || !HasFlag( kTriggerOnlyOnMouseUp ) )
DoSomething();
}
//// SetAnimationKeys ////////////////////////////////////////////////////////
void pfGUIKnobCtrl::SetAnimationKeys( hsTArray<plKey> &keys, const char *name )
{
fAnimationKeys = keys;
delete [] fAnimName;
if( name != nil )
{
fAnimName = TRACKED_NEW char[ strlen( name ) + 1 ];
strcpy( fAnimName, name );
}
else
fAnimName = nil;
}
//// ICalcAnimTimes //////////////////////////////////////////////////////////
// Loops through and computes the max begin and end for our animations. If
// none of them are loaded and we're not already calced, returns false.
hsBool pfGUIKnobCtrl::ICalcAnimTimes( void )
{
if( fAnimTimesCalced )
return true;
hsScalar tBegin = 1e30, tEnd = -1e30;
bool foundOne = false;
for( int i = 0; i < fAnimationKeys.GetCount(); i++ )
{
// Handle AGMasterMods
plAGMasterMod *mod = plAGMasterMod::ConvertNoRef( fAnimationKeys[ i ]->ObjectIsLoaded() );
if( mod != nil )
{
for( int j = 0; j < mod->GetNumAnimations(); j++ )
{
hsScalar begin = mod->GetAnimInstance( j )->GetTimeConvert()->GetBegin();
hsScalar end = mod->GetAnimInstance( j )->GetTimeConvert()->GetEnd();
if( begin < tBegin )
tBegin = begin;
if( end > tEnd )
tEnd = end;
}
foundOne = true;
}
// Handle layer animations
plLayerAnimation *layer = plLayerAnimation::ConvertNoRef( fAnimationKeys[ i ]->ObjectIsLoaded() );
if( layer != nil )
{
hsScalar begin = layer->GetTimeConvert().GetBegin();
hsScalar end = layer->GetTimeConvert().GetEnd();
if( begin < tBegin )
tBegin = begin;
if( end > tEnd )
tEnd = end;
foundOne = true;
}
}
if( foundOne )
{
fAnimBegin = tBegin;
fAnimEnd = tEnd;
fAnimTimesCalced = true;
}
return fAnimTimesCalced;
}
//// SetCurrValue ////////////////////////////////////////////////////////////
void pfGUIKnobCtrl::SetCurrValue( hsScalar v )
{
int old = (int)fValue;
pfGUIValueCtrl::SetCurrValue( v );
// if( old == (int)fValue )
// return;
if( fAnimationKeys.GetCount() > 0 )
{
ICalcAnimTimes();
hsScalar tLength = fAnimEnd - fAnimBegin;
hsScalar newTime = fMin;
if (fMin != fMax) // Protect against div by zero
{
if( HasFlag( kReverseValues ) )
newTime = ( ( fMax - fValue ) / ( fMax - fMin ) ) * tLength + fAnimBegin;
else
newTime = ( ( fValue - fMin ) / ( fMax - fMin ) ) * tLength + fAnimBegin;
}
plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg();
msg->SetCmd( plAnimCmdMsg::kGoToTime );
msg->SetAnimName( fAnimName );
msg->fTime = newTime;
msg->AddReceivers( fAnimationKeys );
plgDispatch::MsgSend( msg );
}
}
//// IGetDesiredCursor ///////////////////////////////////////////////////////
UInt32 pfGUIKnobCtrl::IGetDesiredCursor( void ) const
{
if( HasFlag( kLeftRightOrientation ) )
{
if( fDragging )
return plInputInterface::kCursorLeftRightDragging;
return plInputInterface::kCursorLeftRightDraggable;
}
else
{
if( fDragging )
return plInputInterface::kCursorUpDownDragging;
return plInputInterface::kCursorUpDownDraggable;
}
}
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIKnobCtrl Definition //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIKnobCtrl.h"
#include "pfGameGUIMgr.h"
#include "pfGUIDialogMod.h"
#include "../plInputCore/plInputInterface.h"
#include "../pnMessage/plRefMsg.h"
#include "../pfMessage/pfGameGUIMsg.h"
#include "../plMessage/plAnimCmdMsg.h"
// #include "../plAvatar/plAGModifier.h"
#include "../plAvatar/plAGMasterMod.h"
#include "../plAvatar/plAGAnimInstance.h"
#include "../plSurface/plLayerAnimation.h"
#include "../pnSceneObject/plSceneObject.h"
#include "../pnSceneObject/plCoordinateInterface.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIKnobCtrl::pfGUIKnobCtrl() :
fAnimName(nil),
fDragStart(0.f, 0.f, 0.f),
fDragging(false),
fAnimStartPos(0.f, 0.f, 0.f),
fAnimEndPos(0.f, 0.f, 0.f),
fDragRangeMin(0.f),
fDragRangeMax(0.f),
fAnimBegin(0.f),
fAnimEnd(0.f),
fAnimTimesCalced(false)
{
SetFlag( kWantsInterest );
}
pfGUIKnobCtrl::~pfGUIKnobCtrl()
{
delete [] fAnimName;
}
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIKnobCtrl::IEval( double secs, hsScalar del, UInt32 dirty )
{
return pfGUIValueCtrl::IEval( secs, del, dirty );
}
//// MsgReceive //////////////////////////////////////////////////////////////
hsBool pfGUIKnobCtrl::MsgReceive( plMessage *msg )
{
return pfGUIValueCtrl::MsgReceive( msg );
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUIKnobCtrl::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIValueCtrl::Read(s, mgr);
fAnimationKeys.Reset();
UInt32 i, count = s->ReadSwap32();
for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) );
fAnimName = s->ReadSafeString();
fAnimTimesCalced = false;
fAnimStartPos.Read( s );
fAnimEndPos.Read( s );
}
void pfGUIKnobCtrl::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIValueCtrl::Write( s, mgr );
UInt32 i, count = fAnimationKeys.GetCount();
s->WriteSwap32( count );
for( i = 0; i < count; i++ )
mgr->WriteKey( s, fAnimationKeys[ i ] );
s->WriteSafeString( fAnimName );
fAnimStartPos.Write( s );
fAnimEndPos.Write( s );
}
//// UpdateBounds ////////////////////////////////////////////////////////////
void pfGUIKnobCtrl::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool force )
{
pfGUIValueCtrl::UpdateBounds( invXformMatrix, force );
if( fAnimationKeys.GetCount() > 0 )
fBoundsValid = false;
}
//// HandleMouseDown/Up //////////////////////////////////////////////////////
void pfGUIKnobCtrl::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
{
fDragStart = mousePt;
fDragValue = fValue;
fDragging = true;
if( HasFlag( kMapToAnimationRange ) )
{
hsPoint3 scrnStart, scrnEnd;
// At mouse-down, we take our local-space start and end points and
// translate them by our parent object's local-to-world to get the
// right points in world-space. We do this now because our parent
// might be animated, which could complicate matters a tad.
scrnStart = fAnimStartPos;
scrnEnd = fAnimEndPos;
plSceneObject *target = GetTarget();
if( target != nil )
{
const plCoordinateInterface *ci = target->GetCoordinateInterface();
if( ci != nil )
{
const plCoordinateInterface *parentCI = ci->GetParent();
if( parentCI != nil )
{
const hsMatrix44 &parentLocalToWorld = parentCI->GetLocalToWorld();
scrnStart = parentLocalToWorld * scrnStart;
scrnEnd = parentLocalToWorld * scrnEnd;
}
}
}
scrnStart = fDialog->WorldToScreenPoint( scrnStart );
scrnEnd = fDialog->WorldToScreenPoint( scrnEnd );
if( HasFlag( kLeftRightOrientation ) )
{
fDragRangeMin = scrnStart.fX;
fDragRangeMax = scrnEnd.fX;
}
else
{
fDragRangeMin = scrnStart.fY;
fDragRangeMax = scrnEnd.fY;
}
}
else if( HasFlag( kMapToScreenRange ) )
{
fDragRangeMin = 0.f;
fDragRangeMax = 1.f;
}
else
fDragRangeMin = -1;
}
void pfGUIKnobCtrl::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
{
fDragging = false;
HandleMouseDrag( mousePt, modifiers );
}
void pfGUIKnobCtrl::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
{
hsScalar oldValue = fValue, newValue = fDragValue;
if( fDragRangeMin != -1 )
{
if( HasFlag( kLeftRightOrientation ) )
{
if( mousePt.fX < fDragRangeMin )
newValue = fMin;
else if( mousePt.fX > fDragRangeMax )
newValue = fMax;
else
newValue = ( ( mousePt.fX - fDragRangeMin ) / ( fDragRangeMax - fDragRangeMin ) ) *
( fMax - fMin ) + fMin;
}
else
{
if( mousePt.fY > fDragRangeMin )
newValue = fMin;
else if( mousePt.fY < fDragRangeMax )
newValue = fMax;
else
newValue = ( ( fDragRangeMin - mousePt.fY) / ( fDragRangeMin - fDragRangeMax ) ) *
( fMax - fMin ) + fMin;
}
if( HasFlag( kReverseValues ) )
SetCurrValue( fMax - ( newValue - fMin ) );
else
SetCurrValue( newValue );
}
else
{
hsScalar diff;
if( HasFlag( kLeftRightOrientation ) )
diff = ( mousePt.fX - fDragStart.fX ) * 20.f;
else
diff = ( fDragStart.fY - mousePt.fY ) * 20.f;
if( HasFlag( kReverseValues ) )
SetCurrValue( fDragValue - diff );
else
SetCurrValue( fDragValue + diff );
}
// !fDragging = We're mousing-up, so if we're still dragging, we need to not have the only-
// on-mouse-up flag set. Just FYI
if( !fDragging || !HasFlag( kTriggerOnlyOnMouseUp ) )
DoSomething();
}
//// SetAnimationKeys ////////////////////////////////////////////////////////
void pfGUIKnobCtrl::SetAnimationKeys( hsTArray<plKey> &keys, const char *name )
{
fAnimationKeys = keys;
delete [] fAnimName;
if( name != nil )
{
fAnimName = TRACKED_NEW char[ strlen( name ) + 1 ];
strcpy( fAnimName, name );
}
else
fAnimName = nil;
}
//// ICalcAnimTimes //////////////////////////////////////////////////////////
// Loops through and computes the max begin and end for our animations. If
// none of them are loaded and we're not already calced, returns false.
hsBool pfGUIKnobCtrl::ICalcAnimTimes( void )
{
if( fAnimTimesCalced )
return true;
hsScalar tBegin = 1e30, tEnd = -1e30;
bool foundOne = false;
for( int i = 0; i < fAnimationKeys.GetCount(); i++ )
{
// Handle AGMasterMods
plAGMasterMod *mod = plAGMasterMod::ConvertNoRef( fAnimationKeys[ i ]->ObjectIsLoaded() );
if( mod != nil )
{
for( int j = 0; j < mod->GetNumAnimations(); j++ )
{
hsScalar begin = mod->GetAnimInstance( j )->GetTimeConvert()->GetBegin();
hsScalar end = mod->GetAnimInstance( j )->GetTimeConvert()->GetEnd();
if( begin < tBegin )
tBegin = begin;
if( end > tEnd )
tEnd = end;
}
foundOne = true;
}
// Handle layer animations
plLayerAnimation *layer = plLayerAnimation::ConvertNoRef( fAnimationKeys[ i ]->ObjectIsLoaded() );
if( layer != nil )
{
hsScalar begin = layer->GetTimeConvert().GetBegin();
hsScalar end = layer->GetTimeConvert().GetEnd();
if( begin < tBegin )
tBegin = begin;
if( end > tEnd )
tEnd = end;
foundOne = true;
}
}
if( foundOne )
{
fAnimBegin = tBegin;
fAnimEnd = tEnd;
fAnimTimesCalced = true;
}
return fAnimTimesCalced;
}
//// SetCurrValue ////////////////////////////////////////////////////////////
void pfGUIKnobCtrl::SetCurrValue( hsScalar v )
{
int old = (int)fValue;
pfGUIValueCtrl::SetCurrValue( v );
// if( old == (int)fValue )
// return;
if( fAnimationKeys.GetCount() > 0 )
{
ICalcAnimTimes();
hsScalar tLength = fAnimEnd - fAnimBegin;
hsScalar newTime = fMin;
if (fMin != fMax) // Protect against div by zero
{
if( HasFlag( kReverseValues ) )
newTime = ( ( fMax - fValue ) / ( fMax - fMin ) ) * tLength + fAnimBegin;
else
newTime = ( ( fValue - fMin ) / ( fMax - fMin ) ) * tLength + fAnimBegin;
}
plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg();
msg->SetCmd( plAnimCmdMsg::kGoToTime );
msg->SetAnimName( fAnimName );
msg->fTime = newTime;
msg->AddReceivers( fAnimationKeys );
plgDispatch::MsgSend( msg );
}
}
//// IGetDesiredCursor ///////////////////////////////////////////////////////
UInt32 pfGUIKnobCtrl::IGetDesiredCursor( void ) const
{
if( HasFlag( kLeftRightOrientation ) )
{
if( fDragging )
return plInputInterface::kCursorLeftRightDragging;
return plInputInterface::kCursorLeftRightDraggable;
}
else
{
if( fDragging )
return plInputInterface::kCursorUpDownDragging;
return plInputInterface::kCursorUpDownDraggable;
}
}

View File

@ -1,116 +1,116 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIKnobCtrl Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIKnobCtrl_h
#define _pfGUIKnobCtrl_h
#include "pfGUIValueCtrl.h"
class plMessage;
class plAGMasterMod;
class pfGUIKnobCtrl : public pfGUIValueCtrl
{
protected:
hsTArray<plKey> fAnimationKeys;
char *fAnimName;
hsPoint3 fDragStart;
hsScalar fDragValue;
hsBool fDragging;
hsPoint3 fAnimStartPos, fAnimEndPos; // Calculated at export time for kMapToScreenRange
hsScalar fDragRangeMin, fDragRangeMax;
// Computed once, once an anim is loaded that we can compute this with
hsScalar fAnimBegin, fAnimEnd;
hsBool fAnimTimesCalced;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual UInt32 IGetDesiredCursor( void ) const; // As specified in plInputInterface.h
hsBool ICalcAnimTimes( void );
public:
pfGUIKnobCtrl();
virtual ~pfGUIKnobCtrl();
CLASSNAME_REGISTER( pfGUIKnobCtrl );
GETINTERFACE_ANY( pfGUIKnobCtrl, pfGUIValueCtrl );
enum OurFlags
{
kReverseValues = kDerivedFlagsStart,
kLeftRightOrientation,
kMapToScreenRange,
kTriggerOnlyOnMouseUp,
kMapToAnimationRange
};
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false );
virtual void SetCurrValue( hsScalar v );
// Export only
void SetAnimationKeys( hsTArray<plKey> &keys, const char *name );
void SetScreenRange( const hsPoint3 &startPos, const hsPoint3 &endPos ) { fAnimStartPos = startPos; fAnimEndPos = endPos; }
};
#endif // _pfGUIKnobCtrl_h
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIKnobCtrl Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIKnobCtrl_h
#define _pfGUIKnobCtrl_h
#include "pfGUIValueCtrl.h"
class plMessage;
class plAGMasterMod;
class pfGUIKnobCtrl : public pfGUIValueCtrl
{
protected:
hsTArray<plKey> fAnimationKeys;
char *fAnimName;
hsPoint3 fDragStart;
hsScalar fDragValue;
hsBool fDragging;
hsPoint3 fAnimStartPos, fAnimEndPos; // Calculated at export time for kMapToScreenRange
hsScalar fDragRangeMin, fDragRangeMax;
// Computed once, once an anim is loaded that we can compute this with
hsScalar fAnimBegin, fAnimEnd;
hsBool fAnimTimesCalced;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual UInt32 IGetDesiredCursor( void ) const; // As specified in plInputInterface.h
hsBool ICalcAnimTimes( void );
public:
pfGUIKnobCtrl();
virtual ~pfGUIKnobCtrl();
CLASSNAME_REGISTER( pfGUIKnobCtrl );
GETINTERFACE_ANY( pfGUIKnobCtrl, pfGUIValueCtrl );
enum OurFlags
{
kReverseValues = kDerivedFlagsStart,
kLeftRightOrientation,
kMapToScreenRange,
kTriggerOnlyOnMouseUp,
kMapToAnimationRange
};
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false );
virtual void SetCurrValue( hsScalar v );
// Export only
void SetAnimationKeys( hsTArray<plKey> &keys, const char *name );
void SetScreenRange( const hsPoint3 &startPos, const hsPoint3 &endPos ) { fAnimStartPos = startPos; fAnimEndPos = endPos; }
};
#endif // _pfGUIKnobCtrl_h

File diff suppressed because it is too large Load Diff

View File

@ -1,199 +1,199 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIListBoxMod Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIListBoxMod_h
#define _pfGUIListBoxMod_h
#include "pfGUIControlMod.h"
class plMessage;
class hsGMaterial;
class plTextGenerator;
class pfGUIListElement;
class pfScrollProc;
class pfGUIValueCtrl;
class pfGUIListBoxMod : public pfGUIControlMod
{
friend class pfScrollProc;
protected:
struct plSmallRect
{
Int16 fLeft, fTop, fRight, fBottom;
void Set( Int16 l, Int16 t, Int16 r, Int16 b );
hsBool Contains( Int16 x, Int16 y );
plSmallRect& operator=(const int zero) { fLeft = fTop = fRight = fBottom = 0; return *this; }
};
pfGUIValueCtrl *fScrollControl;
pfScrollProc *fScrollProc;
hsTArray<pfGUIListElement *> fElements;
Int32 fCurrClick, fScrollPos, fCurrHover;
UInt8 fModsAtDragTime;
Int32 fMinSel, fMaxSel;
hsBool fCheckScroll, fClicking;
Int32 fSingleSelElement;
hsBool fScrollRangeUpdateDeferred;
hsBool fLocked, fReadyToRoll;
hsTArray<plSmallRect> fElementBounds;
hsTArray<Int16> fWrapStartIdxs;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
void ICalcScrollRange( void );
void ICalcWrapStarts( void );
virtual void IUpdate( void );
virtual void IPostSetUpDynTextMap( void );
virtual UInt32 IGetDesiredCursor( void ) const;
Int32 IGetItemFromPoint( hsPoint3 &mousePt );
void IFindSelectionRange( Int32 *min, Int32 *max );
void ISelectRange( Int8 min, Int8 max, hsBool select );
public:
pfGUIListBoxMod();
virtual ~pfGUIListBoxMod();
CLASSNAME_REGISTER( pfGUIListBoxMod );
GETINTERFACE_ANY( pfGUIListBoxMod, pfGUIControlMod );
enum OurFlags
{
kSingleSelect = kDerivedFlagsStart,
kDragAndDropCapable,
kDisableSelection,
kDisableKeyActions,
kAllowMultipleElementsPerRow,
kScrollLeftToRight,
kAllowMousePassThrough,
kGrowLeavesAndProcessOxygen,
kHandsOffMultiSelect, // Do multiselect w/o needing ctrl or shift
kForbidNoSelection
};
// Extended event types
enum ExtendedEvents
{
kScrollPosChanged,
kItemAdded,
kItemRemoved,
kListCleared
};
enum
{
kRefScrollCtrl = kRefDerivedStart
};
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDblClick( hsPoint3 &mousePt, UInt8 modifiers );
virtual hsBool HandleKeyPress( char key, UInt8 modifiers );
virtual hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers );
virtual hsBool FilterMousePosition( hsPoint3 &mousePt );
virtual void PurgeDynaTextMapImage();
// Returns selected element. Only valid for kSingleSelect list boxes
Int32 GetSelection( void ) { return fSingleSelElement; }
void SetSelection( Int32 item );
void RemoveSelection( Int32 item );
void AddSelection( Int32 item );
virtual void ScrollToBegin( void );
virtual void ScrollToEnd( void );
virtual void SetScrollPos( Int32 pos );
virtual Int32 GetScrollPos( void );
virtual Int32 GetScrollRange( void );
void Refresh( void ) { IUpdate(); }
virtual void SetColorScheme( pfGUIColorScheme *newScheme );
// Element manipulation
UInt16 AddElement( pfGUIListElement *el );
void RemoveElement( UInt16 index );
Int16 FindElement( pfGUIListElement *toCompareTo );
void ClearAllElements( void );
void LockList( void );
void UnlockList( void );
UInt16 GetNumElements( void );
pfGUIListElement *GetElement( UInt16 idx );
UInt16 AddString( const char *string );
UInt16 AddString( const wchar_t *string );
Int16 FindString( const char *toCompareTo );
Int16 FindString( const wchar_t *toCompareTo );
// Export only
void SetScrollCtrl( pfGUIValueCtrl *ctrl ) { fScrollControl = ctrl; }
void SetSingleSelect( hsBool yes ) { if( yes ) SetFlag( kSingleSelect ); else ClearFlag( kSingleSelect ); }
};
#endif // _pfGUIListBoxMod_h
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIListBoxMod Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIListBoxMod_h
#define _pfGUIListBoxMod_h
#include "pfGUIControlMod.h"
class plMessage;
class hsGMaterial;
class plTextGenerator;
class pfGUIListElement;
class pfScrollProc;
class pfGUIValueCtrl;
class pfGUIListBoxMod : public pfGUIControlMod
{
friend class pfScrollProc;
protected:
struct plSmallRect
{
Int16 fLeft, fTop, fRight, fBottom;
void Set( Int16 l, Int16 t, Int16 r, Int16 b );
hsBool Contains( Int16 x, Int16 y );
plSmallRect& operator=(const int zero) { fLeft = fTop = fRight = fBottom = 0; return *this; }
};
pfGUIValueCtrl *fScrollControl;
pfScrollProc *fScrollProc;
hsTArray<pfGUIListElement *> fElements;
Int32 fCurrClick, fScrollPos, fCurrHover;
UInt8 fModsAtDragTime;
Int32 fMinSel, fMaxSel;
hsBool fCheckScroll, fClicking;
Int32 fSingleSelElement;
hsBool fScrollRangeUpdateDeferred;
hsBool fLocked, fReadyToRoll;
hsTArray<plSmallRect> fElementBounds;
hsTArray<Int16> fWrapStartIdxs;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
void ICalcScrollRange( void );
void ICalcWrapStarts( void );
virtual void IUpdate( void );
virtual void IPostSetUpDynTextMap( void );
virtual UInt32 IGetDesiredCursor( void ) const;
Int32 IGetItemFromPoint( hsPoint3 &mousePt );
void IFindSelectionRange( Int32 *min, Int32 *max );
void ISelectRange( Int8 min, Int8 max, hsBool select );
public:
pfGUIListBoxMod();
virtual ~pfGUIListBoxMod();
CLASSNAME_REGISTER( pfGUIListBoxMod );
GETINTERFACE_ANY( pfGUIListBoxMod, pfGUIControlMod );
enum OurFlags
{
kSingleSelect = kDerivedFlagsStart,
kDragAndDropCapable,
kDisableSelection,
kDisableKeyActions,
kAllowMultipleElementsPerRow,
kScrollLeftToRight,
kAllowMousePassThrough,
kGrowLeavesAndProcessOxygen,
kHandsOffMultiSelect, // Do multiselect w/o needing ctrl or shift
kForbidNoSelection
};
// Extended event types
enum ExtendedEvents
{
kScrollPosChanged,
kItemAdded,
kItemRemoved,
kListCleared
};
enum
{
kRefScrollCtrl = kRefDerivedStart
};
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDblClick( hsPoint3 &mousePt, UInt8 modifiers );
virtual hsBool HandleKeyPress( char key, UInt8 modifiers );
virtual hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers );
virtual hsBool FilterMousePosition( hsPoint3 &mousePt );
virtual void PurgeDynaTextMapImage();
// Returns selected element. Only valid for kSingleSelect list boxes
Int32 GetSelection( void ) { return fSingleSelElement; }
void SetSelection( Int32 item );
void RemoveSelection( Int32 item );
void AddSelection( Int32 item );
virtual void ScrollToBegin( void );
virtual void ScrollToEnd( void );
virtual void SetScrollPos( Int32 pos );
virtual Int32 GetScrollPos( void );
virtual Int32 GetScrollRange( void );
void Refresh( void ) { IUpdate(); }
virtual void SetColorScheme( pfGUIColorScheme *newScheme );
// Element manipulation
UInt16 AddElement( pfGUIListElement *el );
void RemoveElement( UInt16 index );
Int16 FindElement( pfGUIListElement *toCompareTo );
void ClearAllElements( void );
void LockList( void );
void UnlockList( void );
UInt16 GetNumElements( void );
pfGUIListElement *GetElement( UInt16 idx );
UInt16 AddString( const char *string );
UInt16 AddString( const wchar_t *string );
Int16 FindString( const char *toCompareTo );
Int16 FindString( const wchar_t *toCompareTo );
// Export only
void SetScrollCtrl( pfGUIValueCtrl *ctrl ) { fScrollControl = ctrl; }
void SetSingleSelect( hsBool yes ) { if( yes ) SetFlag( kSingleSelect ); else ClearFlag( kSingleSelect ); }
};
#endif // _pfGUIListBoxMod_h

View File

@ -1,472 +1,472 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIListElement Class Definitions //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIListElement.h"
#include "pfGameGUIMgr.h"
#include "pfGUIPopUpMenu.h" // For skins
#include "../plGImage/plDynamicTextMap.h"
#include "../plGImage/hsCodecManager.h"
#include "../plPipeline/plDebugText.h" // To quickly and hackily get the screen size in pixels
#include "hsResMgr.h"
//////////////////////////////////////////////////////////////////////////////
//// Base Stuff //////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
void pfGUIListElement::Read( hsStream *s, hsResMgr *mgr )
{
fSelected = s->ReadBool();
}
void pfGUIListElement::Write( hsStream *s, hsResMgr *mgr )
{
s->WriteBool( fSelected );
}
//////////////////////////////////////////////////////////////////////////////
//// pfGUIListText ///////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIListText::pfGUIListText() : pfGUIListElement( kText )
{
fText = nil;
fJustify = kLeftJustify;
}
pfGUIListText::pfGUIListText( const char *text ) : pfGUIListElement( kText )
{
fText = hsStringToWString(text);
fJustify = kLeftJustify;
}
pfGUIListText::pfGUIListText( const wchar_t *text ) : pfGUIListElement( kText )
{
fText = TRACKED_NEW wchar_t[ wcslen( text ) + 1 ];
wcscpy( fText, text );
fJustify = kLeftJustify;
}
pfGUIListText::~pfGUIListText()
{
delete [] fText;
}
//// Virtuals ////////////////////////////////////////////////////////////////
void pfGUIListText::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIListElement::Read( s, mgr );
char *text = s->ReadSafeString();
fText = hsStringToWString(text);
delete [] text;
}
void pfGUIListText::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIListElement::Write( s, mgr );
char *text = hsWStringToString(fText);
s->WriteSafeString(text);
delete [] text;
}
hsBool pfGUIListText::Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight )
{
textGen->SetJustify( (plDynamicTextMap::Justify)fJustify );
if( fSelected )
{
textGen->FillRect( x, y, maxWidth, maxHeight, fColors->fSelBackColor );
textGen->SetTextColor( fColors->fSelForeColor, fColors->fTransparent && fColors->fSelBackColor.a == 0.f );
}
else
{
// Normal back color will be cleared for us
textGen->SetTextColor( fColors->fForeColor, fColors->fTransparent && fColors->fBackColor.a == 0.f );
}
textGen->DrawClippedString( x + 4, y, GetText(), maxWidth - 8, maxHeight );
return true;
}
void pfGUIListText::GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height )
{
*width = textGen->CalcStringWidth( GetText(), height );
if( height != nil )
{
if( *height == 0 )
*height = 10; // Never allow zero height elements
else
*height += 0; // Add one pixel on each side for padding (or not, 3.21.02 mcn)
}
}
int pfGUIListText::CompareTo( pfGUIListElement *rightSide )
{
pfGUIListText *text = (pfGUIListText *)rightSide;
if( text->fType != kText )
return -2;
return wcscmp( GetText(), text->GetText() );
}
void pfGUIListText::SetText( const char *text )
{
wchar_t *wText = hsStringToWString(text);
SetText(wText);
delete [] wText;
}
void pfGUIListText::SetText( const wchar_t *text )
{
delete [] fText;
if( text != nil )
{
fText = TRACKED_NEW wchar_t[ wcslen( text ) + 1 ];
wcscpy( fText, text );
}
else
fText = nil;
}
void pfGUIListText::SetJustify( JustifyTypes justify )
{
switch( justify )
{
case kRightJustify:
fJustify = plDynamicTextMap::kRightJustify;
break;
case kCenter:
fJustify = plDynamicTextMap::kCenter;
break;
case kLeftJustify:
default:
fJustify = plDynamicTextMap::kLeftJustify;
break;
}
}
//////////////////////////////////////////////////////////////////////////////
//// pfGUIListPicture ////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIListPicture::pfGUIListPicture() : pfGUIListElement( kPicture )
{
fBorderSize = 2;
fMipmapKey = nil;
}
pfGUIListPicture::pfGUIListPicture( plKey mipKey, hsBool respectAlpha ) : pfGUIListElement( kPicture )
{
fBorderSize = 2;
fMipmapKey = mipKey;
fRespectAlpha = respectAlpha;
plMipmap *mip = plMipmap::ConvertNoRef( fMipmapKey->ObjectIsLoaded() );
if( mip != nil && mip->IsCompressed() )
{
// Gotta make and grab an uncompressed one
plMipmap *uncompBuffer = hsCodecManager::Instance().CreateUncompressedMipmap( mip, hsCodecManager::k32BitDepth );
char str[ 512 ];
sprintf( str, "%s_uncomp", mip->GetKeyName() );
fMipmapKey = hsgResMgr::ResMgr()->NewKey( str, uncompBuffer, fMipmapKey->GetUoid().GetLocation() );
fMipmapKey->RefObject();
}
}
pfGUIListPicture::~pfGUIListPicture()
{
fMipmapKey->UnRefObject();
fMipmapKey = nil;
}
//// Virtuals ////////////////////////////////////////////////////////////////
void pfGUIListPicture::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIListElement::Read( s, mgr );
}
void pfGUIListPicture::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIListElement::Write( s, mgr );
}
hsBool pfGUIListPicture::Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight )
{
if( fSelected )
textGen->FillRect( x, y, maxWidth, maxHeight, fColors->fSelBackColor );
plMipmap *mip = plMipmap::ConvertNoRef( fMipmapKey->ObjectIsLoaded() );
if( mip != nil )
{
if( mip->GetWidth() + fBorderSize + fBorderSize > maxWidth || mip->GetHeight() + fBorderSize + fBorderSize > maxHeight )
return false;
textGen->DrawImage( x + fBorderSize, y + fBorderSize, mip, fRespectAlpha ? plDynamicTextMap::kImgBlend : plDynamicTextMap::kImgNoAlpha );
}
return true;
}
void pfGUIListPicture::GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height )
{
plMipmap *mip = plMipmap::ConvertNoRef( fMipmapKey->ObjectIsLoaded() );
if( mip == nil )
{
*width = 16;
if( height != nil )
*height = 16;
}
*width = (UInt16)(mip->GetWidth() + fBorderSize + fBorderSize);
if( height != nil )
*height = (UInt16)(mip->GetHeight() + fBorderSize + fBorderSize);
}
int pfGUIListPicture::CompareTo( pfGUIListElement *rightSide )
{
pfGUIListPicture *text = (pfGUIListPicture *)rightSide;
if( text->fType != kPicture )
return -2;
return -2;
}
//////////////////////////////////////////////////////////////////////////////
//// pfGUIListTreeRoot ///////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIListTreeRoot::pfGUIListTreeRoot() : pfGUIListElement( kTreeRoot )
{
fText = nil;
fShowChildren = true;
}
pfGUIListTreeRoot::pfGUIListTreeRoot( const char *text ) : pfGUIListElement( kTreeRoot )
{
fText = hsStringToWString(text);
}
pfGUIListTreeRoot::pfGUIListTreeRoot( const wchar_t *text ) : pfGUIListElement( kTreeRoot )
{
fText = TRACKED_NEW wchar_t[ wcslen( text ) + 1 ];
wcscpy( fText, text );
}
pfGUIListTreeRoot::~pfGUIListTreeRoot()
{
delete [] fText;
}
//// Virtuals ////////////////////////////////////////////////////////////////
void pfGUIListTreeRoot::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIListElement::Read( s, mgr );
char *temp = s->ReadSafeString();
fText = hsStringToWString(temp);
delete [] temp;
}
void pfGUIListTreeRoot::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIListElement::Write( s, mgr );
char *temp = hsWStringToString(fText);
s->WriteSafeString( temp );
delete [] temp;
}
hsBool pfGUIListTreeRoot::Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight )
{
textGen->SetJustify( plDynamicTextMap::kLeftJustify );
if( fSelected )
{
textGen->FillRect( x, y, maxWidth, maxHeight, fColors->fSelBackColor );
textGen->SetTextColor( fColors->fSelForeColor, fColors->fTransparent && fColors->fSelBackColor.a == 0.f );
}
else
{
// Normal back color will be cleared for us
textGen->SetTextColor( fColors->fForeColor, fColors->fTransparent && fColors->fBackColor.a == 0.f );
}
if( fSkin != nil )
{
const pfGUISkin::pfSRect &r = fSkin->GetElement( fShowChildren ? pfGUISkin::kTreeButtonOpen : pfGUISkin::kTreeButtonClosed );
Int16 e = ( maxHeight - r.fHeight );
if( e < 0 )
e = 0;
e >>= 1;
textGen->DrawClippedImage( x + 2, y + e, fSkin->GetTexture(), r.fX, r.fY, r.fWidth, r.fHeight, plDynamicTextMap::kImgSprite );
x += r.fWidth + 4;
}
textGen->DrawClippedString( x + 4, y, GetTitle(), maxWidth - 8, maxHeight );
return true;
}
hsBool pfGUIListTreeRoot::MouseClicked( UInt16 localX, UInt16 localY )
{
if( fSkin != nil )
{
const pfGUISkin::pfSRect &r = fSkin->GetElement( fShowChildren ? pfGUISkin::kTreeButtonOpen : pfGUISkin::kTreeButtonClosed );
// For now, I can't think of a clean way of getting the current visible height to this function,
// but just testing the X value for tree controls is good enough for now. If we need Y testing for
// other elements, I'll figure out something.
if( localX >= 2 && localX <= 2 + r.fWidth )
{
ShowChildren( !fShowChildren );
return true;
}
}
return false;
}
void pfGUIListTreeRoot::GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height )
{
*width = textGen->CalcStringWidth( GetTitle(), height );
if( height != nil )
{
if( *height == 0 )
*height = 10; // Never allow zero height elements
else
*height += 0; // Add one pixel on each side for padding (or not, 3.21.02 mcn)
if( fSkin != nil )
{
UInt16 h = fSkin->GetElement( pfGUISkin::kTreeButtonClosed ).fHeight;
if( *height < h )
*height = h;
}
}
if( fSkin != nil )
*width += fSkin->GetElement( pfGUISkin::kTreeButtonClosed ).fWidth;
}
int pfGUIListTreeRoot::CompareTo( pfGUIListElement *rightSide )
{
pfGUIListTreeRoot *text = (pfGUIListTreeRoot *)rightSide;
if( text->fType != kTreeRoot )
return -2;
return wcscmp( GetTitle(), text->GetTitle() );
}
void pfGUIListTreeRoot::SetTitle( const char *text )
{
wchar_t *wText = hsStringToWString(text);
SetTitle(wText);
delete [] wText;
}
void pfGUIListTreeRoot::SetTitle( const wchar_t *text )
{
delete [] fText;
if( text != nil )
{
fText = TRACKED_NEW wchar_t[ wcslen( text ) + 1 ];
wcscpy( fText, text );
}
else
fText = nil;
}
void pfGUIListTreeRoot::AddChild( pfGUIListElement *el )
{
fChildren.Append( el );
el->SetIndentLevel( GetIndentLevel() + 1 );
el->SetCollapsed( !fShowChildren );
}
void pfGUIListTreeRoot::RemoveChild( UInt32 idx )
{
fChildren.Remove( idx );
}
void pfGUIListTreeRoot::ShowChildren( hsBool s )
{
UInt32 i;
fShowChildren = s;
for( i = 0; i < fChildren.GetCount(); i++ )
fChildren[ i ]->SetCollapsed( !s );
}
void pfGUIListTreeRoot::SetCollapsed( hsBool c )
{
UInt32 i;
pfGUIListElement::SetCollapsed( c );
for( i = 0; i < fChildren.GetCount(); i++ )
fChildren[ i ]->SetCollapsed( c ? true : !fShowChildren );
}
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIListElement Class Definitions //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIListElement.h"
#include "pfGameGUIMgr.h"
#include "pfGUIPopUpMenu.h" // For skins
#include "../plGImage/plDynamicTextMap.h"
#include "../plGImage/hsCodecManager.h"
#include "../plPipeline/plDebugText.h" // To quickly and hackily get the screen size in pixels
#include "hsResMgr.h"
//////////////////////////////////////////////////////////////////////////////
//// Base Stuff //////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
void pfGUIListElement::Read( hsStream *s, hsResMgr *mgr )
{
fSelected = s->ReadBool();
}
void pfGUIListElement::Write( hsStream *s, hsResMgr *mgr )
{
s->WriteBool( fSelected );
}
//////////////////////////////////////////////////////////////////////////////
//// pfGUIListText ///////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIListText::pfGUIListText() : pfGUIListElement( kText )
{
fText = nil;
fJustify = kLeftJustify;
}
pfGUIListText::pfGUIListText( const char *text ) : pfGUIListElement( kText )
{
fText = hsStringToWString(text);
fJustify = kLeftJustify;
}
pfGUIListText::pfGUIListText( const wchar_t *text ) : pfGUIListElement( kText )
{
fText = TRACKED_NEW wchar_t[ wcslen( text ) + 1 ];
wcscpy( fText, text );
fJustify = kLeftJustify;
}
pfGUIListText::~pfGUIListText()
{
delete [] fText;
}
//// Virtuals ////////////////////////////////////////////////////////////////
void pfGUIListText::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIListElement::Read( s, mgr );
char *text = s->ReadSafeString();
fText = hsStringToWString(text);
delete [] text;
}
void pfGUIListText::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIListElement::Write( s, mgr );
char *text = hsWStringToString(fText);
s->WriteSafeString(text);
delete [] text;
}
hsBool pfGUIListText::Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight )
{
textGen->SetJustify( (plDynamicTextMap::Justify)fJustify );
if( fSelected )
{
textGen->FillRect( x, y, maxWidth, maxHeight, fColors->fSelBackColor );
textGen->SetTextColor( fColors->fSelForeColor, fColors->fTransparent && fColors->fSelBackColor.a == 0.f );
}
else
{
// Normal back color will be cleared for us
textGen->SetTextColor( fColors->fForeColor, fColors->fTransparent && fColors->fBackColor.a == 0.f );
}
textGen->DrawClippedString( x + 4, y, GetText(), maxWidth - 8, maxHeight );
return true;
}
void pfGUIListText::GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height )
{
*width = textGen->CalcStringWidth( GetText(), height );
if( height != nil )
{
if( *height == 0 )
*height = 10; // Never allow zero height elements
else
*height += 0; // Add one pixel on each side for padding (or not, 3.21.02 mcn)
}
}
int pfGUIListText::CompareTo( pfGUIListElement *rightSide )
{
pfGUIListText *text = (pfGUIListText *)rightSide;
if( text->fType != kText )
return -2;
return wcscmp( GetText(), text->GetText() );
}
void pfGUIListText::SetText( const char *text )
{
wchar_t *wText = hsStringToWString(text);
SetText(wText);
delete [] wText;
}
void pfGUIListText::SetText( const wchar_t *text )
{
delete [] fText;
if( text != nil )
{
fText = TRACKED_NEW wchar_t[ wcslen( text ) + 1 ];
wcscpy( fText, text );
}
else
fText = nil;
}
void pfGUIListText::SetJustify( JustifyTypes justify )
{
switch( justify )
{
case kRightJustify:
fJustify = plDynamicTextMap::kRightJustify;
break;
case kCenter:
fJustify = plDynamicTextMap::kCenter;
break;
case kLeftJustify:
default:
fJustify = plDynamicTextMap::kLeftJustify;
break;
}
}
//////////////////////////////////////////////////////////////////////////////
//// pfGUIListPicture ////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIListPicture::pfGUIListPicture() : pfGUIListElement( kPicture )
{
fBorderSize = 2;
fMipmapKey = nil;
}
pfGUIListPicture::pfGUIListPicture( plKey mipKey, hsBool respectAlpha ) : pfGUIListElement( kPicture )
{
fBorderSize = 2;
fMipmapKey = mipKey;
fRespectAlpha = respectAlpha;
plMipmap *mip = plMipmap::ConvertNoRef( fMipmapKey->ObjectIsLoaded() );
if( mip != nil && mip->IsCompressed() )
{
// Gotta make and grab an uncompressed one
plMipmap *uncompBuffer = hsCodecManager::Instance().CreateUncompressedMipmap( mip, hsCodecManager::k32BitDepth );
char str[ 512 ];
sprintf( str, "%s_uncomp", mip->GetKeyName() );
fMipmapKey = hsgResMgr::ResMgr()->NewKey( str, uncompBuffer, fMipmapKey->GetUoid().GetLocation() );
fMipmapKey->RefObject();
}
}
pfGUIListPicture::~pfGUIListPicture()
{
fMipmapKey->UnRefObject();
fMipmapKey = nil;
}
//// Virtuals ////////////////////////////////////////////////////////////////
void pfGUIListPicture::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIListElement::Read( s, mgr );
}
void pfGUIListPicture::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIListElement::Write( s, mgr );
}
hsBool pfGUIListPicture::Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight )
{
if( fSelected )
textGen->FillRect( x, y, maxWidth, maxHeight, fColors->fSelBackColor );
plMipmap *mip = plMipmap::ConvertNoRef( fMipmapKey->ObjectIsLoaded() );
if( mip != nil )
{
if( mip->GetWidth() + fBorderSize + fBorderSize > maxWidth || mip->GetHeight() + fBorderSize + fBorderSize > maxHeight )
return false;
textGen->DrawImage( x + fBorderSize, y + fBorderSize, mip, fRespectAlpha ? plDynamicTextMap::kImgBlend : plDynamicTextMap::kImgNoAlpha );
}
return true;
}
void pfGUIListPicture::GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height )
{
plMipmap *mip = plMipmap::ConvertNoRef( fMipmapKey->ObjectIsLoaded() );
if( mip == nil )
{
*width = 16;
if( height != nil )
*height = 16;
}
*width = (UInt16)(mip->GetWidth() + fBorderSize + fBorderSize);
if( height != nil )
*height = (UInt16)(mip->GetHeight() + fBorderSize + fBorderSize);
}
int pfGUIListPicture::CompareTo( pfGUIListElement *rightSide )
{
pfGUIListPicture *text = (pfGUIListPicture *)rightSide;
if( text->fType != kPicture )
return -2;
return -2;
}
//////////////////////////////////////////////////////////////////////////////
//// pfGUIListTreeRoot ///////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIListTreeRoot::pfGUIListTreeRoot() : pfGUIListElement( kTreeRoot )
{
fText = nil;
fShowChildren = true;
}
pfGUIListTreeRoot::pfGUIListTreeRoot( const char *text ) : pfGUIListElement( kTreeRoot )
{
fText = hsStringToWString(text);
}
pfGUIListTreeRoot::pfGUIListTreeRoot( const wchar_t *text ) : pfGUIListElement( kTreeRoot )
{
fText = TRACKED_NEW wchar_t[ wcslen( text ) + 1 ];
wcscpy( fText, text );
}
pfGUIListTreeRoot::~pfGUIListTreeRoot()
{
delete [] fText;
}
//// Virtuals ////////////////////////////////////////////////////////////////
void pfGUIListTreeRoot::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIListElement::Read( s, mgr );
char *temp = s->ReadSafeString();
fText = hsStringToWString(temp);
delete [] temp;
}
void pfGUIListTreeRoot::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIListElement::Write( s, mgr );
char *temp = hsWStringToString(fText);
s->WriteSafeString( temp );
delete [] temp;
}
hsBool pfGUIListTreeRoot::Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight )
{
textGen->SetJustify( plDynamicTextMap::kLeftJustify );
if( fSelected )
{
textGen->FillRect( x, y, maxWidth, maxHeight, fColors->fSelBackColor );
textGen->SetTextColor( fColors->fSelForeColor, fColors->fTransparent && fColors->fSelBackColor.a == 0.f );
}
else
{
// Normal back color will be cleared for us
textGen->SetTextColor( fColors->fForeColor, fColors->fTransparent && fColors->fBackColor.a == 0.f );
}
if( fSkin != nil )
{
const pfGUISkin::pfSRect &r = fSkin->GetElement( fShowChildren ? pfGUISkin::kTreeButtonOpen : pfGUISkin::kTreeButtonClosed );
Int16 e = ( maxHeight - r.fHeight );
if( e < 0 )
e = 0;
e >>= 1;
textGen->DrawClippedImage( x + 2, y + e, fSkin->GetTexture(), r.fX, r.fY, r.fWidth, r.fHeight, plDynamicTextMap::kImgSprite );
x += r.fWidth + 4;
}
textGen->DrawClippedString( x + 4, y, GetTitle(), maxWidth - 8, maxHeight );
return true;
}
hsBool pfGUIListTreeRoot::MouseClicked( UInt16 localX, UInt16 localY )
{
if( fSkin != nil )
{
const pfGUISkin::pfSRect &r = fSkin->GetElement( fShowChildren ? pfGUISkin::kTreeButtonOpen : pfGUISkin::kTreeButtonClosed );
// For now, I can't think of a clean way of getting the current visible height to this function,
// but just testing the X value for tree controls is good enough for now. If we need Y testing for
// other elements, I'll figure out something.
if( localX >= 2 && localX <= 2 + r.fWidth )
{
ShowChildren( !fShowChildren );
return true;
}
}
return false;
}
void pfGUIListTreeRoot::GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height )
{
*width = textGen->CalcStringWidth( GetTitle(), height );
if( height != nil )
{
if( *height == 0 )
*height = 10; // Never allow zero height elements
else
*height += 0; // Add one pixel on each side for padding (or not, 3.21.02 mcn)
if( fSkin != nil )
{
UInt16 h = fSkin->GetElement( pfGUISkin::kTreeButtonClosed ).fHeight;
if( *height < h )
*height = h;
}
}
if( fSkin != nil )
*width += fSkin->GetElement( pfGUISkin::kTreeButtonClosed ).fWidth;
}
int pfGUIListTreeRoot::CompareTo( pfGUIListElement *rightSide )
{
pfGUIListTreeRoot *text = (pfGUIListTreeRoot *)rightSide;
if( text->fType != kTreeRoot )
return -2;
return wcscmp( GetTitle(), text->GetTitle() );
}
void pfGUIListTreeRoot::SetTitle( const char *text )
{
wchar_t *wText = hsStringToWString(text);
SetTitle(wText);
delete [] wText;
}
void pfGUIListTreeRoot::SetTitle( const wchar_t *text )
{
delete [] fText;
if( text != nil )
{
fText = TRACKED_NEW wchar_t[ wcslen( text ) + 1 ];
wcscpy( fText, text );
}
else
fText = nil;
}
void pfGUIListTreeRoot::AddChild( pfGUIListElement *el )
{
fChildren.Append( el );
el->SetIndentLevel( GetIndentLevel() + 1 );
el->SetCollapsed( !fShowChildren );
}
void pfGUIListTreeRoot::RemoveChild( UInt32 idx )
{
fChildren.Remove( idx );
}
void pfGUIListTreeRoot::ShowChildren( hsBool s )
{
UInt32 i;
fShowChildren = s;
for( i = 0; i < fChildren.GetCount(); i++ )
fChildren[ i ]->SetCollapsed( !s );
}
void pfGUIListTreeRoot::SetCollapsed( hsBool c )
{
UInt32 i;
pfGUIListElement::SetCollapsed( c );
for( i = 0; i < fChildren.GetCount(); i++ )
fChildren[ i ]->SetCollapsed( c ? true : !fShowChildren );
}

View File

@ -1,244 +1,244 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIListElement Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIListElement_h
#define _pfGUIListElement_h
#include "pfGUIControlMod.h"
class plDynamicTextMap;
class pfGUISkin;
class pfGUIListElement
{
protected:
hsBool fSelected;
const UInt8 fType;
hsBool fCollapsed; // For tree view support
UInt8 fIndentLevel; // Ditto
pfGUIColorScheme *fColors;
pfGUISkin *fSkin;
public:
enum Types
{
kText,
kPicture,
kTreeRoot
};
pfGUIListElement( UInt8 type ) : fType( type ), fSelected( false ), fCollapsed( false ), fIndentLevel( 0 ) {}
virtual ~pfGUIListElement() {}
virtual void Read( hsStream *s, hsResMgr *mgr );
virtual void Write( hsStream *s, hsResMgr *mgr );
virtual hsBool Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight ) = 0;
virtual void GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height ) = 0;
virtual int CompareTo( pfGUIListElement *rightSide ) = 0;
virtual void SetSelected( hsBool sel ) { fSelected = sel; }
virtual hsBool IsSelected( void ) { return fSelected; }
virtual hsBool CanBeDragged( void ) { return false; }
// Return true here if you need the list refreshed
virtual hsBool MouseClicked( UInt16 localX, UInt16 localY ) { return false; }
UInt8 GetType( void ) { return fType; }
void SetColorScheme( pfGUIColorScheme *scheme ) { fColors = scheme; }
void SetSkin( pfGUISkin *skin ) { fSkin = skin; }
hsBool IsCollapsed( void ) const { return fCollapsed; }
virtual void SetCollapsed( hsBool c ) { fCollapsed = c; }
UInt8 GetIndentLevel( void ) const { return fIndentLevel; }
void SetIndentLevel( UInt8 i ) { fIndentLevel = i; }
};
class pfGUIListText : public pfGUIListElement
{
public:
// these enums should at least agree with the plDynamicTextMap's version of the Justify types
enum JustifyTypes
{
kLeftJustify = 0,
kCenter,
kRightJustify
};
protected:
wchar_t *fText;
UInt8 fJustify; // This is not our JustifyTypes, but from plDynamicTextMap
public:
pfGUIListText();
pfGUIListText( const char *text );
pfGUIListText( const wchar_t *text );
virtual ~pfGUIListText();
virtual void Read( hsStream *s, hsResMgr *mgr );
virtual void Write( hsStream *s, hsResMgr *mgr );
virtual hsBool Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight );
virtual void GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height );
virtual int CompareTo( pfGUIListElement *rightSide );
virtual hsBool CanBeDragged( void ) { return true; }
virtual void SetJustify( JustifyTypes justify );
// These two are virtual so we can derive and override them
virtual const wchar_t *GetText( void ) { return fText; }
virtual void SetText( const char *text );
virtual void SetText( const wchar_t *text );
};
class pfGUIListPicture : public pfGUIListElement
{
protected:
plKey fMipmapKey;
UInt8 fBorderSize; // Defaults to 2
hsBool fRespectAlpha;
public:
pfGUIListPicture();
pfGUIListPicture( plKey mipKey, hsBool respectAlpha );
virtual ~pfGUIListPicture();
virtual void Read( hsStream *s, hsResMgr *mgr );
virtual void Write( hsStream *s, hsResMgr *mgr );
virtual hsBool Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight );
virtual void GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height );
virtual int CompareTo( pfGUIListElement *rightSide );
virtual hsBool CanBeDragged( void ) { return false; }
void SetBorderSize( UInt32 size ) { fBorderSize = (UInt8)size; }
void SetRespectAlpha( hsBool r ) { fRespectAlpha = r; }
};
class pfGUIListTreeRoot : public pfGUIListElement
{
protected:
wchar_t *fText;
hsBool fShowChildren;
hsTArray<pfGUIListElement *> fChildren;
public:
pfGUIListTreeRoot();
pfGUIListTreeRoot( const char *text );
pfGUIListTreeRoot( const wchar_t *text );
virtual ~pfGUIListTreeRoot();
virtual void Read( hsStream *s, hsResMgr *mgr );
virtual void Write( hsStream *s, hsResMgr *mgr );
virtual hsBool Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight );
virtual void GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height );
virtual int CompareTo( pfGUIListElement *rightSide );
virtual hsBool MouseClicked( UInt16 localX, UInt16 localY );
const wchar_t *GetTitle( void ) { return fText; }
void SetTitle( const char *text );
void SetTitle( const wchar_t *text );
UInt32 GetNumChildren( void ) const { return fChildren.GetCount(); }
pfGUIListElement *GetChild( UInt32 i ) const { return fChildren[ i ]; }
void AddChild( pfGUIListElement *el );
void RemoveChild( UInt32 idx );
virtual void SetCollapsed( hsBool c );
void ShowChildren( hsBool s );
hsBool IsShowingChildren( void ) const { return fShowChildren; }
};
//// pfGUIDropTargetProc /////////////////////////////////////////////////////
// A little proc object you create if you want a control to be a potential
// target for drag & drop operations. It has two functions: one takes a
// listElement and returns whether it can accept that type, and the other
// actually gets called when a listElement is "dropped" onto the associated
// control. Any control can be a dropTarget; just attach the right proc
// to it!
// If you are dragging multiple elements, both CanEat() and Eat() will get
// called for each element that is being dragged.
class pfGUIDropTargetProc
{
protected:
UInt32 fRefCnt;
public:
pfGUIDropTargetProc() { fRefCnt = 0; }
virtual hsBool CanEat( pfGUIListElement *element, pfGUIControlMod *source ) = 0;
virtual void Eat( pfGUIListElement *element, pfGUIControlMod *source, pfGUIControlMod *parent ) = 0;
// ONLY THE GUI SYSTEM SHOULD CALL THESE
void IncRef( void ) { fRefCnt++; }
hsBool DecRef( void ) { fRefCnt--; return ( fRefCnt > 0 ) ? false : true; }
};
#endif // _pfGUIListElement_h
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIListElement Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIListElement_h
#define _pfGUIListElement_h
#include "pfGUIControlMod.h"
class plDynamicTextMap;
class pfGUISkin;
class pfGUIListElement
{
protected:
hsBool fSelected;
const UInt8 fType;
hsBool fCollapsed; // For tree view support
UInt8 fIndentLevel; // Ditto
pfGUIColorScheme *fColors;
pfGUISkin *fSkin;
public:
enum Types
{
kText,
kPicture,
kTreeRoot
};
pfGUIListElement( UInt8 type ) : fType( type ), fSelected( false ), fCollapsed( false ), fIndentLevel( 0 ) {}
virtual ~pfGUIListElement() {}
virtual void Read( hsStream *s, hsResMgr *mgr );
virtual void Write( hsStream *s, hsResMgr *mgr );
virtual hsBool Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight ) = 0;
virtual void GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height ) = 0;
virtual int CompareTo( pfGUIListElement *rightSide ) = 0;
virtual void SetSelected( hsBool sel ) { fSelected = sel; }
virtual hsBool IsSelected( void ) { return fSelected; }
virtual hsBool CanBeDragged( void ) { return false; }
// Return true here if you need the list refreshed
virtual hsBool MouseClicked( UInt16 localX, UInt16 localY ) { return false; }
UInt8 GetType( void ) { return fType; }
void SetColorScheme( pfGUIColorScheme *scheme ) { fColors = scheme; }
void SetSkin( pfGUISkin *skin ) { fSkin = skin; }
hsBool IsCollapsed( void ) const { return fCollapsed; }
virtual void SetCollapsed( hsBool c ) { fCollapsed = c; }
UInt8 GetIndentLevel( void ) const { return fIndentLevel; }
void SetIndentLevel( UInt8 i ) { fIndentLevel = i; }
};
class pfGUIListText : public pfGUIListElement
{
public:
// these enums should at least agree with the plDynamicTextMap's version of the Justify types
enum JustifyTypes
{
kLeftJustify = 0,
kCenter,
kRightJustify
};
protected:
wchar_t *fText;
UInt8 fJustify; // This is not our JustifyTypes, but from plDynamicTextMap
public:
pfGUIListText();
pfGUIListText( const char *text );
pfGUIListText( const wchar_t *text );
virtual ~pfGUIListText();
virtual void Read( hsStream *s, hsResMgr *mgr );
virtual void Write( hsStream *s, hsResMgr *mgr );
virtual hsBool Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight );
virtual void GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height );
virtual int CompareTo( pfGUIListElement *rightSide );
virtual hsBool CanBeDragged( void ) { return true; }
virtual void SetJustify( JustifyTypes justify );
// These two are virtual so we can derive and override them
virtual const wchar_t *GetText( void ) { return fText; }
virtual void SetText( const char *text );
virtual void SetText( const wchar_t *text );
};
class pfGUIListPicture : public pfGUIListElement
{
protected:
plKey fMipmapKey;
UInt8 fBorderSize; // Defaults to 2
hsBool fRespectAlpha;
public:
pfGUIListPicture();
pfGUIListPicture( plKey mipKey, hsBool respectAlpha );
virtual ~pfGUIListPicture();
virtual void Read( hsStream *s, hsResMgr *mgr );
virtual void Write( hsStream *s, hsResMgr *mgr );
virtual hsBool Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight );
virtual void GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height );
virtual int CompareTo( pfGUIListElement *rightSide );
virtual hsBool CanBeDragged( void ) { return false; }
void SetBorderSize( UInt32 size ) { fBorderSize = (UInt8)size; }
void SetRespectAlpha( hsBool r ) { fRespectAlpha = r; }
};
class pfGUIListTreeRoot : public pfGUIListElement
{
protected:
wchar_t *fText;
hsBool fShowChildren;
hsTArray<pfGUIListElement *> fChildren;
public:
pfGUIListTreeRoot();
pfGUIListTreeRoot( const char *text );
pfGUIListTreeRoot( const wchar_t *text );
virtual ~pfGUIListTreeRoot();
virtual void Read( hsStream *s, hsResMgr *mgr );
virtual void Write( hsStream *s, hsResMgr *mgr );
virtual hsBool Draw( plDynamicTextMap *textGen, UInt16 x, UInt16 y, UInt16 maxWidth, UInt16 maxHeight );
virtual void GetSize( plDynamicTextMap *textGen, UInt16 *width, UInt16 *height );
virtual int CompareTo( pfGUIListElement *rightSide );
virtual hsBool MouseClicked( UInt16 localX, UInt16 localY );
const wchar_t *GetTitle( void ) { return fText; }
void SetTitle( const char *text );
void SetTitle( const wchar_t *text );
UInt32 GetNumChildren( void ) const { return fChildren.GetCount(); }
pfGUIListElement *GetChild( UInt32 i ) const { return fChildren[ i ]; }
void AddChild( pfGUIListElement *el );
void RemoveChild( UInt32 idx );
virtual void SetCollapsed( hsBool c );
void ShowChildren( hsBool s );
hsBool IsShowingChildren( void ) const { return fShowChildren; }
};
//// pfGUIDropTargetProc /////////////////////////////////////////////////////
// A little proc object you create if you want a control to be a potential
// target for drag & drop operations. It has two functions: one takes a
// listElement and returns whether it can accept that type, and the other
// actually gets called when a listElement is "dropped" onto the associated
// control. Any control can be a dropTarget; just attach the right proc
// to it!
// If you are dragging multiple elements, both CanEat() and Eat() will get
// called for each element that is being dragged.
class pfGUIDropTargetProc
{
protected:
UInt32 fRefCnt;
public:
pfGUIDropTargetProc() { fRefCnt = 0; }
virtual hsBool CanEat( pfGUIListElement *element, pfGUIControlMod *source ) = 0;
virtual void Eat( pfGUIListElement *element, pfGUIControlMod *source, pfGUIControlMod *parent ) = 0;
// ONLY THE GUI SYSTEM SHOULD CALL THESE
void IncRef( void ) { fRefCnt++; }
hsBool DecRef( void ) { fRefCnt--; return ( fRefCnt > 0 ) ? false : true; }
};
#endif // _pfGUIListElement_h

View File

@ -1,479 +1,479 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIMenuItem Definition //
// //
// The type of button that knows how to party. //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIMenuItem.h"
#include "pfGameGUIMgr.h"
#include "pfGUIControlHandlers.h"
#include "pfGUIDialogMod.h"
#include "pfGUIPopUpMenu.h"
#include "../plInputCore/plInputInterface.h"
#include "../pnMessage/plRefMsg.h"
#include "../plGImage/plDynamicTextMap.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIMenuItem::pfGUIMenuItem()
{
fName = nil;
fSkin = nil;
fReportingHover = false;
fSkinBuffersUpdated = true;
}
pfGUIMenuItem::~pfGUIMenuItem()
{
SetSkin( nil, kTop );
delete [] fName;
}
void pfGUIMenuItem::SetName( const char *name )
{
wchar_t *wName = hsStringToWString(name);
SetName(wName);
delete [] wName;
}
void pfGUIMenuItem::SetName( const wchar_t *name )
{
delete [] fName;
if (name != nil)
{
fName = TRACKED_NEW wchar_t[wcslen(name)+1];
wcscpy(fName,name);
}
else
fName = nil;
IUpdate();
}
//// SetSkin /////////////////////////////////////////////////////////////////
void pfGUIMenuItem::SetSkin( pfGUISkin *skin, HowToSkin s )
{
// Just a function wrapper for SendRef
if( fSkin != nil )
GetKey()->Release( fSkin->GetKey() );
if( skin != nil )
hsgResMgr::ResMgr()->SendRef( skin->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefSkin ), plRefFlags::kActiveRef );
fHowToSkin = s;
fSkinBuffersUpdated = false;
}
//// IPostSetUpDynTextMap ////////////////////////////////////////////////////
// Draw our initial image on the dynTextMap
void pfGUIMenuItem::IPostSetUpDynTextMap( void )
{
}
//// IGetDesiredExtraDTMRoom /////////////////////////////////////////////////
// Overridden so we can enlarge our DTMap by 3 vertically, to use the extra
// space as basically a double buffer for our skinning
void pfGUIMenuItem::IGrowDTMDimsToDesiredSize( UInt16 &width, UInt16 &height )
{
height *= 3;
}
//// IUpdateSkinBuffers //////////////////////////////////////////////////////
// Redraws the double buffers for the two skin images we keep hidden in the
// DTMap, so we don't have to re-composite them every time we draw the
// control.
void pfGUIMenuItem::IUpdateSkinBuffers( void )
{
if( fSkinBuffersUpdated )
return;
if( fSkin == nil )
return;
if( fDynTextMap == nil )
return;
if( fSkin->GetTexture() == nil )
return;
UInt16 y = fDynTextMap->GetVisibleHeight();
IUpdateSingleSkinBuffer( y, false );
IUpdateSingleSkinBuffer( y << 1, true );
fSkinBuffersUpdated = true;
}
//// IUpdateSingleSkinBuffer /////////////////////////////////////////////////
// Broken down functionality for the above function
void pfGUIMenuItem::IUpdateSingleSkinBuffer( UInt16 y, hsBool sel )
{
hsAssert( fSkin != nil && fDynTextMap != nil, "Invalid pointers in IUpdateSingleSkinBuffer()" );
// Note: add 1 to the visible height so we get enough overlap to take care of mipmapping issues
UInt16 x = 0, totWidth = fDynTextMap->GetVisibleWidth();
UInt16 totHeight = y + fDynTextMap->GetVisibleHeight();
pfGUISkin::pfSRect element;
totWidth -= fSkin->GetElement( pfGUISkin::kRightSpan ).fWidth;
if( fHowToSkin == kTop )
{
// Draw up-left corner
element = fSkin->GetElement( pfGUISkin::kUpLeftCorner );
fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, element.fWidth, element.fHeight, plDynamicTextMap::kImgSprite );
x += element.fWidth;
element = fSkin->GetElement( pfGUISkin::kTopSpan );
for( ; x < totWidth; )
{
UInt16 wid = element.fWidth;
if( x + wid > totWidth )
wid = totWidth - x;
fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, wid, element.fHeight, plDynamicTextMap::kImgSprite );
x += wid;
}
element = fSkin->GetElement( pfGUISkin::kUpRightCorner );
fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, element.fWidth, element.fHeight, plDynamicTextMap::kImgSprite );
y += element.fHeight;
}
else if( fHowToSkin == kBottom )
{
// Clip some space for now
totHeight -= fSkin->GetElement( pfGUISkin::kLowerLeftCorner ).fHeight;
}
// Group drawing by skin elements for caching performance
UInt16 startY = y;
x = 0;
element = fSkin->GetElement( pfGUISkin::kLeftSpan );
for( ; y < totHeight; )
{
UInt16 ht = element.fHeight;
if( y + ht > totHeight )
ht = totHeight - y;
fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, element.fWidth, ht, plDynamicTextMap::kImgSprite );
y += ht;
}
x += element.fWidth;
if( sel )
element = fSkin->GetElement( pfGUISkin::kSelectedFill );
else
element = fSkin->GetElement( pfGUISkin::kMiddleFill );
for( ; x < totWidth; )
{
UInt16 wid = element.fWidth;
if( x + wid > totWidth )
wid = totWidth - x;
for( y = startY; y < totHeight; )
{
UInt16 ht = element.fHeight;
if( y + ht > totHeight )
ht = totHeight - y;
fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, wid, ht, plDynamicTextMap::kImgSprite );
y += ht;
}
x += wid;
}
element = fSkin->GetElement( pfGUISkin::kRightSpan );
for( y = startY; y < totHeight; )
{
UInt16 ht = element.fHeight;
if( y + ht > totHeight )
ht = totHeight - y;
fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, element.fWidth, ht, plDynamicTextMap::kImgSprite );
y += ht;
}
if( fHowToSkin == kBottom )
{
x = 0;
// Draw lower-left corner
element = fSkin->GetElement( pfGUISkin::kLowerLeftCorner );
fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, element.fWidth, element.fHeight, plDynamicTextMap::kImgSprite );
x += element.fWidth;
element = fSkin->GetElement( pfGUISkin::kBottomSpan );
for( ; x < totWidth; )
{
UInt16 wid = element.fWidth;
if( x + wid > totWidth )
wid = totWidth - x;
fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, wid, element.fHeight, plDynamicTextMap::kImgSprite );
x += wid;
}
element = fSkin->GetElement( pfGUISkin::kLowerRightCorner );
fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, element.fWidth, element.fHeight, plDynamicTextMap::kImgSprite );
y += element.fHeight;
}
}
//// IUpdate /////////////////////////////////////////////////////////////////
void pfGUIMenuItem::IUpdate( void )
{
if( fDynTextMap == nil )
return;
if( fSkin != nil )
{
IUpdateSkinBuffers();
if( !fSkinBuffersUpdated )
return;
// Copy now from our skin buffer, plus set our text color
UInt16 y = fDynTextMap->GetVisibleHeight();
if( IsInteresting() )
{
fDynTextMap->DrawClippedImage( 0, 0, fDynTextMap, 0, y << 1, fDynTextMap->GetVisibleWidth(), y, plDynamicTextMap::kImgSprite );
fDynTextMap->SetTextColor( GetColorScheme()->fSelForeColor );
}
else
{
fDynTextMap->DrawClippedImage( 0, 0, fDynTextMap, 0, y, fDynTextMap->GetVisibleWidth(), y, plDynamicTextMap::kImgSprite );
fDynTextMap->SetTextColor( GetColorScheme()->fForeColor );
}
}
else
{
if( IsInteresting() )
{
fDynTextMap->ClearToColor( GetColorScheme()->fSelBackColor );
fDynTextMap->SetTextColor( GetColorScheme()->fSelForeColor );
}
else
{
fDynTextMap->ClearToColor( GetColorScheme()->fBackColor );
fDynTextMap->SetTextColor( GetColorScheme()->fForeColor );
}
}
fDynTextMap->SetJustify( plDynamicTextMap::kLeftJustify );
if( fName != nil )
{
UInt16 ht;
fDynTextMap->CalcStringWidth( fName, &ht );
Int16 x = 0, y = ( fDynTextMap->GetVisibleHeight() - ht ) >> 1;
if( fHowToSkin == kTop && fSkin != nil )
y += fSkin->GetElement( pfGUISkin::kTopSpan ).fHeight >> 1;
else if( fHowToSkin == kBottom && fSkin != nil )
y -= fSkin->GetElement( pfGUISkin::kTopSpan ).fHeight >> 1;
if( fSkin != nil )
x += fSkin->GetBorderMargin();
if( fClicking )
{
x += 2;
y += 2;
}
fDynTextMap->DrawClippedString( x, y, fName, fDynTextMap->GetVisibleWidth(), fDynTextMap->GetVisibleHeight() );
if( HasFlag( kDrawSubMenuArrow ) )
{
if( fSkin != nil )
{
pfGUISkin::pfSRect element;
if( IsInteresting() )
element = fSkin->GetElement( pfGUISkin::kSelectedSubMenuArrow );
else
element = fSkin->GetElement( pfGUISkin::kSubMenuArrow );
y += ( ht >> 1 ) - ( element.fHeight >> 1 );
if( y < 0 || y + element.fHeight >= fDynTextMap->GetHeight() )
y = 0;
fDynTextMap->DrawClippedImage( x + fDynTextMap->GetVisibleWidth() - 2 - element.fWidth
- fSkin->GetElement( pfGUISkin::kRightSpan ).fWidth,
y,
fSkin->GetTexture(), element.fX, element.fY, element.fWidth, element.fHeight, plDynamicTextMap::kImgBlend );
}
else
{
fDynTextMap->SetJustify( plDynamicTextMap::kRightJustify );
fDynTextMap->DrawString( x + fDynTextMap->GetVisibleWidth() - 2, y, ">>" );
}
}
}
fDynTextMap->FlushToHost();
}
void pfGUIMenuItem::PurgeDynaTextMapImage()
{
if ( fDynTextMap != nil )
fDynTextMap->PurgeImage();
}
//// GetTextExtents //////////////////////////////////////////////////////////
// Calculate the size of the drawn text.
void pfGUIMenuItem::GetTextExtents( UInt16 &width, UInt16 &height )
{
if( fName == nil )
width = height = 0;
else
width = fDynTextMap->CalcStringWidth( fName, &height );
}
//// MsgReceive //////////////////////////////////////////////////////////////
hsBool pfGUIMenuItem::MsgReceive( plMessage *msg )
{
return pfGUIButtonMod::MsgReceive( msg );
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUIMenuItem::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIButtonMod::Read( s, mgr );
}
void pfGUIMenuItem::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIButtonMod::Write( s, mgr );
}
//// HandleMouseDown/Up //////////////////////////////////////////////////////
void pfGUIMenuItem::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
{
pfGUIButtonMod::HandleMouseDown( mousePt, modifiers );
IUpdate();
}
void pfGUIMenuItem::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
{
pfGUIButtonMod::HandleMouseUp( mousePt, modifiers );
IUpdate();
}
void pfGUIMenuItem::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
{
/* if( !fClicking )
return;
if( fDraggable == nil )
return;
if( !fDraggable->IsVisible() )
{
// Are we outside ourselves?
if( !PointInBounds( mousePt ) )
{
// Yes, start dragging
StartDragging();
// Hand off our interest to the draggable
fDialog->SetControlOfInterest( fDraggable );
}
}
*/
pfGUIButtonMod::HandleMouseDrag( mousePt, modifiers );
}
void pfGUIMenuItem::HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers )
{
pfGUIButtonMod::HandleMouseHover( mousePt, modifiers );
if( HasFlag( kReportHovers ) )
{
if( PointInBounds( mousePt ) )
{
if( !fReportingHover && ( fDialog->GetControlOfInterest() == nil ||
fDialog->GetControlOfInterest() == this ) )
{
fReportingHover = true;
HandleExtendedEvent( kMouseHover );
fDialog->SetControlOfInterest( this );
}
}
else if( fReportingHover )
{
fReportingHover = false;
HandleExtendedEvent( kMouseExit );
fDialog->SetControlOfInterest( nil );
}
}
}
//// SetInteresting //////////////////////////////////////////////////////////
// Overridden to play mouse over animation when we're interesting
void pfGUIMenuItem::SetInteresting( hsBool i )
{
pfGUIButtonMod::SetInteresting( i );
IUpdate();
// Make sure we're not still thinking we're reporting hovers when we're not
if( !i )
fReportingHover = false;
}
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIMenuItem Definition //
// //
// The type of button that knows how to party. //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIMenuItem.h"
#include "pfGameGUIMgr.h"
#include "pfGUIControlHandlers.h"
#include "pfGUIDialogMod.h"
#include "pfGUIPopUpMenu.h"
#include "../plInputCore/plInputInterface.h"
#include "../pnMessage/plRefMsg.h"
#include "../plGImage/plDynamicTextMap.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIMenuItem::pfGUIMenuItem()
{
fName = nil;
fSkin = nil;
fReportingHover = false;
fSkinBuffersUpdated = true;
}
pfGUIMenuItem::~pfGUIMenuItem()
{
SetSkin( nil, kTop );
delete [] fName;
}
void pfGUIMenuItem::SetName( const char *name )
{
wchar_t *wName = hsStringToWString(name);
SetName(wName);
delete [] wName;
}
void pfGUIMenuItem::SetName( const wchar_t *name )
{
delete [] fName;
if (name != nil)
{
fName = TRACKED_NEW wchar_t[wcslen(name)+1];
wcscpy(fName,name);
}
else
fName = nil;
IUpdate();
}
//// SetSkin /////////////////////////////////////////////////////////////////
void pfGUIMenuItem::SetSkin( pfGUISkin *skin, HowToSkin s )
{
// Just a function wrapper for SendRef
if( fSkin != nil )
GetKey()->Release( fSkin->GetKey() );
if( skin != nil )
hsgResMgr::ResMgr()->SendRef( skin->GetKey(), TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefSkin ), plRefFlags::kActiveRef );
fHowToSkin = s;
fSkinBuffersUpdated = false;
}
//// IPostSetUpDynTextMap ////////////////////////////////////////////////////
// Draw our initial image on the dynTextMap
void pfGUIMenuItem::IPostSetUpDynTextMap( void )
{
}
//// IGetDesiredExtraDTMRoom /////////////////////////////////////////////////
// Overridden so we can enlarge our DTMap by 3 vertically, to use the extra
// space as basically a double buffer for our skinning
void pfGUIMenuItem::IGrowDTMDimsToDesiredSize( UInt16 &width, UInt16 &height )
{
height *= 3;
}
//// IUpdateSkinBuffers //////////////////////////////////////////////////////
// Redraws the double buffers for the two skin images we keep hidden in the
// DTMap, so we don't have to re-composite them every time we draw the
// control.
void pfGUIMenuItem::IUpdateSkinBuffers( void )
{
if( fSkinBuffersUpdated )
return;
if( fSkin == nil )
return;
if( fDynTextMap == nil )
return;
if( fSkin->GetTexture() == nil )
return;
UInt16 y = fDynTextMap->GetVisibleHeight();
IUpdateSingleSkinBuffer( y, false );
IUpdateSingleSkinBuffer( y << 1, true );
fSkinBuffersUpdated = true;
}
//// IUpdateSingleSkinBuffer /////////////////////////////////////////////////
// Broken down functionality for the above function
void pfGUIMenuItem::IUpdateSingleSkinBuffer( UInt16 y, hsBool sel )
{
hsAssert( fSkin != nil && fDynTextMap != nil, "Invalid pointers in IUpdateSingleSkinBuffer()" );
// Note: add 1 to the visible height so we get enough overlap to take care of mipmapping issues
UInt16 x = 0, totWidth = fDynTextMap->GetVisibleWidth();
UInt16 totHeight = y + fDynTextMap->GetVisibleHeight();
pfGUISkin::pfSRect element;
totWidth -= fSkin->GetElement( pfGUISkin::kRightSpan ).fWidth;
if( fHowToSkin == kTop )
{
// Draw up-left corner
element = fSkin->GetElement( pfGUISkin::kUpLeftCorner );
fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, element.fWidth, element.fHeight, plDynamicTextMap::kImgSprite );
x += element.fWidth;
element = fSkin->GetElement( pfGUISkin::kTopSpan );
for( ; x < totWidth; )
{
UInt16 wid = element.fWidth;
if( x + wid > totWidth )
wid = totWidth - x;
fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, wid, element.fHeight, plDynamicTextMap::kImgSprite );
x += wid;
}
element = fSkin->GetElement( pfGUISkin::kUpRightCorner );
fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, element.fWidth, element.fHeight, plDynamicTextMap::kImgSprite );
y += element.fHeight;
}
else if( fHowToSkin == kBottom )
{
// Clip some space for now
totHeight -= fSkin->GetElement( pfGUISkin::kLowerLeftCorner ).fHeight;
}
// Group drawing by skin elements for caching performance
UInt16 startY = y;
x = 0;
element = fSkin->GetElement( pfGUISkin::kLeftSpan );
for( ; y < totHeight; )
{
UInt16 ht = element.fHeight;
if( y + ht > totHeight )
ht = totHeight - y;
fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, element.fWidth, ht, plDynamicTextMap::kImgSprite );
y += ht;
}
x += element.fWidth;
if( sel )
element = fSkin->GetElement( pfGUISkin::kSelectedFill );
else
element = fSkin->GetElement( pfGUISkin::kMiddleFill );
for( ; x < totWidth; )
{
UInt16 wid = element.fWidth;
if( x + wid > totWidth )
wid = totWidth - x;
for( y = startY; y < totHeight; )
{
UInt16 ht = element.fHeight;
if( y + ht > totHeight )
ht = totHeight - y;
fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, wid, ht, plDynamicTextMap::kImgSprite );
y += ht;
}
x += wid;
}
element = fSkin->GetElement( pfGUISkin::kRightSpan );
for( y = startY; y < totHeight; )
{
UInt16 ht = element.fHeight;
if( y + ht > totHeight )
ht = totHeight - y;
fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, element.fWidth, ht, plDynamicTextMap::kImgSprite );
y += ht;
}
if( fHowToSkin == kBottom )
{
x = 0;
// Draw lower-left corner
element = fSkin->GetElement( pfGUISkin::kLowerLeftCorner );
fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, element.fWidth, element.fHeight, plDynamicTextMap::kImgSprite );
x += element.fWidth;
element = fSkin->GetElement( pfGUISkin::kBottomSpan );
for( ; x < totWidth; )
{
UInt16 wid = element.fWidth;
if( x + wid > totWidth )
wid = totWidth - x;
fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, wid, element.fHeight, plDynamicTextMap::kImgSprite );
x += wid;
}
element = fSkin->GetElement( pfGUISkin::kLowerRightCorner );
fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, element.fWidth, element.fHeight, plDynamicTextMap::kImgSprite );
y += element.fHeight;
}
}
//// IUpdate /////////////////////////////////////////////////////////////////
void pfGUIMenuItem::IUpdate( void )
{
if( fDynTextMap == nil )
return;
if( fSkin != nil )
{
IUpdateSkinBuffers();
if( !fSkinBuffersUpdated )
return;
// Copy now from our skin buffer, plus set our text color
UInt16 y = fDynTextMap->GetVisibleHeight();
if( IsInteresting() )
{
fDynTextMap->DrawClippedImage( 0, 0, fDynTextMap, 0, y << 1, fDynTextMap->GetVisibleWidth(), y, plDynamicTextMap::kImgSprite );
fDynTextMap->SetTextColor( GetColorScheme()->fSelForeColor );
}
else
{
fDynTextMap->DrawClippedImage( 0, 0, fDynTextMap, 0, y, fDynTextMap->GetVisibleWidth(), y, plDynamicTextMap::kImgSprite );
fDynTextMap->SetTextColor( GetColorScheme()->fForeColor );
}
}
else
{
if( IsInteresting() )
{
fDynTextMap->ClearToColor( GetColorScheme()->fSelBackColor );
fDynTextMap->SetTextColor( GetColorScheme()->fSelForeColor );
}
else
{
fDynTextMap->ClearToColor( GetColorScheme()->fBackColor );
fDynTextMap->SetTextColor( GetColorScheme()->fForeColor );
}
}
fDynTextMap->SetJustify( plDynamicTextMap::kLeftJustify );
if( fName != nil )
{
UInt16 ht;
fDynTextMap->CalcStringWidth( fName, &ht );
Int16 x = 0, y = ( fDynTextMap->GetVisibleHeight() - ht ) >> 1;
if( fHowToSkin == kTop && fSkin != nil )
y += fSkin->GetElement( pfGUISkin::kTopSpan ).fHeight >> 1;
else if( fHowToSkin == kBottom && fSkin != nil )
y -= fSkin->GetElement( pfGUISkin::kTopSpan ).fHeight >> 1;
if( fSkin != nil )
x += fSkin->GetBorderMargin();
if( fClicking )
{
x += 2;
y += 2;
}
fDynTextMap->DrawClippedString( x, y, fName, fDynTextMap->GetVisibleWidth(), fDynTextMap->GetVisibleHeight() );
if( HasFlag( kDrawSubMenuArrow ) )
{
if( fSkin != nil )
{
pfGUISkin::pfSRect element;
if( IsInteresting() )
element = fSkin->GetElement( pfGUISkin::kSelectedSubMenuArrow );
else
element = fSkin->GetElement( pfGUISkin::kSubMenuArrow );
y += ( ht >> 1 ) - ( element.fHeight >> 1 );
if( y < 0 || y + element.fHeight >= fDynTextMap->GetHeight() )
y = 0;
fDynTextMap->DrawClippedImage( x + fDynTextMap->GetVisibleWidth() - 2 - element.fWidth
- fSkin->GetElement( pfGUISkin::kRightSpan ).fWidth,
y,
fSkin->GetTexture(), element.fX, element.fY, element.fWidth, element.fHeight, plDynamicTextMap::kImgBlend );
}
else
{
fDynTextMap->SetJustify( plDynamicTextMap::kRightJustify );
fDynTextMap->DrawString( x + fDynTextMap->GetVisibleWidth() - 2, y, ">>" );
}
}
}
fDynTextMap->FlushToHost();
}
void pfGUIMenuItem::PurgeDynaTextMapImage()
{
if ( fDynTextMap != nil )
fDynTextMap->PurgeImage();
}
//// GetTextExtents //////////////////////////////////////////////////////////
// Calculate the size of the drawn text.
void pfGUIMenuItem::GetTextExtents( UInt16 &width, UInt16 &height )
{
if( fName == nil )
width = height = 0;
else
width = fDynTextMap->CalcStringWidth( fName, &height );
}
//// MsgReceive //////////////////////////////////////////////////////////////
hsBool pfGUIMenuItem::MsgReceive( plMessage *msg )
{
return pfGUIButtonMod::MsgReceive( msg );
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUIMenuItem::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIButtonMod::Read( s, mgr );
}
void pfGUIMenuItem::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIButtonMod::Write( s, mgr );
}
//// HandleMouseDown/Up //////////////////////////////////////////////////////
void pfGUIMenuItem::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
{
pfGUIButtonMod::HandleMouseDown( mousePt, modifiers );
IUpdate();
}
void pfGUIMenuItem::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
{
pfGUIButtonMod::HandleMouseUp( mousePt, modifiers );
IUpdate();
}
void pfGUIMenuItem::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
{
/* if( !fClicking )
return;
if( fDraggable == nil )
return;
if( !fDraggable->IsVisible() )
{
// Are we outside ourselves?
if( !PointInBounds( mousePt ) )
{
// Yes, start dragging
StartDragging();
// Hand off our interest to the draggable
fDialog->SetControlOfInterest( fDraggable );
}
}
*/
pfGUIButtonMod::HandleMouseDrag( mousePt, modifiers );
}
void pfGUIMenuItem::HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers )
{
pfGUIButtonMod::HandleMouseHover( mousePt, modifiers );
if( HasFlag( kReportHovers ) )
{
if( PointInBounds( mousePt ) )
{
if( !fReportingHover && ( fDialog->GetControlOfInterest() == nil ||
fDialog->GetControlOfInterest() == this ) )
{
fReportingHover = true;
HandleExtendedEvent( kMouseHover );
fDialog->SetControlOfInterest( this );
}
}
else if( fReportingHover )
{
fReportingHover = false;
HandleExtendedEvent( kMouseExit );
fDialog->SetControlOfInterest( nil );
}
}
}
//// SetInteresting //////////////////////////////////////////////////////////
// Overridden to play mouse over animation when we're interesting
void pfGUIMenuItem::SetInteresting( hsBool i )
{
pfGUIButtonMod::SetInteresting( i );
IUpdate();
// Make sure we're not still thinking we're reporting hovers when we're not
if( !i )
fReportingHover = false;
}

View File

@ -1,128 +1,128 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIMenuItem Header //
// //
// The type of button that knows how to party. //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIMenuItem_h
#define _pfGUIMenuItem_h
#include "pfGUIButtonMod.h"
class plMessage;
class pfGUISkin;
class pfGUIMenuItem : public pfGUIButtonMod
{
public:
enum HowToSkin
{
kTop,
kMiddle,
kBottom
};
protected:
wchar_t *fName;
hsBool fReportingHover;
HowToSkin fHowToSkin;
hsBool fSkinBuffersUpdated;
virtual void IGrowDTMDimsToDesiredSize( UInt16 &width, UInt16 &height );
virtual void IPostSetUpDynTextMap( void );
virtual void IUpdate( void );
void IUpdateSkinBuffers( void );
void IUpdateSingleSkinBuffer( UInt16 y, hsBool sel );
public:
pfGUIMenuItem();
virtual ~pfGUIMenuItem();
CLASSNAME_REGISTER( pfGUIMenuItem );
GETINTERFACE_ANY( pfGUIMenuItem, pfGUIButtonMod );
enum ItemFlags
{
kDrawSubMenuArrow = kDerivedFlagsStart,
kReportHovers
};
// Extended event types
enum ExtendedEvents
{
kMouseHover,
kMouseExit
};
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void SetInteresting( hsBool i );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers );
virtual void PurgeDynaTextMapImage();
void SetName( const char *name );
void SetName( const wchar_t *name );
const wchar_t *GetName( void ) const { return fName; }
void GetTextExtents( UInt16 &width, UInt16 &height );
void SetSkin( pfGUISkin *skin, HowToSkin s );
};
#endif // _pfGUIMenuItem_h
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIMenuItem Header //
// //
// The type of button that knows how to party. //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIMenuItem_h
#define _pfGUIMenuItem_h
#include "pfGUIButtonMod.h"
class plMessage;
class pfGUISkin;
class pfGUIMenuItem : public pfGUIButtonMod
{
public:
enum HowToSkin
{
kTop,
kMiddle,
kBottom
};
protected:
wchar_t *fName;
hsBool fReportingHover;
HowToSkin fHowToSkin;
hsBool fSkinBuffersUpdated;
virtual void IGrowDTMDimsToDesiredSize( UInt16 &width, UInt16 &height );
virtual void IPostSetUpDynTextMap( void );
virtual void IUpdate( void );
void IUpdateSkinBuffers( void );
void IUpdateSingleSkinBuffer( UInt16 y, hsBool sel );
public:
pfGUIMenuItem();
virtual ~pfGUIMenuItem();
CLASSNAME_REGISTER( pfGUIMenuItem );
GETINTERFACE_ANY( pfGUIMenuItem, pfGUIButtonMod );
enum ItemFlags
{
kDrawSubMenuArrow = kDerivedFlagsStart,
kReportHovers
};
// Extended event types
enum ExtendedEvents
{
kMouseHover,
kMouseExit
};
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void SetInteresting( hsBool i );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseHover( hsPoint3 &mousePt, UInt8 modifiers );
virtual void PurgeDynaTextMapImage();
void SetName( const char *name );
void SetName( const wchar_t *name );
const wchar_t *GetName( void ) const { return fName; }
void GetTextExtents( UInt16 &width, UInt16 &height );
void SetSkin( pfGUISkin *skin, HowToSkin s );
};
#endif // _pfGUIMenuItem_h

View File

@ -1,292 +1,292 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIMultiLineEditCtrl Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIMultiLineEditCtrl_h
#define _pfGUIMultiLineEditCtrl_h
#include "pfGUIControlMod.h"
#include "hsTemplates.h"
#include "../plInputCore/plInputDevice.h"
class plMessage;
class hsGMaterial;
class plTextGenerator;
class pfMLScrollProc;
class pfGUIValueCtrl;
struct plUndoAction;
class pfGUIMultiLineEditProc
{
public:
pfGUIMultiLineEditProc() {}
virtual ~pfGUIMultiLineEditProc() {}
// we've hit the end of the control list (by moving the cursor)
virtual void OnEndOfControlList(Int32 cursorPos) {}
// we've hit the beginning of the control ist (by moving the cursor)
virtual void OnBeginningOfControlList(Int32 cursorPos) {}
};
class pfGUIMultiLineEditCtrl : public pfGUIControlMod
{
public:
enum Direction
{
kLineStart = 1,
kLineEnd,
kBufferStart,
kBufferEnd,
kOneBack,
kOneForward,
kOneWordBack,
kOneWordForward,
kOneLineUp,
kOneLineDown,
kPageUp,
kPageDown
};
protected:
mutable hsTArray<wchar_t> fBuffer; // Because AcquireArray() isn't const
hsTArray<Int32> fLineStarts;
UInt16 fLineHeight, fCurrCursorX, fCurrCursorY;
Int32 fCursorPos, fLastCursorLine;
hsBool fIgnoreNextKey, fReadyToRender;
hsBounds3Ext fLastP2PArea;
Int8 fLockCount;
UInt8 fCalcedFontSize; // The font size that we calced our line height at
UInt8 fLastKeyModifiers;
wchar_t fLastKeyPressed;
static wchar_t fColorCodeChar, fStyleCodeChar;
static UInt32 fColorCodeSize, fStyleCodeSize;
wchar_t fLastDeadKey; // if the previous key was a dead key, its value goes here
wchar_t fDeadKeyConverter[256][256]; // first index is the dead key, second index is the char to combine it with
void SetupDeadKeyConverter();
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual void IPostSetUpDynTextMap( void );
virtual void IUpdate( void );
void IUpdate( Int32 startLine, Int32 endLine );
friend class pfMLScrollProc;
pfGUIValueCtrl *fScrollControl;
pfMLScrollProc *fScrollProc;
Int32 fScrollPos;
Int32 fBufferLimit;
pfGUIMultiLineEditCtrl *fNextCtrl; // used for linking multiple controls together to share a buffer
pfGUIMultiLineEditCtrl *fPrevCtrl;
pfGUIMultiLineEditProc *fEventProc; // where we send events to
std::string fFontFace;
hsColorRGBA fFontColor;
UInt8 fFontSize;
UInt8 fFontStyle;
enum flagsSet
{
kFontFaceSet = 1,
kFontColorSet = 2,
kFontSizeSet = 4,
kFontStyleSet = 8
};
UInt8 fFontFlagsSet;
int fTopMargin,fLeftMargin,fBottomMargin,fRightMargin;
void IMoveCursor( Direction dir );
void IMoveCursorTo( Int32 position ); // Updates selection
void ISetCursor( Int32 newPosition ); // Doesn't update selection
Int32 IRecalcLineStarts( Int32 startingLine, hsBool force, hsBool dontUpdate = false );
void IRecalcFromCursor( hsBool forceUpdate = false );
Int32 IFindCursorLine( Int32 cursorPos = -1 ) const;
hsBool IStoreLineStart( UInt32 line, Int32 start );
void IOffsetLineStarts( UInt32 position, Int32 offset, hsBool offsetSelectionEnd = false );
Int32 IPointToPosition( Int16 x, Int16 y, hsBool searchOutsideBounds = false );
Int32 ICalcNumVisibleLines( void ) const;
void IReadColorCode( Int32 &pos, hsColorRGBA &color ) const;
void IReadStyleCode( Int32 &pos, UInt8 &fontStyle ) const;
UInt32 IRenderLine( UInt16 x, UInt16 y, Int32 start, Int32 end, hsBool dontRender = false );
hsBool IFindLastColorCode( Int32 pos, hsColorRGBA &color, hsBool ignoreFirstCharacter = false ) const;
hsBool IFindLastStyleCode( Int32 pos, UInt8 &style, hsBool ignoreFirstCharacter = false ) const;
inline static bool IIsCodeChar( const wchar_t c );
inline static bool IIsRenderable( const wchar_t c );
inline static Int32 IOffsetToNextChar( wchar_t stringChar );
inline Int32 IOffsetToNextCharFromPos( Int32 pos ) const;
void IActuallyInsertColor( Int32 pos, hsColorRGBA &color );
void IActuallyInsertStyle( Int32 pos, UInt8 style );
void IUpdateScrollRange( void );
wchar_t *ICopyRange( Int32 start, Int32 end ) const;
Int32 ICharPosToBufferPos( Int32 charPos ) const;
void IUpdateBuffer();
void IUpdateLineStarts();
void ISetGlobalBuffer();
void ISetLineStarts(hsTArray<Int32> lineStarts);
void IHitEndOfControlList(Int32 cursorPos);
void IHitBeginningOfControlList(Int32 cursorPos);
public:
enum
{
kRefScrollCtrl = kRefDerivedStart
};
pfGUIMultiLineEditCtrl();
virtual ~pfGUIMultiLineEditCtrl();
CLASSNAME_REGISTER( pfGUIMultiLineEditCtrl );
GETINTERFACE_ANY( pfGUIMultiLineEditCtrl, pfGUIControlMod );
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual hsBool HandleKeyPress( char key, UInt8 modifiers );
virtual hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers );
virtual void PurgeDynaTextMapImage();
virtual void UpdateColorScheme() { fFontFlagsSet = 0; pfGUIControlMod::UpdateColorScheme(); }
// Extended event types
enum ExtendedEvents
{
kValueChanging,
kScrollPosChanged,
kKeyPressedEvent
};
void SetScrollPosition( Int32 topLine );
Int32 GetScrollPosition();
void MoveCursor( Direction dir );
void InsertChar( char c );
void InsertChar( wchar_t c);
void InsertString( const char *string );
void InsertString( const wchar_t *string );
void InsertColor( hsColorRGBA &color );
void InsertStyle( UInt8 fontStyle );
void DeleteChar( void );
void ClearBuffer( void );
void SetBuffer( const char *asciiText );
void SetBuffer( const wchar_t *asciiText );
void SetBuffer( const UInt8 *codedText, UInt32 length );
void SetBuffer( const UInt16 *codedText, UInt32 length );
char *GetNonCodedBuffer( void ) const;
wchar_t *GetNonCodedBufferW( void ) const;
UInt8 *GetCodedBuffer( UInt32 &length ) const;
UInt16 *GetCodedBufferW( UInt32 &length ) const;
UInt32 GetBufferSize();
void SetBufferLimit(Int32 limit) { fBufferLimit = limit; }
Int32 GetBufferLimit() { return fBufferLimit; }
void GetThisKeyPressed( char &key, UInt8 &modifiers ) const { key = (char)fLastKeyPressed; modifiers = fLastKeyModifiers; }
void Lock( void );
void Unlock( void );
hsBool IsLocked( void ) const { return ( fLockCount > 0 ) ? true : false; }
void SetScrollEnable( hsBool state );
void ForceUpdate() {/*IRecalcLineStarts(0,true);*/IUpdateLineStarts(); IUpdate();}
void SetNext( pfGUIMultiLineEditCtrl *newNext );
void ClearNext();
void SetPrev( pfGUIMultiLineEditCtrl *newPrev );
void ClearPrev();
void SetEventProc( pfGUIMultiLineEditProc *eventProc );
void ClearEventProc();
Int32 GetFirstVisibleLine();
Int32 GetLastVisibleLine();
Int32 GetNumVisibleLines() {return ICalcNumVisibleLines();}
void SetGlobalStartLine(Int32 line);
void SetCursorToLoc(Int32 loc) {ISetCursor(loc);}
void SetMargins(int top, int left, int bottom, int right);
UInt8 GetFontSize() {return fFontSize;} // because we're too cool to use the color scheme crap
void SetFontFace(std::string fontFace);
void SetFontColor(hsColorRGBA fontColor) {fFontColor = fontColor; fFontFlagsSet |= kFontColorSet;}
void SetFontSize(UInt8 fontSize);
void SetFontStyle(UInt8 fontStyle) {fFontStyle = fontStyle; fFontFlagsSet |= kFontStyleSet;}
hsBool ShowingBeginningOfBuffer();
hsBool ShowingEndOfBuffer();
void DeleteLinesFromTop(int numLines); // cursor and scroll position might be off after this call, not valid on connected controls
};
#endif // _pfGUIMultiLineEditCtrl_h
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIMultiLineEditCtrl Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIMultiLineEditCtrl_h
#define _pfGUIMultiLineEditCtrl_h
#include "pfGUIControlMod.h"
#include "hsTemplates.h"
#include "../plInputCore/plInputDevice.h"
class plMessage;
class hsGMaterial;
class plTextGenerator;
class pfMLScrollProc;
class pfGUIValueCtrl;
struct plUndoAction;
class pfGUIMultiLineEditProc
{
public:
pfGUIMultiLineEditProc() {}
virtual ~pfGUIMultiLineEditProc() {}
// we've hit the end of the control list (by moving the cursor)
virtual void OnEndOfControlList(Int32 cursorPos) {}
// we've hit the beginning of the control ist (by moving the cursor)
virtual void OnBeginningOfControlList(Int32 cursorPos) {}
};
class pfGUIMultiLineEditCtrl : public pfGUIControlMod
{
public:
enum Direction
{
kLineStart = 1,
kLineEnd,
kBufferStart,
kBufferEnd,
kOneBack,
kOneForward,
kOneWordBack,
kOneWordForward,
kOneLineUp,
kOneLineDown,
kPageUp,
kPageDown
};
protected:
mutable hsTArray<wchar_t> fBuffer; // Because AcquireArray() isn't const
hsTArray<Int32> fLineStarts;
UInt16 fLineHeight, fCurrCursorX, fCurrCursorY;
Int32 fCursorPos, fLastCursorLine;
hsBool fIgnoreNextKey, fReadyToRender;
hsBounds3Ext fLastP2PArea;
Int8 fLockCount;
UInt8 fCalcedFontSize; // The font size that we calced our line height at
UInt8 fLastKeyModifiers;
wchar_t fLastKeyPressed;
static wchar_t fColorCodeChar, fStyleCodeChar;
static UInt32 fColorCodeSize, fStyleCodeSize;
wchar_t fLastDeadKey; // if the previous key was a dead key, its value goes here
wchar_t fDeadKeyConverter[256][256]; // first index is the dead key, second index is the char to combine it with
void SetupDeadKeyConverter();
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual void IPostSetUpDynTextMap( void );
virtual void IUpdate( void );
void IUpdate( Int32 startLine, Int32 endLine );
friend class pfMLScrollProc;
pfGUIValueCtrl *fScrollControl;
pfMLScrollProc *fScrollProc;
Int32 fScrollPos;
Int32 fBufferLimit;
pfGUIMultiLineEditCtrl *fNextCtrl; // used for linking multiple controls together to share a buffer
pfGUIMultiLineEditCtrl *fPrevCtrl;
pfGUIMultiLineEditProc *fEventProc; // where we send events to
std::string fFontFace;
hsColorRGBA fFontColor;
UInt8 fFontSize;
UInt8 fFontStyle;
enum flagsSet
{
kFontFaceSet = 1,
kFontColorSet = 2,
kFontSizeSet = 4,
kFontStyleSet = 8
};
UInt8 fFontFlagsSet;
int fTopMargin,fLeftMargin,fBottomMargin,fRightMargin;
void IMoveCursor( Direction dir );
void IMoveCursorTo( Int32 position ); // Updates selection
void ISetCursor( Int32 newPosition ); // Doesn't update selection
Int32 IRecalcLineStarts( Int32 startingLine, hsBool force, hsBool dontUpdate = false );
void IRecalcFromCursor( hsBool forceUpdate = false );
Int32 IFindCursorLine( Int32 cursorPos = -1 ) const;
hsBool IStoreLineStart( UInt32 line, Int32 start );
void IOffsetLineStarts( UInt32 position, Int32 offset, hsBool offsetSelectionEnd = false );
Int32 IPointToPosition( Int16 x, Int16 y, hsBool searchOutsideBounds = false );
Int32 ICalcNumVisibleLines( void ) const;
void IReadColorCode( Int32 &pos, hsColorRGBA &color ) const;
void IReadStyleCode( Int32 &pos, UInt8 &fontStyle ) const;
UInt32 IRenderLine( UInt16 x, UInt16 y, Int32 start, Int32 end, hsBool dontRender = false );
hsBool IFindLastColorCode( Int32 pos, hsColorRGBA &color, hsBool ignoreFirstCharacter = false ) const;
hsBool IFindLastStyleCode( Int32 pos, UInt8 &style, hsBool ignoreFirstCharacter = false ) const;
inline static bool IIsCodeChar( const wchar_t c );
inline static bool IIsRenderable( const wchar_t c );
inline static Int32 IOffsetToNextChar( wchar_t stringChar );
inline Int32 IOffsetToNextCharFromPos( Int32 pos ) const;
void IActuallyInsertColor( Int32 pos, hsColorRGBA &color );
void IActuallyInsertStyle( Int32 pos, UInt8 style );
void IUpdateScrollRange( void );
wchar_t *ICopyRange( Int32 start, Int32 end ) const;
Int32 ICharPosToBufferPos( Int32 charPos ) const;
void IUpdateBuffer();
void IUpdateLineStarts();
void ISetGlobalBuffer();
void ISetLineStarts(hsTArray<Int32> lineStarts);
void IHitEndOfControlList(Int32 cursorPos);
void IHitBeginningOfControlList(Int32 cursorPos);
public:
enum
{
kRefScrollCtrl = kRefDerivedStart
};
pfGUIMultiLineEditCtrl();
virtual ~pfGUIMultiLineEditCtrl();
CLASSNAME_REGISTER( pfGUIMultiLineEditCtrl );
GETINTERFACE_ANY( pfGUIMultiLineEditCtrl, pfGUIControlMod );
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual hsBool HandleKeyPress( char key, UInt8 modifiers );
virtual hsBool HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef key, UInt8 modifiers );
virtual void PurgeDynaTextMapImage();
virtual void UpdateColorScheme() { fFontFlagsSet = 0; pfGUIControlMod::UpdateColorScheme(); }
// Extended event types
enum ExtendedEvents
{
kValueChanging,
kScrollPosChanged,
kKeyPressedEvent
};
void SetScrollPosition( Int32 topLine );
Int32 GetScrollPosition();
void MoveCursor( Direction dir );
void InsertChar( char c );
void InsertChar( wchar_t c);
void InsertString( const char *string );
void InsertString( const wchar_t *string );
void InsertColor( hsColorRGBA &color );
void InsertStyle( UInt8 fontStyle );
void DeleteChar( void );
void ClearBuffer( void );
void SetBuffer( const char *asciiText );
void SetBuffer( const wchar_t *asciiText );
void SetBuffer( const UInt8 *codedText, UInt32 length );
void SetBuffer( const UInt16 *codedText, UInt32 length );
char *GetNonCodedBuffer( void ) const;
wchar_t *GetNonCodedBufferW( void ) const;
UInt8 *GetCodedBuffer( UInt32 &length ) const;
UInt16 *GetCodedBufferW( UInt32 &length ) const;
UInt32 GetBufferSize();
void SetBufferLimit(Int32 limit) { fBufferLimit = limit; }
Int32 GetBufferLimit() { return fBufferLimit; }
void GetThisKeyPressed( char &key, UInt8 &modifiers ) const { key = (char)fLastKeyPressed; modifiers = fLastKeyModifiers; }
void Lock( void );
void Unlock( void );
hsBool IsLocked( void ) const { return ( fLockCount > 0 ) ? true : false; }
void SetScrollEnable( hsBool state );
void ForceUpdate() {/*IRecalcLineStarts(0,true);*/IUpdateLineStarts(); IUpdate();}
void SetNext( pfGUIMultiLineEditCtrl *newNext );
void ClearNext();
void SetPrev( pfGUIMultiLineEditCtrl *newPrev );
void ClearPrev();
void SetEventProc( pfGUIMultiLineEditProc *eventProc );
void ClearEventProc();
Int32 GetFirstVisibleLine();
Int32 GetLastVisibleLine();
Int32 GetNumVisibleLines() {return ICalcNumVisibleLines();}
void SetGlobalStartLine(Int32 line);
void SetCursorToLoc(Int32 loc) {ISetCursor(loc);}
void SetMargins(int top, int left, int bottom, int right);
UInt8 GetFontSize() {return fFontSize;} // because we're too cool to use the color scheme crap
void SetFontFace(std::string fontFace);
void SetFontColor(hsColorRGBA fontColor) {fFontColor = fontColor; fFontFlagsSet |= kFontColorSet;}
void SetFontSize(UInt8 fontSize);
void SetFontStyle(UInt8 fontStyle) {fFontStyle = fontStyle; fFontFlagsSet |= kFontStyleSet;}
hsBool ShowingBeginningOfBuffer();
hsBool ShowingEndOfBuffer();
void DeleteLinesFromTop(int numLines); // cursor and scroll position might be off after this call, not valid on connected controls
};
#endif // _pfGUIMultiLineEditCtrl_h

File diff suppressed because it is too large Load Diff

View File

@ -1,241 +1,241 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIPopUpMenu Header //
// //
// Pop-up menus are really just dialogs that know how to create themselves //
// and create buttons on themselves to simulate a menu (after all, that's //
// all a menu really is anyway). //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIPopUpMenu_h
#define _pfGUIPopUpMenu_h
#include "pfGUIDialogMod.h"
#include "hsBounds.h"
class plMessage;
class pfGUIButtonMod;
class pfPopUpKeyGenerator;
class pfGUICtrlProcObject;
class hsGMaterial;
class plSceneNode;
class pfGUIMenuItemProc;
class pfGUISkin;
class pfGUIPopUpMenu : public pfGUIDialogMod
{
public:
enum Alignment
{
kAlignUpLeft,
kAlignUpRight,
kAlignDownLeft,
kAlignDownRight // Default
};
protected:
friend class pfGUIMenuItemProc;
pfGUIDialogMod *fParent; // Pop-up menus also have a sense of who owns them
plSceneNode *fParentNode;
pfPopUpKeyGenerator *fKeyGen; // Generates keys for our dynamic objects
class pfMenuItem
{
// Simple wrapper class that tells us how to build our menu
public:
std::wstring fName;
pfGUICtrlProcObject *fHandler;
pfGUIPopUpMenu *fSubMenu;
float fYOffsetToNext; // Filled in by IBuildMenu()
pfMenuItem& operator=(const int zero) { fName = L""; fHandler = nil; fSubMenu = nil; fYOffsetToNext = 0; return *this; }
};
// Array of info to rebuild our menu from. Note that this is ONLY used when rebuilding
hsBool fNeedsRebuilding, fWaitingForSkin;
hsScalar fOriginX, fOriginY;
UInt16 fMargin;
hsTArray<pfMenuItem> fMenuItems;
Int32 fSubMenuOpen;
pfGUISkin *fSkin;
plSceneObject *fOriginAnchor;
pfGUIDialogMod *fOriginContext;
Alignment fAlignment;
hsBool IBuildMenu( void );
void ITearDownMenu( void );
hsGMaterial *ICreateDynMaterial( void );
void IHandleMenuSomething( UInt32 idx, pfGUIControlMod *ctrl, Int32 extended = -1 );
void ISeekToOrigin( void );
public:
pfGUIPopUpMenu();
virtual ~pfGUIPopUpMenu();
CLASSNAME_REGISTER( pfGUIPopUpMenu );
GETINTERFACE_ANY( pfGUIPopUpMenu, pfGUIDialogMod );
enum MenuFlags
{
kStayOpenAfterClick = kDerivedFlagsStart,
kModalOutsideMenus,
kOpenSubMenusOnHover,
kScaleWithResolution
};
enum Refs
{
kRefSkin = kRefDerviedStart,
kRefSubMenu,
kRefOriginAnchor,
kRefOriginContext,
kRefParentNode
};
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void SetEnabled( hsBool e );
virtual hsBool HandleMouseEvent( pfGameGUIMgr::EventType event, hsScalar mouseX, hsScalar mouseY, UInt8 modifiers );
void Show( hsScalar x, hsScalar y );
void SetOriginAnchor( plSceneObject *anchor, pfGUIDialogMod *context );
void SetAlignment( Alignment a ) { fAlignment = a; }
void ClearItems( void );
void AddItem( const char *name, pfGUICtrlProcObject *handler, pfGUIPopUpMenu *subMenu = nil );
void AddItem( const wchar_t *name, pfGUICtrlProcObject *handler, pfGUIPopUpMenu *subMenu = nil );
void SetSkin( pfGUISkin *skin );
static pfGUIPopUpMenu *Build( const char *name, pfGUIDialogMod *parent, hsScalar x, hsScalar y, const plLocation &destLoc = plLocation::kGlobalFixedLoc );
};
// Skin definition. Here for now 'cause only the menus use it, but might move it later
class plMipmap;
class pfGUISkin : public hsKeyedObject
{
public:
enum Elements
{
kUpLeftCorner = 0,
kTopSpan,
kUpRightCorner,
kRightSpan,
kLowerRightCorner,
kBottomSpan,
kLowerLeftCorner,
kLeftSpan,
kMiddleFill,
kSelectedFill,
kSubMenuArrow,
kSelectedSubMenuArrow,
kTreeButtonClosed,
kTreeButtonOpen,
kNumElements
};
class pfSRect
{
public:
UInt16 fX, fY, fWidth, fHeight;
void Empty( void ) { fX = fY = fWidth = fHeight = 0; }
void Read( hsStream *s );
void Write( hsStream *s );
};
protected:
plMipmap *fTexture;
pfSRect fElements[ kNumElements ];
UInt16 fItemMargin, fBorderMargin;
public:
pfGUISkin();
pfGUISkin( plMipmap *texture );
virtual ~pfGUISkin();
CLASSNAME_REGISTER( pfGUISkin );
GETINTERFACE_ANY( pfGUISkin, hsKeyedObject );
enum Refs
{
kRefMipmap
};
virtual void Read( hsStream *s, hsResMgr *mgr );
virtual void Write( hsStream *s, hsResMgr *mgr );
virtual hsBool MsgReceive( plMessage *msg );
plMipmap *GetTexture( void ) const { return fTexture; }
void SetTexture( plMipmap *tex );
const pfSRect &GetElement( UInt32 idx ) const { return fElements[ idx ]; }
hsBool IsElementSet( UInt32 idx ) const { return ( fElements[ idx ].fWidth > 0 && fElements[ idx ].fHeight > 0 ); }
void SetElement( UInt32 idx, UInt16 x, UInt16 y, UInt16 w, UInt16 h );
void SetMargins( UInt16 item, UInt16 border ) { fItemMargin = item; fBorderMargin = border; }
UInt16 GetItemMargin( void ) const { return fItemMargin; }
UInt16 GetBorderMargin( void ) const { return fBorderMargin; }
};
#endif // _pfGUIPopUpMenu_h
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIPopUpMenu Header //
// //
// Pop-up menus are really just dialogs that know how to create themselves //
// and create buttons on themselves to simulate a menu (after all, that's //
// all a menu really is anyway). //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIPopUpMenu_h
#define _pfGUIPopUpMenu_h
#include "pfGUIDialogMod.h"
#include "hsBounds.h"
class plMessage;
class pfGUIButtonMod;
class pfPopUpKeyGenerator;
class pfGUICtrlProcObject;
class hsGMaterial;
class plSceneNode;
class pfGUIMenuItemProc;
class pfGUISkin;
class pfGUIPopUpMenu : public pfGUIDialogMod
{
public:
enum Alignment
{
kAlignUpLeft,
kAlignUpRight,
kAlignDownLeft,
kAlignDownRight // Default
};
protected:
friend class pfGUIMenuItemProc;
pfGUIDialogMod *fParent; // Pop-up menus also have a sense of who owns them
plSceneNode *fParentNode;
pfPopUpKeyGenerator *fKeyGen; // Generates keys for our dynamic objects
class pfMenuItem
{
// Simple wrapper class that tells us how to build our menu
public:
std::wstring fName;
pfGUICtrlProcObject *fHandler;
pfGUIPopUpMenu *fSubMenu;
float fYOffsetToNext; // Filled in by IBuildMenu()
pfMenuItem& operator=(const int zero) { fName = L""; fHandler = nil; fSubMenu = nil; fYOffsetToNext = 0; return *this; }
};
// Array of info to rebuild our menu from. Note that this is ONLY used when rebuilding
hsBool fNeedsRebuilding, fWaitingForSkin;
hsScalar fOriginX, fOriginY;
UInt16 fMargin;
hsTArray<pfMenuItem> fMenuItems;
Int32 fSubMenuOpen;
pfGUISkin *fSkin;
plSceneObject *fOriginAnchor;
pfGUIDialogMod *fOriginContext;
Alignment fAlignment;
hsBool IBuildMenu( void );
void ITearDownMenu( void );
hsGMaterial *ICreateDynMaterial( void );
void IHandleMenuSomething( UInt32 idx, pfGUIControlMod *ctrl, Int32 extended = -1 );
void ISeekToOrigin( void );
public:
pfGUIPopUpMenu();
virtual ~pfGUIPopUpMenu();
CLASSNAME_REGISTER( pfGUIPopUpMenu );
GETINTERFACE_ANY( pfGUIPopUpMenu, pfGUIDialogMod );
enum MenuFlags
{
kStayOpenAfterClick = kDerivedFlagsStart,
kModalOutsideMenus,
kOpenSubMenusOnHover,
kScaleWithResolution
};
enum Refs
{
kRefSkin = kRefDerviedStart,
kRefSubMenu,
kRefOriginAnchor,
kRefOriginContext,
kRefParentNode
};
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void SetEnabled( hsBool e );
virtual hsBool HandleMouseEvent( pfGameGUIMgr::EventType event, hsScalar mouseX, hsScalar mouseY, UInt8 modifiers );
void Show( hsScalar x, hsScalar y );
void SetOriginAnchor( plSceneObject *anchor, pfGUIDialogMod *context );
void SetAlignment( Alignment a ) { fAlignment = a; }
void ClearItems( void );
void AddItem( const char *name, pfGUICtrlProcObject *handler, pfGUIPopUpMenu *subMenu = nil );
void AddItem( const wchar_t *name, pfGUICtrlProcObject *handler, pfGUIPopUpMenu *subMenu = nil );
void SetSkin( pfGUISkin *skin );
static pfGUIPopUpMenu *Build( const char *name, pfGUIDialogMod *parent, hsScalar x, hsScalar y, const plLocation &destLoc = plLocation::kGlobalFixedLoc );
};
// Skin definition. Here for now 'cause only the menus use it, but might move it later
class plMipmap;
class pfGUISkin : public hsKeyedObject
{
public:
enum Elements
{
kUpLeftCorner = 0,
kTopSpan,
kUpRightCorner,
kRightSpan,
kLowerRightCorner,
kBottomSpan,
kLowerLeftCorner,
kLeftSpan,
kMiddleFill,
kSelectedFill,
kSubMenuArrow,
kSelectedSubMenuArrow,
kTreeButtonClosed,
kTreeButtonOpen,
kNumElements
};
class pfSRect
{
public:
UInt16 fX, fY, fWidth, fHeight;
void Empty( void ) { fX = fY = fWidth = fHeight = 0; }
void Read( hsStream *s );
void Write( hsStream *s );
};
protected:
plMipmap *fTexture;
pfSRect fElements[ kNumElements ];
UInt16 fItemMargin, fBorderMargin;
public:
pfGUISkin();
pfGUISkin( plMipmap *texture );
virtual ~pfGUISkin();
CLASSNAME_REGISTER( pfGUISkin );
GETINTERFACE_ANY( pfGUISkin, hsKeyedObject );
enum Refs
{
kRefMipmap
};
virtual void Read( hsStream *s, hsResMgr *mgr );
virtual void Write( hsStream *s, hsResMgr *mgr );
virtual hsBool MsgReceive( plMessage *msg );
plMipmap *GetTexture( void ) const { return fTexture; }
void SetTexture( plMipmap *tex );
const pfSRect &GetElement( UInt32 idx ) const { return fElements[ idx ]; }
hsBool IsElementSet( UInt32 idx ) const { return ( fElements[ idx ].fWidth > 0 && fElements[ idx ].fHeight > 0 ); }
void SetElement( UInt32 idx, UInt16 x, UInt16 y, UInt16 w, UInt16 h );
void SetMargins( UInt16 item, UInt16 border ) { fItemMargin = item; fBorderMargin = border; }
UInt16 GetItemMargin( void ) const { return fItemMargin; }
UInt16 GetBorderMargin( void ) const { return fBorderMargin; }
};
#endif // _pfGUIPopUpMenu_h

View File

@ -1,271 +1,271 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIProgressCtrl Definition //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIProgressCtrl.h"
#include "pfGameGUIMgr.h"
#include "pfGUIDialogMod.h"
#include "../plInputCore/plInputInterface.h"
#include "../pnMessage/plRefMsg.h"
#include "../pfMessage/pfGameGUIMsg.h"
#include "../plMessage/plAnimCmdMsg.h"
#include "../plMessage/plTimerCallbackMsg.h"
// #include "../plAvatar/plAGModifier.h"
#include "../plAvatar/plAGMasterMod.h"
#include "../plAvatar/plAGAnimInstance.h"
#include "../plSurface/plLayerAnimation.h"
#include "../pnSceneObject/plSceneObject.h"
#include "../pnSceneObject/plCoordinateInterface.h"
#include "../pnTimer/plTimerCallbackManager.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIProgressCtrl::pfGUIProgressCtrl() : fStopSoundTimer(99)
{
fAnimTimesCalced = false;
fAnimName = nil;
fPlaySound = true;
}
pfGUIProgressCtrl::~pfGUIProgressCtrl()
{
delete [] fAnimName;
}
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIProgressCtrl::IEval( double secs, hsScalar del, UInt32 dirty )
{
return pfGUIValueCtrl::IEval( secs, del, dirty );
}
//// MsgReceive //////////////////////////////////////////////////////////////
hsBool pfGUIProgressCtrl::MsgReceive( plMessage *msg )
{
plTimerCallbackMsg *timerMsg = plTimerCallbackMsg::ConvertNoRef(msg);
if (timerMsg)
{
if (timerMsg->fID == fStopSoundTimer)
{
// we've finished animating, stop the sound that's playing
StopSound(kAnimateSound);
}
}
return pfGUIValueCtrl::MsgReceive( msg );
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUIProgressCtrl::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIValueCtrl::Read(s, mgr);
fAnimationKeys.Reset();
UInt32 i, count = s->ReadSwap32();
for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) );
fAnimName = s->ReadSafeString();
fAnimTimesCalced = false;
}
void pfGUIProgressCtrl::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIValueCtrl::Write( s, mgr );
UInt32 i, count = fAnimationKeys.GetCount();
s->WriteSwap32( count );
for( i = 0; i < count; i++ )
mgr->WriteKey( s, fAnimationKeys[ i ] );
s->WriteSafeString( fAnimName );
}
//// UpdateBounds ////////////////////////////////////////////////////////////
void pfGUIProgressCtrl::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool force )
{
pfGUIValueCtrl::UpdateBounds( invXformMatrix, force );
if( fAnimationKeys.GetCount() > 0 )
fBoundsValid = false;
}
//// SetAnimationKeys ////////////////////////////////////////////////////////
void pfGUIProgressCtrl::SetAnimationKeys( hsTArray<plKey> &keys, const char *name )
{
fAnimationKeys = keys;
delete [] fAnimName;
if( name != nil )
{
fAnimName = TRACKED_NEW char[ strlen( name ) + 1 ];
strcpy( fAnimName, name );
}
else
fAnimName = nil;
}
//// ICalcAnimTimes //////////////////////////////////////////////////////////
// Loops through and computes the max begin and end for our animations. If
// none of them are loaded and we're not already calced, returns false.
hsBool pfGUIProgressCtrl::ICalcAnimTimes( void )
{
if( fAnimTimesCalced )
return true;
hsScalar tBegin = 1e30, tEnd = -1e30;
bool foundOne = false;
for( int i = 0; i < fAnimationKeys.GetCount(); i++ )
{
// Handle AGMasterMods
plAGMasterMod *mod = plAGMasterMod::ConvertNoRef( fAnimationKeys[ i ]->ObjectIsLoaded() );
if( mod != nil )
{
for( int j = 0; j < mod->GetNumAnimations(); j++ )
{
hsScalar begin = mod->GetAnimInstance( j )->GetTimeConvert()->GetBegin();
hsScalar end = mod->GetAnimInstance( j )->GetTimeConvert()->GetEnd();
if( begin < tBegin )
tBegin = begin;
if( end > tEnd )
tEnd = end;
}
foundOne = true;
}
// Handle layer animations
plLayerAnimation *layer = plLayerAnimation::ConvertNoRef( fAnimationKeys[ i ]->ObjectIsLoaded() );
if( layer != nil )
{
hsScalar begin = layer->GetTimeConvert().GetBegin();
hsScalar end = layer->GetTimeConvert().GetEnd();
if( begin < tBegin )
tBegin = begin;
if( end > tEnd )
tEnd = end;
foundOne = true;
}
}
if( foundOne )
{
fAnimBegin = tBegin;
fAnimEnd = tEnd;
fAnimTimesCalced = true;
}
return fAnimTimesCalced;
}
//// SetCurrValue ////////////////////////////////////////////////////////////
void pfGUIProgressCtrl::SetCurrValue( hsScalar v )
{
int old = (int)fValue;
pfGUIValueCtrl::SetCurrValue( v );
// if( old == (int)fValue )
// return;
if( fAnimationKeys.GetCount() > 0 )
{
ICalcAnimTimes();
hsScalar tLength = fAnimEnd - fAnimBegin;
hsScalar newTime;
if( HasFlag( kReverseValues ) )
newTime = ( ( fMax - fValue ) / ( fMax - fMin ) ) * tLength + fAnimBegin;
else
newTime = ( ( fValue - fMin ) / ( fMax - fMin ) ) * tLength + fAnimBegin;
plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg();
msg->SetCmd( plAnimCmdMsg::kGoToTime );
msg->SetAnimName( fAnimName );
msg->fTime = newTime;
msg->AddReceivers( fAnimationKeys );
plgDispatch::MsgSend( msg );
}
}
void pfGUIProgressCtrl::AnimateToPercentage( hsScalar percent )
{
// percent should be a value in range 0.0 to 1.0
if (percent >= 0.0f && percent <= 1.0f)
{
pfGUIValueCtrl::SetCurrValue( (fMax - fMin) * percent + fMin );
if( fAnimationKeys.GetCount() > 0 )
{
plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg();
msg->SetCmd( plAnimCmdMsg::kPlayToPercentage );
msg->SetAnimName( fAnimName );
msg->fTime = percent;
msg->AddReceivers( fAnimationKeys );
plgDispatch::MsgSend( msg );
if (fPlaySound)
{
// play the sound, looping
PlaySound(kAnimateSound, true);
// setup a timer to call back when we finish animating
hsScalar elapsedTime = (fAnimEnd - fAnimBegin) * percent;
plTimerCallbackMsg *timerMsg = TRACKED_NEW plTimerCallbackMsg(GetKey(), fStopSoundTimer);
plgTimerCallbackMgr::NewTimer(elapsedTime, timerMsg);
}
}
}
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIProgressCtrl Definition //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIProgressCtrl.h"
#include "pfGameGUIMgr.h"
#include "pfGUIDialogMod.h"
#include "../plInputCore/plInputInterface.h"
#include "../pnMessage/plRefMsg.h"
#include "../pfMessage/pfGameGUIMsg.h"
#include "../plMessage/plAnimCmdMsg.h"
#include "../plMessage/plTimerCallbackMsg.h"
// #include "../plAvatar/plAGModifier.h"
#include "../plAvatar/plAGMasterMod.h"
#include "../plAvatar/plAGAnimInstance.h"
#include "../plSurface/plLayerAnimation.h"
#include "../pnSceneObject/plSceneObject.h"
#include "../pnSceneObject/plCoordinateInterface.h"
#include "../pnTimer/plTimerCallbackManager.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIProgressCtrl::pfGUIProgressCtrl() : fStopSoundTimer(99)
{
fAnimTimesCalced = false;
fAnimName = nil;
fPlaySound = true;
}
pfGUIProgressCtrl::~pfGUIProgressCtrl()
{
delete [] fAnimName;
}
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIProgressCtrl::IEval( double secs, hsScalar del, UInt32 dirty )
{
return pfGUIValueCtrl::IEval( secs, del, dirty );
}
//// MsgReceive //////////////////////////////////////////////////////////////
hsBool pfGUIProgressCtrl::MsgReceive( plMessage *msg )
{
plTimerCallbackMsg *timerMsg = plTimerCallbackMsg::ConvertNoRef(msg);
if (timerMsg)
{
if (timerMsg->fID == fStopSoundTimer)
{
// we've finished animating, stop the sound that's playing
StopSound(kAnimateSound);
}
}
return pfGUIValueCtrl::MsgReceive( msg );
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUIProgressCtrl::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIValueCtrl::Read(s, mgr);
fAnimationKeys.Reset();
UInt32 i, count = s->ReadSwap32();
for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) );
fAnimName = s->ReadSafeString();
fAnimTimesCalced = false;
}
void pfGUIProgressCtrl::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIValueCtrl::Write( s, mgr );
UInt32 i, count = fAnimationKeys.GetCount();
s->WriteSwap32( count );
for( i = 0; i < count; i++ )
mgr->WriteKey( s, fAnimationKeys[ i ] );
s->WriteSafeString( fAnimName );
}
//// UpdateBounds ////////////////////////////////////////////////////////////
void pfGUIProgressCtrl::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool force )
{
pfGUIValueCtrl::UpdateBounds( invXformMatrix, force );
if( fAnimationKeys.GetCount() > 0 )
fBoundsValid = false;
}
//// SetAnimationKeys ////////////////////////////////////////////////////////
void pfGUIProgressCtrl::SetAnimationKeys( hsTArray<plKey> &keys, const char *name )
{
fAnimationKeys = keys;
delete [] fAnimName;
if( name != nil )
{
fAnimName = TRACKED_NEW char[ strlen( name ) + 1 ];
strcpy( fAnimName, name );
}
else
fAnimName = nil;
}
//// ICalcAnimTimes //////////////////////////////////////////////////////////
// Loops through and computes the max begin and end for our animations. If
// none of them are loaded and we're not already calced, returns false.
hsBool pfGUIProgressCtrl::ICalcAnimTimes( void )
{
if( fAnimTimesCalced )
return true;
hsScalar tBegin = 1e30, tEnd = -1e30;
bool foundOne = false;
for( int i = 0; i < fAnimationKeys.GetCount(); i++ )
{
// Handle AGMasterMods
plAGMasterMod *mod = plAGMasterMod::ConvertNoRef( fAnimationKeys[ i ]->ObjectIsLoaded() );
if( mod != nil )
{
for( int j = 0; j < mod->GetNumAnimations(); j++ )
{
hsScalar begin = mod->GetAnimInstance( j )->GetTimeConvert()->GetBegin();
hsScalar end = mod->GetAnimInstance( j )->GetTimeConvert()->GetEnd();
if( begin < tBegin )
tBegin = begin;
if( end > tEnd )
tEnd = end;
}
foundOne = true;
}
// Handle layer animations
plLayerAnimation *layer = plLayerAnimation::ConvertNoRef( fAnimationKeys[ i ]->ObjectIsLoaded() );
if( layer != nil )
{
hsScalar begin = layer->GetTimeConvert().GetBegin();
hsScalar end = layer->GetTimeConvert().GetEnd();
if( begin < tBegin )
tBegin = begin;
if( end > tEnd )
tEnd = end;
foundOne = true;
}
}
if( foundOne )
{
fAnimBegin = tBegin;
fAnimEnd = tEnd;
fAnimTimesCalced = true;
}
return fAnimTimesCalced;
}
//// SetCurrValue ////////////////////////////////////////////////////////////
void pfGUIProgressCtrl::SetCurrValue( hsScalar v )
{
int old = (int)fValue;
pfGUIValueCtrl::SetCurrValue( v );
// if( old == (int)fValue )
// return;
if( fAnimationKeys.GetCount() > 0 )
{
ICalcAnimTimes();
hsScalar tLength = fAnimEnd - fAnimBegin;
hsScalar newTime;
if( HasFlag( kReverseValues ) )
newTime = ( ( fMax - fValue ) / ( fMax - fMin ) ) * tLength + fAnimBegin;
else
newTime = ( ( fValue - fMin ) / ( fMax - fMin ) ) * tLength + fAnimBegin;
plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg();
msg->SetCmd( plAnimCmdMsg::kGoToTime );
msg->SetAnimName( fAnimName );
msg->fTime = newTime;
msg->AddReceivers( fAnimationKeys );
plgDispatch::MsgSend( msg );
}
}
void pfGUIProgressCtrl::AnimateToPercentage( hsScalar percent )
{
// percent should be a value in range 0.0 to 1.0
if (percent >= 0.0f && percent <= 1.0f)
{
pfGUIValueCtrl::SetCurrValue( (fMax - fMin) * percent + fMin );
if( fAnimationKeys.GetCount() > 0 )
{
plAnimCmdMsg *msg = TRACKED_NEW plAnimCmdMsg();
msg->SetCmd( plAnimCmdMsg::kPlayToPercentage );
msg->SetAnimName( fAnimName );
msg->fTime = percent;
msg->AddReceivers( fAnimationKeys );
plgDispatch::MsgSend( msg );
if (fPlaySound)
{
// play the sound, looping
PlaySound(kAnimateSound, true);
// setup a timer to call back when we finish animating
hsScalar elapsedTime = (fAnimEnd - fAnimBegin) * percent;
plTimerCallbackMsg *timerMsg = TRACKED_NEW plTimerCallbackMsg(GetKey(), fStopSoundTimer);
plgTimerCallbackMgr::NewTimer(elapsedTime, timerMsg);
}
}
}
}

View File

@ -1,109 +1,109 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIProgressCtrl Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIProgressCtrl_h
#define _pfGUIProgressCtrl_h
#include "pfGUIValueCtrl.h"
class plMessage;
class plAGMasterMod;
class pfGUIProgressCtrl : public pfGUIValueCtrl
{
protected:
hsTArray<plKey> fAnimationKeys;
char *fAnimName;
// Computed once, once an anim is loaded that we can compute this with
hsScalar fAnimBegin, fAnimEnd;
hsBool fAnimTimesCalced;
hsBool fPlaySound;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
hsBool ICalcAnimTimes( void );
const UInt32 fStopSoundTimer;
public:
pfGUIProgressCtrl();
virtual ~pfGUIProgressCtrl();
CLASSNAME_REGISTER( pfGUIProgressCtrl );
GETINTERFACE_ANY( pfGUIProgressCtrl, pfGUIValueCtrl );
enum OurFlags
{
kReverseValues = kDerivedFlagsStart
};
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false );
virtual void SetCurrValue( hsScalar v );
virtual void AnimateToPercentage( hsScalar percent );
enum SoundEvents
{
kAnimateSound
};
void DontPlaySounds() { fPlaySound = false; }
// Export only
void SetAnimationKeys( hsTArray<plKey> &keys, const char *name );
};
#endif // _pfGUIProgressCtrl_h
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIProgressCtrl Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIProgressCtrl_h
#define _pfGUIProgressCtrl_h
#include "pfGUIValueCtrl.h"
class plMessage;
class plAGMasterMod;
class pfGUIProgressCtrl : public pfGUIValueCtrl
{
protected:
hsTArray<plKey> fAnimationKeys;
char *fAnimName;
// Computed once, once an anim is loaded that we can compute this with
hsScalar fAnimBegin, fAnimEnd;
hsBool fAnimTimesCalced;
hsBool fPlaySound;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
hsBool ICalcAnimTimes( void );
const UInt32 fStopSoundTimer;
public:
pfGUIProgressCtrl();
virtual ~pfGUIProgressCtrl();
CLASSNAME_REGISTER( pfGUIProgressCtrl );
GETINTERFACE_ANY( pfGUIProgressCtrl, pfGUIValueCtrl );
enum OurFlags
{
kReverseValues = kDerivedFlagsStart
};
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void UpdateBounds( hsMatrix44 *invXformMatrix = nil, hsBool force = false );
virtual void SetCurrValue( hsScalar v );
virtual void AnimateToPercentage( hsScalar percent );
enum SoundEvents
{
kAnimateSound
};
void DontPlaySounds() { fPlaySound = false; }
// Export only
void SetAnimationKeys( hsTArray<plKey> &keys, const char *name );
};
#endif // _pfGUIProgressCtrl_h

View File

@ -1,273 +1,273 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIRadioGroupCtrl Definition //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIRadioGroupCtrl.h"
#include "pfGameGUIMgr.h"
#include "pfGUICheckBoxCtrl.h"
#include "pfGUIControlHandlers.h"
#include "../pnMessage/plRefMsg.h"
#include "../pfMessage/pfGameGUIMsg.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Wee Little Control Proc for our buttons /////////////////////////////////
class pfGroupProc : public pfGUICtrlProcObject
{
protected:
pfGUIRadioGroupCtrl *fParent;
public:
pfGroupProc( pfGUIRadioGroupCtrl *parent )
{
fParent = parent;
}
virtual void DoSomething( pfGUIControlMod *ctrl )
{
Int32 newIdx;
// So one of our controls got clicked. That means that we change our value
// to the proper index
pfGUICheckBoxCtrl *check = pfGUICheckBoxCtrl::ConvertNoRef( ctrl );
// Are we unselecting? And do we allow this?
if( !check->IsChecked() && !fParent->HasFlag( pfGUIRadioGroupCtrl::kAllowNoSelection ) )
{
// Boo on you. Re-check
check->SetChecked( true );
return;
}
for( newIdx = 0; newIdx < fParent->fControls.GetCount(); newIdx++ )
{
if( fParent->fControls[ newIdx ] == check )
break;
}
if( newIdx == fParent->fControls.GetCount() )
newIdx = -1;
if( newIdx != fParent->fValue )
{
if( fParent->fValue != -1 )
fParent->fControls[ fParent->fValue ]->SetChecked( false );
fParent->fValue = newIdx;
if( newIdx != -1 )
fParent->fControls[ newIdx ]->SetChecked( true );
}
else
{
if( !check->IsChecked() && fParent->HasFlag( pfGUIRadioGroupCtrl::kAllowNoSelection ) )
{
// nobody is checked!
fParent->fValue = -1;
}
}
fParent->DoSomething();
}
};
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIRadioGroupCtrl::pfGUIRadioGroupCtrl()
{
fButtonProc = TRACKED_NEW pfGroupProc( this );
fButtonProc->IncRef();
SetFlag( kIntangible );
}
pfGUIRadioGroupCtrl::~pfGUIRadioGroupCtrl()
{
if( fButtonProc->DecRef() )
delete fButtonProc;
}
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIRadioGroupCtrl::IEval( double secs, hsScalar del, UInt32 dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
//// MsgReceive //////////////////////////////////////////////////////////////
hsBool pfGUIRadioGroupCtrl::MsgReceive( plMessage *msg )
{
plGenRefMsg *refMsg = plGenRefMsg::ConvertNoRef( msg );
if( refMsg != nil )
{
if( refMsg->fType == kRefControl )
{
if( refMsg->GetContext() & ( plRefMsg::kOnCreate | plRefMsg::kOnRequest | plRefMsg::kOnReplace ) )
{
fControls[ refMsg->fWhich ] = pfGUICheckBoxCtrl::ConvertNoRef( refMsg->GetRef() );
fControls[ refMsg->fWhich ]->SetHandler( fButtonProc );
if( fValue == refMsg->fWhich )
fControls[ refMsg->fWhich ]->SetChecked( true );
}
else
{
fControls[ refMsg->fWhich ] = nil;
}
return true;
}
}
return pfGUIControlMod::MsgReceive( msg );
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUIRadioGroupCtrl::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Read(s, mgr);
UInt32 i, count = s->ReadSwap32();
fControls.SetCountAndZero( count );
for( i = 0; i < count; i++ )
{
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefControl ), plRefFlags::kActiveRef );
}
fValue = fDefaultValue = s->ReadSwap16();
if( fValue != -1 && fControls[ fValue ] != nil )
fControls[ fValue ]->SetChecked( true );
}
void pfGUIRadioGroupCtrl::Write( hsStream *s, hsResMgr *mgr )
{
UInt32 i;
pfGUIControlMod::Write( s, mgr );
s->WriteSwap32( fControls.GetCount() );
for( i = 0; i < fControls.GetCount(); i++ )
mgr->WriteKey( s, fControls[ i ]->GetKey() );
s->WriteSwap16( (UInt16)fDefaultValue );
}
//// SetValue ////////////////////////////////////////////////////////////////
void pfGUIRadioGroupCtrl::SetValue( Int32 value )
{
if( value != fValue && ( value != -1 || HasFlag( kAllowNoSelection ) ) )
{
if( fValue != -1 )
fControls[ fValue ]->SetChecked( false );
fValue = value;
if( value != -1 )
fControls[ value ]->SetChecked( true );
DoSomething();
}
}
///// Setting to be trickled down to the underlings
void pfGUIRadioGroupCtrl::SetEnabled( hsBool e )
{
int i;
for( i = 0; i < fControls.GetCount(); i++ )
fControls[ i ]->SetEnabled(e);
}
void pfGUIRadioGroupCtrl::SetInteresting( hsBool e )
{
int i;
for( i = 0; i < fControls.GetCount(); i++ )
fControls[ i ]->SetInteresting(e);
}
void pfGUIRadioGroupCtrl::SetVisible( hsBool vis )
{
int i;
for( i = 0; i < fControls.GetCount(); i++ )
fControls[ i ]->SetVisible(vis);
}
void pfGUIRadioGroupCtrl::SetControlsFlag( int flag )
{
int i;
for( i = 0; i < fControls.GetCount(); i++ )
fControls[ i ]->SetFlag(flag);
}
void pfGUIRadioGroupCtrl::ClearControlsFlag( int flag )
{
int i;
for( i = 0; i < fControls.GetCount(); i++ )
fControls[ i ]->ClearFlag(flag);
}
//// Export Functions ////////////////////////////////////////////////////////
void pfGUIRadioGroupCtrl::ClearControlList( void )
{
fControls.Reset();
fValue = -1;
}
void pfGUIRadioGroupCtrl::AddControl( pfGUICheckBoxCtrl *ctrl )
{
fControls.Append( ctrl );
}
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIRadioGroupCtrl Definition //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIRadioGroupCtrl.h"
#include "pfGameGUIMgr.h"
#include "pfGUICheckBoxCtrl.h"
#include "pfGUIControlHandlers.h"
#include "../pnMessage/plRefMsg.h"
#include "../pfMessage/pfGameGUIMsg.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Wee Little Control Proc for our buttons /////////////////////////////////
class pfGroupProc : public pfGUICtrlProcObject
{
protected:
pfGUIRadioGroupCtrl *fParent;
public:
pfGroupProc( pfGUIRadioGroupCtrl *parent )
{
fParent = parent;
}
virtual void DoSomething( pfGUIControlMod *ctrl )
{
Int32 newIdx;
// So one of our controls got clicked. That means that we change our value
// to the proper index
pfGUICheckBoxCtrl *check = pfGUICheckBoxCtrl::ConvertNoRef( ctrl );
// Are we unselecting? And do we allow this?
if( !check->IsChecked() && !fParent->HasFlag( pfGUIRadioGroupCtrl::kAllowNoSelection ) )
{
// Boo on you. Re-check
check->SetChecked( true );
return;
}
for( newIdx = 0; newIdx < fParent->fControls.GetCount(); newIdx++ )
{
if( fParent->fControls[ newIdx ] == check )
break;
}
if( newIdx == fParent->fControls.GetCount() )
newIdx = -1;
if( newIdx != fParent->fValue )
{
if( fParent->fValue != -1 )
fParent->fControls[ fParent->fValue ]->SetChecked( false );
fParent->fValue = newIdx;
if( newIdx != -1 )
fParent->fControls[ newIdx ]->SetChecked( true );
}
else
{
if( !check->IsChecked() && fParent->HasFlag( pfGUIRadioGroupCtrl::kAllowNoSelection ) )
{
// nobody is checked!
fParent->fValue = -1;
}
}
fParent->DoSomething();
}
};
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIRadioGroupCtrl::pfGUIRadioGroupCtrl()
{
fButtonProc = TRACKED_NEW pfGroupProc( this );
fButtonProc->IncRef();
SetFlag( kIntangible );
}
pfGUIRadioGroupCtrl::~pfGUIRadioGroupCtrl()
{
if( fButtonProc->DecRef() )
delete fButtonProc;
}
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIRadioGroupCtrl::IEval( double secs, hsScalar del, UInt32 dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
//// MsgReceive //////////////////////////////////////////////////////////////
hsBool pfGUIRadioGroupCtrl::MsgReceive( plMessage *msg )
{
plGenRefMsg *refMsg = plGenRefMsg::ConvertNoRef( msg );
if( refMsg != nil )
{
if( refMsg->fType == kRefControl )
{
if( refMsg->GetContext() & ( plRefMsg::kOnCreate | plRefMsg::kOnRequest | plRefMsg::kOnReplace ) )
{
fControls[ refMsg->fWhich ] = pfGUICheckBoxCtrl::ConvertNoRef( refMsg->GetRef() );
fControls[ refMsg->fWhich ]->SetHandler( fButtonProc );
if( fValue == refMsg->fWhich )
fControls[ refMsg->fWhich ]->SetChecked( true );
}
else
{
fControls[ refMsg->fWhich ] = nil;
}
return true;
}
}
return pfGUIControlMod::MsgReceive( msg );
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUIRadioGroupCtrl::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Read(s, mgr);
UInt32 i, count = s->ReadSwap32();
fControls.SetCountAndZero( count );
for( i = 0; i < count; i++ )
{
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefControl ), plRefFlags::kActiveRef );
}
fValue = fDefaultValue = s->ReadSwap16();
if( fValue != -1 && fControls[ fValue ] != nil )
fControls[ fValue ]->SetChecked( true );
}
void pfGUIRadioGroupCtrl::Write( hsStream *s, hsResMgr *mgr )
{
UInt32 i;
pfGUIControlMod::Write( s, mgr );
s->WriteSwap32( fControls.GetCount() );
for( i = 0; i < fControls.GetCount(); i++ )
mgr->WriteKey( s, fControls[ i ]->GetKey() );
s->WriteSwap16( (UInt16)fDefaultValue );
}
//// SetValue ////////////////////////////////////////////////////////////////
void pfGUIRadioGroupCtrl::SetValue( Int32 value )
{
if( value != fValue && ( value != -1 || HasFlag( kAllowNoSelection ) ) )
{
if( fValue != -1 )
fControls[ fValue ]->SetChecked( false );
fValue = value;
if( value != -1 )
fControls[ value ]->SetChecked( true );
DoSomething();
}
}
///// Setting to be trickled down to the underlings
void pfGUIRadioGroupCtrl::SetEnabled( hsBool e )
{
int i;
for( i = 0; i < fControls.GetCount(); i++ )
fControls[ i ]->SetEnabled(e);
}
void pfGUIRadioGroupCtrl::SetInteresting( hsBool e )
{
int i;
for( i = 0; i < fControls.GetCount(); i++ )
fControls[ i ]->SetInteresting(e);
}
void pfGUIRadioGroupCtrl::SetVisible( hsBool vis )
{
int i;
for( i = 0; i < fControls.GetCount(); i++ )
fControls[ i ]->SetVisible(vis);
}
void pfGUIRadioGroupCtrl::SetControlsFlag( int flag )
{
int i;
for( i = 0; i < fControls.GetCount(); i++ )
fControls[ i ]->SetFlag(flag);
}
void pfGUIRadioGroupCtrl::ClearControlsFlag( int flag )
{
int i;
for( i = 0; i < fControls.GetCount(); i++ )
fControls[ i ]->ClearFlag(flag);
}
//// Export Functions ////////////////////////////////////////////////////////
void pfGUIRadioGroupCtrl::ClearControlList( void )
{
fControls.Reset();
fValue = -1;
}
void pfGUIRadioGroupCtrl::AddControl( pfGUICheckBoxCtrl *ctrl )
{
fControls.Append( ctrl );
}

View File

@ -1,110 +1,110 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIRadioGroupCtrl Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIRadioGroupCtrl_h
#define _pfGUIRadioGroupCtrl_h
#include "pfGUIValueCtrl.h"
#include "hsTemplates.h"
class plMessage;
class pfGUICheckBoxCtrl;
class pfGroupProc;
class pfGUIRadioGroupCtrl : public pfGUIControlMod
{
friend class pfGroupProc;
protected:
enum
{
kRefControl = kRefDerivedStart
};
hsTArray<pfGUICheckBoxCtrl *> fControls;
pfGroupProc *fButtonProc;
Int32 fValue, fDefaultValue;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
public:
pfGUIRadioGroupCtrl();
virtual ~pfGUIRadioGroupCtrl();
CLASSNAME_REGISTER( pfGUIRadioGroupCtrl );
GETINTERFACE_ANY( pfGUIRadioGroupCtrl, pfGUIControlMod );
enum OurFlags
{
kAllowNoSelection = kDerivedFlagsStart
};
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
Int32 GetValue( void ) { return fValue; }
void SetValue( Int32 value );
virtual void SetEnabled( hsBool e );
virtual void SetInteresting( hsBool e );
virtual void SetVisible( hsBool vis );
virtual void SetControlsFlag( int flag );
virtual void ClearControlsFlag( int flag );
/// Export ONLY
void ClearControlList( void );
void AddControl( pfGUICheckBoxCtrl *ctrl );
void SetDefaultValue( Int32 value ) { fDefaultValue = value; }
};
#endif // _pfGUIRadioGroupCtrl_h
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIRadioGroupCtrl Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIRadioGroupCtrl_h
#define _pfGUIRadioGroupCtrl_h
#include "pfGUIValueCtrl.h"
#include "hsTemplates.h"
class plMessage;
class pfGUICheckBoxCtrl;
class pfGroupProc;
class pfGUIRadioGroupCtrl : public pfGUIControlMod
{
friend class pfGroupProc;
protected:
enum
{
kRefControl = kRefDerivedStart
};
hsTArray<pfGUICheckBoxCtrl *> fControls;
pfGroupProc *fButtonProc;
Int32 fValue, fDefaultValue;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
public:
pfGUIRadioGroupCtrl();
virtual ~pfGUIRadioGroupCtrl();
CLASSNAME_REGISTER( pfGUIRadioGroupCtrl );
GETINTERFACE_ANY( pfGUIRadioGroupCtrl, pfGUIControlMod );
enum OurFlags
{
kAllowNoSelection = kDerivedFlagsStart
};
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
Int32 GetValue( void ) { return fValue; }
void SetValue( Int32 value );
virtual void SetEnabled( hsBool e );
virtual void SetInteresting( hsBool e );
virtual void SetVisible( hsBool vis );
virtual void SetControlsFlag( int flag );
virtual void ClearControlsFlag( int flag );
/// Export ONLY
void ClearControlList( void );
void AddControl( pfGUICheckBoxCtrl *ctrl );
void SetDefaultValue( Int32 value ) { fDefaultValue = value; }
};
#endif // _pfGUIRadioGroupCtrl_h

View File

@ -1,98 +1,98 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUITagDefs.cpp //
// List of Tag IDs for the GameGUIMgr //
// //
//////////////////////////////////////////////////////////////////////////////
#include "pfGameGUIMgr.h"
#include "pfGUITagDefs.h"
//// Tag List ////////////////////////////////////////////////////////////////
// Here's the actual list of tags. It's basically a list of konstants, but
// they get translated into two things:
// 1. An enum, to send as a UInt32 to the GetDialogFromTag() and
// GetControlFromTag() functions.
// 2. A string, which gets put in a dropdown box in the appropriate
// MAX component, which sets the given control's tag ID to the
// right konstant.
// Step 1: add your konstant to the end of the .h file list
// Step 2: Add the string here
pfGUITag gGUITags[] = {
{ kKIMainDialog, "KI Main Dialog" },
{ kKITestEditBox, "KI Test Control" },
{ kKIEntryDlg, "KI Entry Dlg" },
{ kKICloseButton, "KI Close Dlg Button" },
{ kKITestControl2, "KI Test Control 2" },
{ kKIAddButton, "KI Add Button" },
{ kKIEditButton, "KI Edit Button" },
{ kKIRemoveButton, "KI Remove Button" },
{ kKIYesNoDlg, "KI Yes/No Dialog" },
{ kKIYesBtn, "KI Yes Button" },
{ kKINoBtn, "KI No Button" },
{ kKIStaticText, "KI Static Text" },
{ kKITestControl3, "KI Test Control 3" },
{ kKIMiniDialog, "KI Mini Dialog" },
{ kPlayerBook, "PB Dialog" },
{ kPBLinkToBtn, "PB Link To Button" },
{ kPBSaveLinkBtn, "PB Save Link Button" },
{ kPBSaveSlotRadio, "PB Save Slot Radio" },
{ kPBSaveSlotPrev1, "PB Save Slot Preview 1" },
{ kPBSaveSlotPrev2, "PB Save Slot Preview 2" },
{ kPBSaveSlotPrev3, "PB Save Slot Preview 3" },
{ kPBSaveSlotPrev4, "PB Save Slot Preview 4" },
{ kPBSaveSlotPrev5, "PB Save Slot Preview 5" },
{ kPBSaveSlotPrev6, "PB Save Slot Preview 6" },
{ kKICurrPlayerText, "KI Current Player Label" },
{ kKIPlayerList, "KI Mini Friends List" },
{ kKIChatModeBtn, "KI Toggle Chat Mode Btn" },
{ kBlackBarDlg, "Black Bar Dialog" },
{ kBlackBarKIButtons, "Black Bar KI Radio Group" },
{ kKILogoutButton, "KI Logout Button" },
{ 0, "" } // Ending tag, MUST ALWAYS BE HERE
};
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUITagDefs.cpp //
// List of Tag IDs for the GameGUIMgr //
// //
//////////////////////////////////////////////////////////////////////////////
#include "pfGameGUIMgr.h"
#include "pfGUITagDefs.h"
//// Tag List ////////////////////////////////////////////////////////////////
// Here's the actual list of tags. It's basically a list of konstants, but
// they get translated into two things:
// 1. An enum, to send as a UInt32 to the GetDialogFromTag() and
// GetControlFromTag() functions.
// 2. A string, which gets put in a dropdown box in the appropriate
// MAX component, which sets the given control's tag ID to the
// right konstant.
// Step 1: add your konstant to the end of the .h file list
// Step 2: Add the string here
pfGUITag gGUITags[] = {
{ kKIMainDialog, "KI Main Dialog" },
{ kKITestEditBox, "KI Test Control" },
{ kKIEntryDlg, "KI Entry Dlg" },
{ kKICloseButton, "KI Close Dlg Button" },
{ kKITestControl2, "KI Test Control 2" },
{ kKIAddButton, "KI Add Button" },
{ kKIEditButton, "KI Edit Button" },
{ kKIRemoveButton, "KI Remove Button" },
{ kKIYesNoDlg, "KI Yes/No Dialog" },
{ kKIYesBtn, "KI Yes Button" },
{ kKINoBtn, "KI No Button" },
{ kKIStaticText, "KI Static Text" },
{ kKITestControl3, "KI Test Control 3" },
{ kKIMiniDialog, "KI Mini Dialog" },
{ kPlayerBook, "PB Dialog" },
{ kPBLinkToBtn, "PB Link To Button" },
{ kPBSaveLinkBtn, "PB Save Link Button" },
{ kPBSaveSlotRadio, "PB Save Slot Radio" },
{ kPBSaveSlotPrev1, "PB Save Slot Preview 1" },
{ kPBSaveSlotPrev2, "PB Save Slot Preview 2" },
{ kPBSaveSlotPrev3, "PB Save Slot Preview 3" },
{ kPBSaveSlotPrev4, "PB Save Slot Preview 4" },
{ kPBSaveSlotPrev5, "PB Save Slot Preview 5" },
{ kPBSaveSlotPrev6, "PB Save Slot Preview 6" },
{ kKICurrPlayerText, "KI Current Player Label" },
{ kKIPlayerList, "KI Mini Friends List" },
{ kKIChatModeBtn, "KI Toggle Chat Mode Btn" },
{ kBlackBarDlg, "Black Bar Dialog" },
{ kBlackBarKIButtons, "Black Bar KI Radio Group" },
{ kKILogoutButton, "KI Logout Button" },
{ 0, "" } // Ending tag, MUST ALWAYS BE HERE
};

View File

@ -1,104 +1,104 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUITagDefs.cpp //
// List of Tag IDs for the GameGUIMgr //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUITagDefs_h
#define _pfGUITagDefs_h
#include "pfGameGUIMgr.h"
//// Tag List ////////////////////////////////////////////////////////////////
// Here's the actual list of tags. It's basically a list of konstants, but
// they get translated into two things:
// 1. An enum, to send as a UInt32 to the GetDialogFromTag() and
// GetControlFromTag() functions.
// 2. A string, which gets put in a dropdown box in the appropriate
// MAX component, which sets the given control's tag ID to the
// right konstant.
// Step 1: Add your konstant to the end of this list
enum
{
kKIMainDialog = 1,
kKITestEditBox,
kKIEntryDlg,
kKICloseButton,
kKITestControl2,
kKIAddButton,
kKIEditButton,
kKIRemoveButton,
kKIYesNoDlg,
kKIYesBtn,
kKINoBtn,
kKIStaticText,
kKITestControl3,
kKIMiniDialog,
kPlayerBook,
kPBLinkToBtn,
kPBSaveLinkBtn,
kPBSaveSlotRadio,
kPBSaveSlotPrev1,
kPBSaveSlotPrev2,
kPBSaveSlotPrev3,
kPBSaveSlotPrev4,
kPBSaveSlotPrev5,
kPBSaveSlotPrev6,
kKICurrPlayerText = 30,
kKIPlayerList = 31,
kKIChatModeBtn = 32,
kBlackBarDlg = 33,
kBlackBarKIButtons = 34,
kKILogoutButton = 35,
};
// Step 2: Add the string to the .cpp file
#endif
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUITagDefs.cpp //
// List of Tag IDs for the GameGUIMgr //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUITagDefs_h
#define _pfGUITagDefs_h
#include "pfGameGUIMgr.h"
//// Tag List ////////////////////////////////////////////////////////////////
// Here's the actual list of tags. It's basically a list of konstants, but
// they get translated into two things:
// 1. An enum, to send as a UInt32 to the GetDialogFromTag() and
// GetControlFromTag() functions.
// 2. A string, which gets put in a dropdown box in the appropriate
// MAX component, which sets the given control's tag ID to the
// right konstant.
// Step 1: Add your konstant to the end of this list
enum
{
kKIMainDialog = 1,
kKITestEditBox,
kKIEntryDlg,
kKICloseButton,
kKITestControl2,
kKIAddButton,
kKIEditButton,
kKIRemoveButton,
kKIYesNoDlg,
kKIYesBtn,
kKINoBtn,
kKIStaticText,
kKITestControl3,
kKIMiniDialog,
kPlayerBook,
kPBLinkToBtn,
kPBSaveLinkBtn,
kPBSaveSlotRadio,
kPBSaveSlotPrev1,
kPBSaveSlotPrev2,
kPBSaveSlotPrev3,
kPBSaveSlotPrev4,
kPBSaveSlotPrev5,
kPBSaveSlotPrev6,
kKICurrPlayerText = 30,
kKIPlayerList = 31,
kKIChatModeBtn = 32,
kBlackBarDlg = 33,
kBlackBarKIButtons = 34,
kKILogoutButton = 35,
};
// Step 2: Add the string to the .cpp file
#endif

View File

@ -1,262 +1,262 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUITextBoxMod Definition //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "hsStlUtils.h"
#include "pfGUITextBoxMod.h"
#include "pfGameGUIMgr.h"
#include "../pnMessage/plRefMsg.h"
#include "../pfMessage/pfGameGUIMsg.h"
#include "../plMessage/plAnimCmdMsg.h"
#include "../plAvatar/plAGModifier.h"
#include "../plGImage/plDynamicTextMap.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
#include "../plResMgr/plLocalization.h"
#include "../pfLocalizationMgr/pfLocalizationMgr.h"
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUITextBoxMod::pfGUITextBoxMod()
{
// SetFlag( kWantsInterest );
SetFlag( kIntangible );
fText = nil;
fUseLocalizationPath = false;
}
pfGUITextBoxMod::~pfGUITextBoxMod()
{
delete [] fText;
}
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUITextBoxMod::IEval( double secs, hsScalar del, UInt32 dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
//// MsgReceive //////////////////////////////////////////////////////////////
hsBool pfGUITextBoxMod::MsgReceive( plMessage *msg )
{
return pfGUIControlMod::MsgReceive( msg );
}
//// IPostSetUpDynTextMap ////////////////////////////////////////////////////
void pfGUITextBoxMod::IPostSetUpDynTextMap( void )
{
pfGUIColorScheme *scheme = GetColorScheme();
fDynTextMap->SetFont( scheme->fFontFace, scheme->fFontSize, scheme->fFontFlags,
HasFlag( kXparentBgnd ) ? false : true );
fDynTextMap->SetTextColor( scheme->fForeColor,
( HasFlag( kXparentBgnd ) && scheme->fBackColor.a == 0.f ) ? true : false );
}
//// IUpdate /////////////////////////////////////////////////////////////////
void pfGUITextBoxMod::IUpdate( void )
{
if( fDynTextMap == nil || !fDynTextMap->IsValid() )
return;
if( HasFlag( kCenterJustify ) )
fDynTextMap->SetJustify( plDynamicTextMap::kCenter );
else if( HasFlag( kRightJustify ) )
fDynTextMap->SetJustify( plDynamicTextMap::kRightJustify );
else
fDynTextMap->SetJustify( plDynamicTextMap::kLeftJustify );
fDynTextMap->ClearToColor( GetColorScheme()->fBackColor );
std::wstring drawStr;
if (fUseLocalizationPath && !fLocalizationPath.empty() && pfLocalizationMgr::InstanceValid())
drawStr = pfLocalizationMgr::Instance().GetString(fLocalizationPath.c_str());
else
{
if( fText != nil )
{
int lang = plLocalization::GetLanguage();
std::vector<std::wstring> translations = plLocalization::StringToLocal(fText);
if (translations[lang] == L"") // if the translations doesn't exist, draw English
drawStr = translations[0].c_str();
else
drawStr = translations[lang].c_str();
}
}
if (!drawStr.empty())
fDynTextMap->DrawWrappedString( 4, 4, drawStr.c_str(), fDynTextMap->GetVisibleWidth() - 8, fDynTextMap->GetVisibleHeight() - 8 );
fDynTextMap->FlushToHost();
}
void pfGUITextBoxMod::PurgeDynaTextMapImage()
{
if ( fDynTextMap != nil )
fDynTextMap->PurgeImage();
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUITextBoxMod::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Read(s, mgr);
UInt32 len = s->ReadSwap32();
if( len > 0 )
{
char *text = TRACKED_NEW char[ len + 1 ];
s->Read( len, text );
text[ len ] = 0;
fText = hsStringToWString(text);
delete [] text;
}
else
fText = nil;
fUseLocalizationPath = (s->ReadBool() != 0);
if (fUseLocalizationPath)
{
wchar_t* temp = s->ReadSafeWString();
fLocalizationPath = temp;
delete [] temp;
}
}
void pfGUITextBoxMod::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Write( s, mgr );
if( fText == nil )
s->WriteSwap32( 0 );
else
{
char *text = hsWStringToString(fText);
s->WriteSwap32( strlen( text ) );
s->Write( strlen( text ), text );
delete [] text;
}
// Make sure we only write out to use localization path if the box is checked
// and the path isn't empty
bool useLoc = fUseLocalizationPath && !fLocalizationPath.empty();
s->WriteBool(useLoc);
if (useLoc)
s->WriteSafeWString(fLocalizationPath.c_str());
}
//// HandleMouseDown/Up //////////////////////////////////////////////////////
void pfGUITextBoxMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
{
}
void pfGUITextBoxMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
{
}
void pfGUITextBoxMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
{
}
//// SetText /////////////////////////////////////////////////////////////////
void pfGUITextBoxMod::SetText( const char *text )
{
delete [] fText;
if (text)
{
fText = hsStringToWString(text);
}
else
fText = nil;
IUpdate();
}
void pfGUITextBoxMod::SetText( const wchar_t *text )
{
delete [] fText;
if (text)
{
fText = TRACKED_NEW wchar_t[wcslen(text)+1];
wcscpy(fText,text);
}
else
fText = nil;
IUpdate();
}
void pfGUITextBoxMod::SetLocalizationPath(const wchar_t* path)
{
if (path)
fLocalizationPath = path;
}
void pfGUITextBoxMod::SetLocalizationPath(const char* path)
{
if (path)
{
wchar_t* wPath = hsStringToWString(path);
fLocalizationPath = wPath;
delete [] wPath;
}
}
void pfGUITextBoxMod::SetUseLocalizationPath(bool use)
{
fUseLocalizationPath = use;
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUITextBoxMod Definition //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "hsStlUtils.h"
#include "pfGUITextBoxMod.h"
#include "pfGameGUIMgr.h"
#include "../pnMessage/plRefMsg.h"
#include "../pfMessage/pfGameGUIMsg.h"
#include "../plMessage/plAnimCmdMsg.h"
#include "../plAvatar/plAGModifier.h"
#include "../plGImage/plDynamicTextMap.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
#include "../plResMgr/plLocalization.h"
#include "../pfLocalizationMgr/pfLocalizationMgr.h"
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUITextBoxMod::pfGUITextBoxMod()
{
// SetFlag( kWantsInterest );
SetFlag( kIntangible );
fText = nil;
fUseLocalizationPath = false;
}
pfGUITextBoxMod::~pfGUITextBoxMod()
{
delete [] fText;
}
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUITextBoxMod::IEval( double secs, hsScalar del, UInt32 dirty )
{
return pfGUIControlMod::IEval( secs, del, dirty );
}
//// MsgReceive //////////////////////////////////////////////////////////////
hsBool pfGUITextBoxMod::MsgReceive( plMessage *msg )
{
return pfGUIControlMod::MsgReceive( msg );
}
//// IPostSetUpDynTextMap ////////////////////////////////////////////////////
void pfGUITextBoxMod::IPostSetUpDynTextMap( void )
{
pfGUIColorScheme *scheme = GetColorScheme();
fDynTextMap->SetFont( scheme->fFontFace, scheme->fFontSize, scheme->fFontFlags,
HasFlag( kXparentBgnd ) ? false : true );
fDynTextMap->SetTextColor( scheme->fForeColor,
( HasFlag( kXparentBgnd ) && scheme->fBackColor.a == 0.f ) ? true : false );
}
//// IUpdate /////////////////////////////////////////////////////////////////
void pfGUITextBoxMod::IUpdate( void )
{
if( fDynTextMap == nil || !fDynTextMap->IsValid() )
return;
if( HasFlag( kCenterJustify ) )
fDynTextMap->SetJustify( plDynamicTextMap::kCenter );
else if( HasFlag( kRightJustify ) )
fDynTextMap->SetJustify( plDynamicTextMap::kRightJustify );
else
fDynTextMap->SetJustify( plDynamicTextMap::kLeftJustify );
fDynTextMap->ClearToColor( GetColorScheme()->fBackColor );
std::wstring drawStr;
if (fUseLocalizationPath && !fLocalizationPath.empty() && pfLocalizationMgr::InstanceValid())
drawStr = pfLocalizationMgr::Instance().GetString(fLocalizationPath.c_str());
else
{
if( fText != nil )
{
int lang = plLocalization::GetLanguage();
std::vector<std::wstring> translations = plLocalization::StringToLocal(fText);
if (translations[lang] == L"") // if the translations doesn't exist, draw English
drawStr = translations[0].c_str();
else
drawStr = translations[lang].c_str();
}
}
if (!drawStr.empty())
fDynTextMap->DrawWrappedString( 4, 4, drawStr.c_str(), fDynTextMap->GetVisibleWidth() - 8, fDynTextMap->GetVisibleHeight() - 8 );
fDynTextMap->FlushToHost();
}
void pfGUITextBoxMod::PurgeDynaTextMapImage()
{
if ( fDynTextMap != nil )
fDynTextMap->PurgeImage();
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUITextBoxMod::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Read(s, mgr);
UInt32 len = s->ReadSwap32();
if( len > 0 )
{
char *text = TRACKED_NEW char[ len + 1 ];
s->Read( len, text );
text[ len ] = 0;
fText = hsStringToWString(text);
delete [] text;
}
else
fText = nil;
fUseLocalizationPath = (s->ReadBool() != 0);
if (fUseLocalizationPath)
{
wchar_t* temp = s->ReadSafeWString();
fLocalizationPath = temp;
delete [] temp;
}
}
void pfGUITextBoxMod::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Write( s, mgr );
if( fText == nil )
s->WriteSwap32( 0 );
else
{
char *text = hsWStringToString(fText);
s->WriteSwap32( strlen( text ) );
s->Write( strlen( text ), text );
delete [] text;
}
// Make sure we only write out to use localization path if the box is checked
// and the path isn't empty
bool useLoc = fUseLocalizationPath && !fLocalizationPath.empty();
s->WriteBool(useLoc);
if (useLoc)
s->WriteSafeWString(fLocalizationPath.c_str());
}
//// HandleMouseDown/Up //////////////////////////////////////////////////////
void pfGUITextBoxMod::HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers )
{
}
void pfGUITextBoxMod::HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers )
{
}
void pfGUITextBoxMod::HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers )
{
}
//// SetText /////////////////////////////////////////////////////////////////
void pfGUITextBoxMod::SetText( const char *text )
{
delete [] fText;
if (text)
{
fText = hsStringToWString(text);
}
else
fText = nil;
IUpdate();
}
void pfGUITextBoxMod::SetText( const wchar_t *text )
{
delete [] fText;
if (text)
{
fText = TRACKED_NEW wchar_t[wcslen(text)+1];
wcscpy(fText,text);
}
else
fText = nil;
IUpdate();
}
void pfGUITextBoxMod::SetLocalizationPath(const wchar_t* path)
{
if (path)
fLocalizationPath = path;
}
void pfGUITextBoxMod::SetLocalizationPath(const char* path)
{
if (path)
{
wchar_t* wPath = hsStringToWString(path);
fLocalizationPath = wPath;
delete [] wPath;
}
}
void pfGUITextBoxMod::SetUseLocalizationPath(bool use)
{
fUseLocalizationPath = use;
}

View File

@ -1,107 +1,107 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUITextBoxMod Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUITextBoxMod_h
#define _pfGUITextBoxMod_h
#include "pfGUIControlMod.h"
class plMessage;
class hsGMaterial;
class plTextGenerator;
class pfGUITextBoxMod : public pfGUIControlMod
{
protected:
wchar_t *fText;
std::wstring fLocalizationPath;
bool fUseLocalizationPath;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual void IUpdate( void );
virtual void IPostSetUpDynTextMap( void );
public:
pfGUITextBoxMod();
virtual ~pfGUITextBoxMod();
CLASSNAME_REGISTER( pfGUITextBoxMod );
GETINTERFACE_ANY( pfGUITextBoxMod, pfGUIControlMod );
enum OurFlags
{
kCenterJustify = kDerivedFlagsStart,
kRightJustify
};
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void PurgeDynaTextMapImage();
virtual const wchar_t* GetText() { return fText; }
// Export only
void SetText( const char *text );
void SetText( const wchar_t *text );
void SetLocalizationPath(const wchar_t* path);
void SetLocalizationPath(const char* path);
void SetUseLocalizationPath(bool use);
};
#endif // _pfGUITextBoxMod_h
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUITextBoxMod Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUITextBoxMod_h
#define _pfGUITextBoxMod_h
#include "pfGUIControlMod.h"
class plMessage;
class hsGMaterial;
class plTextGenerator;
class pfGUITextBoxMod : public pfGUIControlMod
{
protected:
wchar_t *fText;
std::wstring fLocalizationPath;
bool fUseLocalizationPath;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual void IUpdate( void );
virtual void IPostSetUpDynTextMap( void );
public:
pfGUITextBoxMod();
virtual ~pfGUITextBoxMod();
CLASSNAME_REGISTER( pfGUITextBoxMod );
GETINTERFACE_ANY( pfGUITextBoxMod, pfGUIControlMod );
enum OurFlags
{
kCenterJustify = kDerivedFlagsStart,
kRightJustify
};
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void HandleMouseDown( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseUp( hsPoint3 &mousePt, UInt8 modifiers );
virtual void HandleMouseDrag( hsPoint3 &mousePt, UInt8 modifiers );
virtual void PurgeDynaTextMapImage();
virtual const wchar_t* GetText() { return fText; }
// Export only
void SetText( const char *text );
void SetText( const wchar_t *text );
void SetLocalizationPath(const wchar_t* path);
void SetLocalizationPath(const char* path);
void SetUseLocalizationPath(bool use);
};
#endif // _pfGUITextBoxMod_h

View File

@ -1,241 +1,241 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIUpDownPairMod Definition //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIUpDownPairMod.h"
#include "pfGameGUIMgr.h"
#include "pfGUIButtonMod.h"
#include "pfGUIControlHandlers.h"
#include "../pnMessage/plRefMsg.h"
#include "../pfMessage/pfGameGUIMsg.h"
#include "../plMessage/plAnimCmdMsg.h"
#include "../plAvatar/plAGModifier.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Wee Little Control Proc for our buttons /////////////////////////////////
class pfUpDownBtnProc : public pfGUICtrlProcObject
{
protected:
pfGUIButtonMod *fUp, *fDown;
pfGUIUpDownPairMod *fParent;
public:
pfUpDownBtnProc( pfGUIButtonMod *up, pfGUIButtonMod *down, pfGUIUpDownPairMod *parent )
{
fUp = up;
fDown = down;
fParent = parent;
}
void SetUp( pfGUIButtonMod *up ) { fUp = up; }
void SetDown( pfGUIButtonMod *down ) { fDown = down; }
virtual void DoSomething( pfGUIControlMod *ctrl )
{
if( (pfGUIButtonMod *)ctrl == fUp )
{
fParent->fValue += fParent->fStep;
if( fParent->fValue > fParent->fMax )
fParent->fValue = fParent->fMax;
}
else
{
fParent->fValue -= fParent->fStep;
if( fParent->fValue < fParent->fMin )
fParent->fValue = fParent->fMin;
}
fParent->Update();
fParent->DoSomething();
}
};
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIUpDownPairMod::pfGUIUpDownPairMod()
{
fUpControl = nil;
fDownControl = nil;
fValue = fMin = fMax = fStep = 0.f;
fButtonProc = TRACKED_NEW pfUpDownBtnProc( nil, nil, this );
fButtonProc->IncRef();
SetFlag( kIntangible );
}
pfGUIUpDownPairMod::~pfGUIUpDownPairMod()
{
if( fButtonProc->DecRef() )
delete fButtonProc;
}
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIUpDownPairMod::IEval( double secs, hsScalar del, UInt32 dirty )
{
return pfGUIValueCtrl::IEval( secs, del, dirty );
}
void pfGUIUpDownPairMod::IUpdate( void )
{
if (fEnabled)
{
if (fUpControl)
{
if ( fValue >= fMax)
fUpControl->SetVisible(false);
else
fUpControl->SetVisible(true);
}
if (fDownControl)
{
if ( fValue <= fMin )
fDownControl->SetVisible(false);
else
fDownControl->SetVisible(true);
}
}
else
{
fUpControl->SetVisible(false);
fDownControl->SetVisible(false);
}
}
void pfGUIUpDownPairMod::Update( void )
{
IUpdate();
}
//// MsgReceive //////////////////////////////////////////////////////////////
hsBool pfGUIUpDownPairMod::MsgReceive( plMessage *msg )
{
plGenRefMsg *refMsg = plGenRefMsg::ConvertNoRef( msg );
if( refMsg != nil )
{
if( refMsg->fType == kRefUpControl )
{
if( refMsg->GetContext() & ( plRefMsg::kOnCreate | plRefMsg::kOnRequest | plRefMsg::kOnReplace ) )
{
fUpControl = pfGUIButtonMod::ConvertNoRef( refMsg->GetRef() );
fUpControl->SetHandler( fButtonProc );
fButtonProc->SetUp( fUpControl );
}
else
{
fUpControl = nil;
fButtonProc->SetUp( nil );
}
return true;
}
else if( refMsg->fType == kRefDownControl )
{
if( refMsg->GetContext() & ( plRefMsg::kOnCreate | plRefMsg::kOnRequest | plRefMsg::kOnReplace ) )
{
fDownControl = pfGUIButtonMod::ConvertNoRef( refMsg->GetRef() );
fDownControl->SetHandler( fButtonProc );
fButtonProc->SetDown( fDownControl );
}
else
{
fDownControl = nil;
fButtonProc->SetDown( nil );
}
return true;
}
}
return pfGUIValueCtrl::MsgReceive( msg );
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUIUpDownPairMod::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIValueCtrl::Read(s, mgr);
fUpControl = nil;
fDownControl = nil;
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefUpControl ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDownControl ), plRefFlags::kActiveRef );
s->ReadSwap( &fMin );
s->ReadSwap( &fMax );
s->ReadSwap( &fStep );
fValue = fMin;
}
void pfGUIUpDownPairMod::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIValueCtrl::Write( s, mgr );
mgr->WriteKey( s, fUpControl->GetKey() );
mgr->WriteKey( s, fDownControl->GetKey() );
s->WriteSwap( fMin );
s->WriteSwap( fMax );
s->WriteSwap( fStep );
}
void pfGUIUpDownPairMod::SetRange( hsScalar min, hsScalar max )
{
pfGUIValueCtrl::SetRange( min, max );
IUpdate();
}
void pfGUIUpDownPairMod::SetCurrValue( hsScalar v )
{
pfGUIValueCtrl::SetCurrValue( v );
IUpdate();
}
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIUpDownPairMod Definition //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIUpDownPairMod.h"
#include "pfGameGUIMgr.h"
#include "pfGUIButtonMod.h"
#include "pfGUIControlHandlers.h"
#include "../pnMessage/plRefMsg.h"
#include "../pfMessage/pfGameGUIMsg.h"
#include "../plMessage/plAnimCmdMsg.h"
#include "../plAvatar/plAGModifier.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Wee Little Control Proc for our buttons /////////////////////////////////
class pfUpDownBtnProc : public pfGUICtrlProcObject
{
protected:
pfGUIButtonMod *fUp, *fDown;
pfGUIUpDownPairMod *fParent;
public:
pfUpDownBtnProc( pfGUIButtonMod *up, pfGUIButtonMod *down, pfGUIUpDownPairMod *parent )
{
fUp = up;
fDown = down;
fParent = parent;
}
void SetUp( pfGUIButtonMod *up ) { fUp = up; }
void SetDown( pfGUIButtonMod *down ) { fDown = down; }
virtual void DoSomething( pfGUIControlMod *ctrl )
{
if( (pfGUIButtonMod *)ctrl == fUp )
{
fParent->fValue += fParent->fStep;
if( fParent->fValue > fParent->fMax )
fParent->fValue = fParent->fMax;
}
else
{
fParent->fValue -= fParent->fStep;
if( fParent->fValue < fParent->fMin )
fParent->fValue = fParent->fMin;
}
fParent->Update();
fParent->DoSomething();
}
};
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIUpDownPairMod::pfGUIUpDownPairMod()
{
fUpControl = nil;
fDownControl = nil;
fValue = fMin = fMax = fStep = 0.f;
fButtonProc = TRACKED_NEW pfUpDownBtnProc( nil, nil, this );
fButtonProc->IncRef();
SetFlag( kIntangible );
}
pfGUIUpDownPairMod::~pfGUIUpDownPairMod()
{
if( fButtonProc->DecRef() )
delete fButtonProc;
}
//// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIUpDownPairMod::IEval( double secs, hsScalar del, UInt32 dirty )
{
return pfGUIValueCtrl::IEval( secs, del, dirty );
}
void pfGUIUpDownPairMod::IUpdate( void )
{
if (fEnabled)
{
if (fUpControl)
{
if ( fValue >= fMax)
fUpControl->SetVisible(false);
else
fUpControl->SetVisible(true);
}
if (fDownControl)
{
if ( fValue <= fMin )
fDownControl->SetVisible(false);
else
fDownControl->SetVisible(true);
}
}
else
{
fUpControl->SetVisible(false);
fDownControl->SetVisible(false);
}
}
void pfGUIUpDownPairMod::Update( void )
{
IUpdate();
}
//// MsgReceive //////////////////////////////////////////////////////////////
hsBool pfGUIUpDownPairMod::MsgReceive( plMessage *msg )
{
plGenRefMsg *refMsg = plGenRefMsg::ConvertNoRef( msg );
if( refMsg != nil )
{
if( refMsg->fType == kRefUpControl )
{
if( refMsg->GetContext() & ( plRefMsg::kOnCreate | plRefMsg::kOnRequest | plRefMsg::kOnReplace ) )
{
fUpControl = pfGUIButtonMod::ConvertNoRef( refMsg->GetRef() );
fUpControl->SetHandler( fButtonProc );
fButtonProc->SetUp( fUpControl );
}
else
{
fUpControl = nil;
fButtonProc->SetUp( nil );
}
return true;
}
else if( refMsg->fType == kRefDownControl )
{
if( refMsg->GetContext() & ( plRefMsg::kOnCreate | plRefMsg::kOnRequest | plRefMsg::kOnReplace ) )
{
fDownControl = pfGUIButtonMod::ConvertNoRef( refMsg->GetRef() );
fDownControl->SetHandler( fButtonProc );
fButtonProc->SetDown( fDownControl );
}
else
{
fDownControl = nil;
fButtonProc->SetDown( nil );
}
return true;
}
}
return pfGUIValueCtrl::MsgReceive( msg );
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUIUpDownPairMod::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIValueCtrl::Read(s, mgr);
fUpControl = nil;
fDownControl = nil;
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefUpControl ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDownControl ), plRefFlags::kActiveRef );
s->ReadSwap( &fMin );
s->ReadSwap( &fMax );
s->ReadSwap( &fStep );
fValue = fMin;
}
void pfGUIUpDownPairMod::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIValueCtrl::Write( s, mgr );
mgr->WriteKey( s, fUpControl->GetKey() );
mgr->WriteKey( s, fDownControl->GetKey() );
s->WriteSwap( fMin );
s->WriteSwap( fMax );
s->WriteSwap( fStep );
}
void pfGUIUpDownPairMod::SetRange( hsScalar min, hsScalar max )
{
pfGUIValueCtrl::SetRange( min, max );
IUpdate();
}
void pfGUIUpDownPairMod::SetCurrValue( hsScalar v )
{
pfGUIValueCtrl::SetCurrValue( v );
IUpdate();
}

View File

@ -1,100 +1,100 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIUpDownPairMod Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIUpDownPairMod_h
#define _pfGUIUpDownPairMod_h
#include "pfGUIValueCtrl.h"
class plMessage;
class pfGUIButtonMod;
class pfUpDownBtnProc;
class pfGUIUpDownPairMod : public pfGUIValueCtrl
{
friend class pfUpDownBtnProc;
protected:
enum
{
kRefUpControl = kRefDerivedStart,
kRefDownControl
};
pfGUIButtonMod *fUpControl, *fDownControl;
pfUpDownBtnProc *fButtonProc;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual void IUpdate( void );
public:
pfGUIUpDownPairMod();
virtual ~pfGUIUpDownPairMod();
CLASSNAME_REGISTER( pfGUIUpDownPairMod );
GETINTERFACE_ANY( pfGUIUpDownPairMod, pfGUIValueCtrl );
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Update( void );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void SetRange( hsScalar min, hsScalar max );
virtual void SetCurrValue( hsScalar v );
/// Export ONLY
void SetControls( pfGUIButtonMod *up, pfGUIButtonMod *down ) { fUpControl = up; fDownControl = down; }
};
#endif // _pfGUIUpDownPairMod_h
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIUpDownPairMod Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIUpDownPairMod_h
#define _pfGUIUpDownPairMod_h
#include "pfGUIValueCtrl.h"
class plMessage;
class pfGUIButtonMod;
class pfUpDownBtnProc;
class pfGUIUpDownPairMod : public pfGUIValueCtrl
{
friend class pfUpDownBtnProc;
protected:
enum
{
kRefUpControl = kRefDerivedStart,
kRefDownControl
};
pfGUIButtonMod *fUpControl, *fDownControl;
pfUpDownBtnProc *fButtonProc;
virtual hsBool IEval( double secs, hsScalar del, UInt32 dirty ); // called only by owner object's Eval()
virtual void IUpdate( void );
public:
pfGUIUpDownPairMod();
virtual ~pfGUIUpDownPairMod();
CLASSNAME_REGISTER( pfGUIUpDownPairMod );
GETINTERFACE_ANY( pfGUIUpDownPairMod, pfGUIValueCtrl );
virtual hsBool MsgReceive( plMessage* pMsg );
virtual void Update( void );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual void SetRange( hsScalar min, hsScalar max );
virtual void SetCurrValue( hsScalar v );
/// Export ONLY
void SetControls( pfGUIButtonMod *up, pfGUIButtonMod *down ) { fUpControl = up; fDownControl = down; }
};
#endif // _pfGUIUpDownPairMod_h

View File

@ -1,111 +1,111 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIValueCtrl Definition //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIValueCtrl.h"
#include "pfGameGUIMgr.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIValueCtrl::pfGUIValueCtrl()
{
fValue = fMin = fMax = fStep = 0.f;
}
pfGUIValueCtrl::~pfGUIValueCtrl()
{
}
//// SetCurrValue ////////////////////////////////////////////////////////////
void pfGUIValueCtrl::SetCurrValue( hsScalar v )
{
fValue = v;
if( fValue < fMin )
fValue = fMin;
else if( fValue > fMax )
fValue = fMax;
}
//// SetRange ////////////////////////////////////////////////////////////////
void pfGUIValueCtrl::SetRange( hsScalar min, hsScalar max )
{
fMin = min;
fMax = max;
if( fValue < fMin )
SetCurrValue( fMin );
else if( fValue > fMax )
SetCurrValue( fMax );
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUIValueCtrl::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Read(s, mgr);
s->ReadSwap( &fMin );
s->ReadSwap( &fMax );
s->ReadSwap( &fStep );
fValue = fMin;
}
void pfGUIValueCtrl::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Write( s, mgr );
s->WriteSwap( fMin );
s->WriteSwap( fMax );
s->WriteSwap( fStep );
}
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIValueCtrl Definition //
// //
//////////////////////////////////////////////////////////////////////////////
#include "hsTypes.h"
#include "pfGUIValueCtrl.h"
#include "pfGameGUIMgr.h"
#include "plgDispatch.h"
#include "hsResMgr.h"
//// Constructor/Destructor //////////////////////////////////////////////////
pfGUIValueCtrl::pfGUIValueCtrl()
{
fValue = fMin = fMax = fStep = 0.f;
}
pfGUIValueCtrl::~pfGUIValueCtrl()
{
}
//// SetCurrValue ////////////////////////////////////////////////////////////
void pfGUIValueCtrl::SetCurrValue( hsScalar v )
{
fValue = v;
if( fValue < fMin )
fValue = fMin;
else if( fValue > fMax )
fValue = fMax;
}
//// SetRange ////////////////////////////////////////////////////////////////
void pfGUIValueCtrl::SetRange( hsScalar min, hsScalar max )
{
fMin = min;
fMax = max;
if( fValue < fMin )
SetCurrValue( fMin );
else if( fValue > fMax )
SetCurrValue( fMax );
}
//// Read/Write //////////////////////////////////////////////////////////////
void pfGUIValueCtrl::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Read(s, mgr);
s->ReadSwap( &fMin );
s->ReadSwap( &fMax );
s->ReadSwap( &fStep );
fValue = fMin;
}
void pfGUIValueCtrl::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Write( s, mgr );
s->WriteSwap( fMin );
s->WriteSwap( fMax );
s->WriteSwap( fStep );
}

View File

@ -1,84 +1,84 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIValueCtrl Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIValueCtrl_h
#define _pfGUIValueCtrl_h
#include "pfGUIControlMod.h"
class pfGUIValueCtrl : public pfGUIControlMod
{
protected:
hsScalar fValue, fMin, fMax, fStep;
public:
pfGUIValueCtrl();
virtual ~pfGUIValueCtrl();
CLASSNAME_REGISTER( pfGUIValueCtrl );
GETINTERFACE_ANY( pfGUIValueCtrl, pfGUIControlMod );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual hsScalar GetCurrValue( void ) { return fValue; }
virtual void SetCurrValue( hsScalar v );
virtual hsScalar GetMin( void ) { return fMin; }
virtual hsScalar GetMax( void ) { return fMax; }
virtual hsScalar GetStep( void ) { return fStep; }
virtual void SetRange( hsScalar min, hsScalar max );
virtual void SetStep( hsScalar step ) { fStep = step; }
};
#endif // _pfGUIValueCtrl_h
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGUIValueCtrl Header //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGUIValueCtrl_h
#define _pfGUIValueCtrl_h
#include "pfGUIControlMod.h"
class pfGUIValueCtrl : public pfGUIControlMod
{
protected:
hsScalar fValue, fMin, fMax, fStep;
public:
pfGUIValueCtrl();
virtual ~pfGUIValueCtrl();
CLASSNAME_REGISTER( pfGUIValueCtrl );
GETINTERFACE_ANY( pfGUIValueCtrl, pfGUIControlMod );
virtual void Read( hsStream* s, hsResMgr* mgr );
virtual void Write( hsStream* s, hsResMgr* mgr );
virtual hsScalar GetCurrValue( void ) { return fValue; }
virtual void SetCurrValue( hsScalar v );
virtual hsScalar GetMin( void ) { return fMin; }
virtual hsScalar GetMax( void ) { return fMax; }
virtual hsScalar GetStep( void ) { return fStep; }
virtual void SetRange( hsScalar min, hsScalar max );
virtual void SetStep( hsScalar step ) { fStep = step; }
};
#endif // _pfGUIValueCtrl_h

File diff suppressed because it is too large Load Diff

View File

@ -1,237 +1,237 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGameGUIMgr Header //
// A.K.A. "Ooh, we get a GUI!" //
// //
//// Description /////////////////////////////////////////////////////////////
// //
// The in-game GUI manager. Handles reading, creation, and input for //
// dialog boxes at runtime. //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGameGUIMgr_h
#define _pfGameGUIMgr_h
#include "hsTypes.h"
#include "hsTemplates.h"
#include "../pnInputCore/plKeyDef.h"
#include "../pnKeyedObject/hsKeyedObject.h"
#include <vector>
class plPipeline;
class plMessage;
class pfGUIDialogMod;
class pfGUIControlMod;
class pfGameUIInputInterface;
class plPostEffectMod;
//// Tag Definitions /////////////////////////////////////////////////////////
// Each dialog/control gets an optional tag ID number. This is the link
// between MAX and C++. You attach a Tag component to a control or dialog
// in MAX and assign it an ID (supplied by a list of konstants that are
// hard-coded). Then, in code, you ask the gameGUIMgr for the dialog (or
// control) with that ID, and pop, you get it back. Then you run with it.
//
// Easy, huh?
class pfGUITag
{
public:
UInt32 fID;
char fName[ 128 ];
};
//
// This class just holds a name and the key to set the receiver to
// after the dialog gets loaded.
class pfDialogNameSetKey
{
private:
char *fName;
plKey fKey;
public:
pfDialogNameSetKey(const char *name, plKey key) { fName = hsStrcpy(name); fKey=key; }
~pfDialogNameSetKey() { delete [] fName; }
const char *GetName() { return fName; }
plKey GetKey() { return fKey; }
};
//// Manager Class Definition ////////////////////////////////////////////////
class pfGUIPopUpMenu;
class pfGameGUIMgr : public hsKeyedObject
{
friend class pfGameUIInputInterface;
public:
enum EventType
{
kMouseDown,
kMouseUp,
kMouseMove,
kMouseDrag,
kKeyDown,
kKeyUp,
kKeyRepeat,
kMouseDblClick
};
enum
{
kNoModifiers = 0,
kShiftDown = 0x01,
kCtrlDown = 0x02,
kCapsDown = 0x04
};
private:
static pfGameGUIMgr *fInstance;
protected:
hsTArray<pfGUIDialogMod *> fDialogs;
pfGUIDialogMod *fActiveDialogs;
// These two lists help us manage when dialogs get told to load or unload versus when they actually *do*
hsTArray<pfDialogNameSetKey *> fDlgsPendingLoad;
hsTArray<pfDialogNameSetKey *> fDlgsPendingUnload;
hsBool fActivated;
UInt32 fActiveDlgCount;
pfGameUIInputInterface *fInputConfig;
UInt32 fInputCtlIndex;
UInt32 fDefaultCursor;
hsScalar fCursorOpacity;
hsScalar fAspectRatio;
// This is an array of the dialogs (by name) that need their
// receiver key set once they are loaded.
// This array shouldn't get more than one entry... but
// it could be more....
// LoadDialog adds an entry and MsgReceive removes it
hsTArray<pfDialogNameSetKey *> fDialogToSetKeyOf;
void ILoadDialog( const char *name );
void IShowDialog( const char *name );
void IHideDialog( const char *name );
void IAddDlgToList( hsKeyedObject *obj );
void IRemoveDlgFromList( hsKeyedObject *obj );
void IActivateGUI( hsBool activate );
hsBool IHandleMouse( EventType event, hsScalar mouseX, hsScalar mouseY, UInt8 modifiers, UInt32 *desiredCursor );
hsBool IHandleKeyEvt( EventType event, plKeyDef key, UInt8 modifiers );
hsBool IHandleKeyPress( char key, UInt8 modifiers );
hsBool IModalBlocking( void );
pfGUIDialogMod *IGetTopModal( void ) const;
public:
enum
{
kDlgModRef = 0
};
pfGameGUIMgr();
~pfGameGUIMgr();
CLASSNAME_REGISTER( pfGameGUIMgr );
GETINTERFACE_ANY( pfGameGUIMgr, hsKeyedObject );
void Draw( plPipeline *p );
hsBool Init( void );
virtual hsBool MsgReceive( plMessage* pMsg );
void LoadDialog( const char *name, plKey recvrKey=nil, const char *ageName = nil ); // AgeName = nil defaults to "GUI"
void ShowDialog( const char *name ) { IShowDialog(name); }
void HideDialog( const char *name ) { IHideDialog(name); }
void UnloadDialog( const char *name );
void UnloadDialog( pfGUIDialogMod *dlg );
void ShowDialog( pfGUIDialogMod *dlg, bool resetClickables=true );
void HideDialog( pfGUIDialogMod *dlg );
hsBool IsDialogLoaded( const char *name );
pfGUIDialogMod *GetDialogFromString( const char *name );
void SetDialogToNotify(const char *name, plKey recvrKey);
void SetDialogToNotify(pfGUIDialogMod *dlg, plKey recvrKey);
void SetDefaultCursor(UInt32 defaultCursor) { fDefaultCursor = defaultCursor; }
UInt32 GetDefaultCursor() { return fDefaultCursor; }
void SetCursorOpacity(hsScalar opacity) { fCursorOpacity = opacity; }
hsScalar GetCursorOpacity() { return fCursorOpacity; }
pfGUIPopUpMenu *FindPopUpMenu( const char *name );
std::vector<plPostEffectMod*> GetDlgRenderMods( void ) const;
hsBool IsModalBlocking( void ) {return IModalBlocking();}
// Tag ID stuff
pfGUIDialogMod *GetDialogFromTag( UInt32 tagID );
pfGUIControlMod *GetControlFromTag( pfGUIDialogMod *dlg, UInt32 tagID );
static UInt32 GetNumTags( void );
static pfGUITag *GetTag( UInt32 tagIndex );
static UInt32 GetHighestTag( void );
void SetAspectRatio(hsScalar aspectratio);
hsScalar GetAspectRatio() { return fAspectRatio; }
static pfGameGUIMgr *GetInstance( void ) { return fInstance; }
};
#endif //_pfGameGUIMgr_h
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// pfGameGUIMgr Header //
// A.K.A. "Ooh, we get a GUI!" //
// //
//// Description /////////////////////////////////////////////////////////////
// //
// The in-game GUI manager. Handles reading, creation, and input for //
// dialog boxes at runtime. //
// //
//////////////////////////////////////////////////////////////////////////////
#ifndef _pfGameGUIMgr_h
#define _pfGameGUIMgr_h
#include "hsTypes.h"
#include "hsTemplates.h"
#include "../pnInputCore/plKeyDef.h"
#include "../pnKeyedObject/hsKeyedObject.h"
#include <vector>
class plPipeline;
class plMessage;
class pfGUIDialogMod;
class pfGUIControlMod;
class pfGameUIInputInterface;
class plPostEffectMod;
//// Tag Definitions /////////////////////////////////////////////////////////
// Each dialog/control gets an optional tag ID number. This is the link
// between MAX and C++. You attach a Tag component to a control or dialog
// in MAX and assign it an ID (supplied by a list of konstants that are
// hard-coded). Then, in code, you ask the gameGUIMgr for the dialog (or
// control) with that ID, and pop, you get it back. Then you run with it.
//
// Easy, huh?
class pfGUITag
{
public:
UInt32 fID;
char fName[ 128 ];
};
//
// This class just holds a name and the key to set the receiver to
// after the dialog gets loaded.
class pfDialogNameSetKey
{
private:
char *fName;
plKey fKey;
public:
pfDialogNameSetKey(const char *name, plKey key) { fName = hsStrcpy(name); fKey=key; }
~pfDialogNameSetKey() { delete [] fName; }
const char *GetName() { return fName; }
plKey GetKey() { return fKey; }
};
//// Manager Class Definition ////////////////////////////////////////////////
class pfGUIPopUpMenu;
class pfGameGUIMgr : public hsKeyedObject
{
friend class pfGameUIInputInterface;
public:
enum EventType
{
kMouseDown,
kMouseUp,
kMouseMove,
kMouseDrag,
kKeyDown,
kKeyUp,
kKeyRepeat,
kMouseDblClick
};
enum
{
kNoModifiers = 0,
kShiftDown = 0x01,
kCtrlDown = 0x02,
kCapsDown = 0x04
};
private:
static pfGameGUIMgr *fInstance;
protected:
hsTArray<pfGUIDialogMod *> fDialogs;
pfGUIDialogMod *fActiveDialogs;
// These two lists help us manage when dialogs get told to load or unload versus when they actually *do*
hsTArray<pfDialogNameSetKey *> fDlgsPendingLoad;
hsTArray<pfDialogNameSetKey *> fDlgsPendingUnload;
hsBool fActivated;
UInt32 fActiveDlgCount;
pfGameUIInputInterface *fInputConfig;
UInt32 fInputCtlIndex;
UInt32 fDefaultCursor;
hsScalar fCursorOpacity;
hsScalar fAspectRatio;
// This is an array of the dialogs (by name) that need their
// receiver key set once they are loaded.
// This array shouldn't get more than one entry... but
// it could be more....
// LoadDialog adds an entry and MsgReceive removes it
hsTArray<pfDialogNameSetKey *> fDialogToSetKeyOf;
void ILoadDialog( const char *name );
void IShowDialog( const char *name );
void IHideDialog( const char *name );
void IAddDlgToList( hsKeyedObject *obj );
void IRemoveDlgFromList( hsKeyedObject *obj );
void IActivateGUI( hsBool activate );
hsBool IHandleMouse( EventType event, hsScalar mouseX, hsScalar mouseY, UInt8 modifiers, UInt32 *desiredCursor );
hsBool IHandleKeyEvt( EventType event, plKeyDef key, UInt8 modifiers );
hsBool IHandleKeyPress( char key, UInt8 modifiers );
hsBool IModalBlocking( void );
pfGUIDialogMod *IGetTopModal( void ) const;
public:
enum
{
kDlgModRef = 0
};
pfGameGUIMgr();
~pfGameGUIMgr();
CLASSNAME_REGISTER( pfGameGUIMgr );
GETINTERFACE_ANY( pfGameGUIMgr, hsKeyedObject );
void Draw( plPipeline *p );
hsBool Init( void );
virtual hsBool MsgReceive( plMessage* pMsg );
void LoadDialog( const char *name, plKey recvrKey=nil, const char *ageName = nil ); // AgeName = nil defaults to "GUI"
void ShowDialog( const char *name ) { IShowDialog(name); }
void HideDialog( const char *name ) { IHideDialog(name); }
void UnloadDialog( const char *name );
void UnloadDialog( pfGUIDialogMod *dlg );
void ShowDialog( pfGUIDialogMod *dlg, bool resetClickables=true );
void HideDialog( pfGUIDialogMod *dlg );
hsBool IsDialogLoaded( const char *name );
pfGUIDialogMod *GetDialogFromString( const char *name );
void SetDialogToNotify(const char *name, plKey recvrKey);
void SetDialogToNotify(pfGUIDialogMod *dlg, plKey recvrKey);
void SetDefaultCursor(UInt32 defaultCursor) { fDefaultCursor = defaultCursor; }
UInt32 GetDefaultCursor() { return fDefaultCursor; }
void SetCursorOpacity(hsScalar opacity) { fCursorOpacity = opacity; }
hsScalar GetCursorOpacity() { return fCursorOpacity; }
pfGUIPopUpMenu *FindPopUpMenu( const char *name );
std::vector<plPostEffectMod*> GetDlgRenderMods( void ) const;
hsBool IsModalBlocking( void ) {return IModalBlocking();}
// Tag ID stuff
pfGUIDialogMod *GetDialogFromTag( UInt32 tagID );
pfGUIControlMod *GetControlFromTag( pfGUIDialogMod *dlg, UInt32 tagID );
static UInt32 GetNumTags( void );
static pfGUITag *GetTag( UInt32 tagIndex );
static UInt32 GetHighestTag( void );
void SetAspectRatio(hsScalar aspectratio);
hsScalar GetAspectRatio() { return fAspectRatio; }
static pfGameGUIMgr *GetInstance( void ) { return fInstance; }
};
#endif //_pfGameGUIMgr_h

View File

@ -1,93 +1,93 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#ifndef _pfGameGUIMgrCreatable_inc
#define _pfGameGUIMgrCreatable_inc
#include "../pnFactory/plCreator.h"
#include "pfGameGUIMgr.h"
REGISTER_CREATABLE( pfGameGUIMgr );
#include "pfGUIDialogMod.h"
#include "pfGUIControlMod.h"
#include "pfGUIButtonMod.h"
#include "pfGUIDraggableMod.h"
#include "pfGUIListBoxMod.h"
#include "pfGUITextBoxMod.h"
#include "pfGUIEditBoxMod.h"
#include "pfGUIUpDownPairMod.h"
#include "pfGUIValueCtrl.h"
#include "pfGUIKnobCtrl.h"
#include "pfGUIDragBarCtrl.h"
#include "pfGUICheckBoxCtrl.h"
#include "pfGUIRadioGroupCtrl.h"
#include "pfGUIDynDisplayCtrl.h"
#include "pfGUIMultiLineEditCtrl.h"
#include "pfGUIProgressCtrl.h"
#include "pfGUIClickMapCtrl.h"
#include "pfGUIPopUpMenu.h"
#include "pfGUIMenuItem.h"
REGISTER_CREATABLE( pfGUIDialogMod );
REGISTER_NONCREATABLE( pfGUIControlMod );
REGISTER_CREATABLE( pfGUIButtonMod );
REGISTER_CREATABLE( pfGUIDraggableMod );
REGISTER_CREATABLE( pfGUIListBoxMod );
REGISTER_CREATABLE( pfGUITextBoxMod );
REGISTER_CREATABLE( pfGUIEditBoxMod );
REGISTER_NONCREATABLE( pfGUIValueCtrl );
REGISTER_CREATABLE( pfGUIUpDownPairMod );
REGISTER_CREATABLE( pfGUIKnobCtrl );
REGISTER_CREATABLE( pfGUIDragBarCtrl );
REGISTER_CREATABLE( pfGUICheckBoxCtrl );
REGISTER_CREATABLE( pfGUIRadioGroupCtrl );
REGISTER_CREATABLE( pfGUIDynDisplayCtrl );
REGISTER_CREATABLE( pfGUIMultiLineEditCtrl );
REGISTER_CREATABLE( pfGUIProgressCtrl );
REGISTER_CREATABLE( pfGUIClickMapCtrl );
REGISTER_CREATABLE( pfGUIPopUpMenu );
REGISTER_CREATABLE( pfGUIMenuItem );
REGISTER_CREATABLE( pfGUISkin );
#endif // _pfGameGUIMgrCreatable_inc
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
#ifndef _pfGameGUIMgrCreatable_inc
#define _pfGameGUIMgrCreatable_inc
#include "../pnFactory/plCreator.h"
#include "pfGameGUIMgr.h"
REGISTER_CREATABLE( pfGameGUIMgr );
#include "pfGUIDialogMod.h"
#include "pfGUIControlMod.h"
#include "pfGUIButtonMod.h"
#include "pfGUIDraggableMod.h"
#include "pfGUIListBoxMod.h"
#include "pfGUITextBoxMod.h"
#include "pfGUIEditBoxMod.h"
#include "pfGUIUpDownPairMod.h"
#include "pfGUIValueCtrl.h"
#include "pfGUIKnobCtrl.h"
#include "pfGUIDragBarCtrl.h"
#include "pfGUICheckBoxCtrl.h"
#include "pfGUIRadioGroupCtrl.h"
#include "pfGUIDynDisplayCtrl.h"
#include "pfGUIMultiLineEditCtrl.h"
#include "pfGUIProgressCtrl.h"
#include "pfGUIClickMapCtrl.h"
#include "pfGUIPopUpMenu.h"
#include "pfGUIMenuItem.h"
REGISTER_CREATABLE( pfGUIDialogMod );
REGISTER_NONCREATABLE( pfGUIControlMod );
REGISTER_CREATABLE( pfGUIButtonMod );
REGISTER_CREATABLE( pfGUIDraggableMod );
REGISTER_CREATABLE( pfGUIListBoxMod );
REGISTER_CREATABLE( pfGUITextBoxMod );
REGISTER_CREATABLE( pfGUIEditBoxMod );
REGISTER_NONCREATABLE( pfGUIValueCtrl );
REGISTER_CREATABLE( pfGUIUpDownPairMod );
REGISTER_CREATABLE( pfGUIKnobCtrl );
REGISTER_CREATABLE( pfGUIDragBarCtrl );
REGISTER_CREATABLE( pfGUICheckBoxCtrl );
REGISTER_CREATABLE( pfGUIRadioGroupCtrl );
REGISTER_CREATABLE( pfGUIDynDisplayCtrl );
REGISTER_CREATABLE( pfGUIMultiLineEditCtrl );
REGISTER_CREATABLE( pfGUIProgressCtrl );
REGISTER_CREATABLE( pfGUIClickMapCtrl );
REGISTER_CREATABLE( pfGUIPopUpMenu );
REGISTER_CREATABLE( pfGUIMenuItem );
REGISTER_CREATABLE( pfGUISkin );
#endif // _pfGameGUIMgrCreatable_inc