home *** CD-ROM | disk | FTP | other *** search
- /*---------------------------------------------------------------
-
- CPluginTable.cpp
-
- A table listing plugins
-
- ---------------------------------------------------------------*/
-
- #include "CPluginTable.h"
- #include <LTableMultiGeometry.h>
- #include <LTableSingleSelector.h>
- #include <LTableArrayStorage.h>
- #include "UGAColorRamp.h"
- #include <UDrawingState.h>
- #include <UTextTraits.h>
- #include "CPluginManager.h"
-
- extern CPluginManager* gPluginManager;
-
-
- CPluginTable::CPluginTable(LStream *inStream)
- :LTableView( inStream )
- {
- mTableGeometry = new LTableMultiGeometry(this, mFrameSize.width, 16);
- mTableSelector = new LTableSingleSelector(this);
- mTableStorage = new LTableArrayStorage(this, (unsigned long)0);
-
- InsertCols( 1, 0, NULL );
-
- short count = gPluginManager->GetPluginCount();
- InsertRows( count, 0, NULL );
-
- STableCell firstCell( 1, 1 );
- SelectCell( firstCell);
- gPluginManager->SetCurrentPluginIndex(1);
- }
-
- // ---------------------------------------------------------------------------
- // ClickCell
- // ---------------------------------------------------------------------------
- // Description
-
- void
- CPluginTable::ClickCell( const STableCell &inCell,
- const SMouseDownEvent &inMouseDown)
- {
- switch ( inCell.col )
- {
- case 1:
- {
- gPluginManager->SetCurrentPluginIndex( inCell.row );
- } break;
- };
- }
-
- // ---------------------------------------------------------------------------
- // DrawCell
- // ---------------------------------------------------------------------------
- // Description
-
- void
- CPluginTable::DrawCell( const STableCell &inCell,
- const Rect &inLocalRect)
- {
- StTextState theState;
- StColorState theColorState;
-
- UTextTraits::SetPortTextTraits( 130 );
-
- switch ( inCell.col )
- {
- case 1:
- {
- char name[256];
- gPluginManager->GetPluginDescriptorbyIndex( inCell.row, name );
-
-
- c2pstr( name );
- ::MoveTo( inLocalRect.left + 2, inLocalRect.bottom - 2 );
- ::DrawString( (StringPtr)name );
- } break;
- };
-
- ::RGBForeColor( &UGAColorRamp::GetColor(colorRamp_Gray3) );
-
- ::MoveTo( inLocalRect.left, inLocalRect.top);
- ::LineTo( inLocalRect.left, inLocalRect.bottom);
-
- ::RGBForeColor( &UGAColorRamp::GetColor(colorRamp_White) );
-
- ::MoveTo( inLocalRect.left, inLocalRect.bottom);
- ::LineTo( inLocalRect.right, inLocalRect.bottom);
-
- }
-