Beispiel #1
0
FilteredStringBuilder::FilteredStringBuilder(StringBuilder *pBuilder, StringFilter *pFilter)
{
	mpBuilder = 0;
	mpFilter = 0;
	mpTempBuffer = 0;
	
	SetBuilder(pBuilder);
	SetFilter(pFilter);
}	
/// Default constructor for a TBarDescr object. No menu resources or groups are
/// specified. Constructs an empty control bar. For internal use only.
TBarDescr::TBarDescr()
:
  BarRes(0),
  CelArray(0),
  Id(0),
  Module(0)
{
  GadgetFunctor = new TGadgetFunctor;
  SetBuilder(TGadget_FUNCTOR(CreateGadget));
  Gadgets = new TBarDescrGdArray(5);
  for (int i = 0; i < NumGroups; i++)
    GroupCount[i] = 0;

}
//-----------------------------------------------------------------------------
// Purpose: Get and set the current driver.
//-----------------------------------------------------------------------------
void CBaseTFVehicle::SetPassenger( int nRole, CBasePlayer *pEnt )
{
	Assert( !pEnt || pEnt->IsPlayer() );
	Assert( nRole >= 0 && nRole < m_nMaxPassengers );
	Assert( !m_hPassengers[nRole].Get() || !pEnt );
	m_hPassengers.Set( nRole, dynamic_cast<CBaseTFPlayer*>(pEnt) );

	// If the vehicle's deteriorating, I get to own it now
	if ( IsDeteriorating() )
	{
		StopDeteriorating();
		SetBuilder( (CBaseTFPlayer*)pEnt, true );
	}

	ResetDeteriorationTime();
}
// -----------------------------------------------------------------------------
/// Creates a control bar descriptor from the controlbar resource specified in the
/// id parameter. Calls the function ExtractGroups to extract the group counts based
/// on the separator items in the control bar.
TBarDescr::TBarDescr(TResId barResId, TModule* module)
:
  Id(barResId),
  Module(module),
  BarRes(0),
  CelArray(0)
{
  GadgetFunctor = new TGadgetFunctor;
  SetBuilder(TGadget_FUNCTOR(CreateGadget));

  Gadgets = new TBarDescrGdArray(5);

  SetBitmap(barResId, module);

  ExtractGroups();
}
// -----------------------------------------------------------------------------
/// Constructs a control bar descriptor from the resource indicated by id. Places
/// the gadgets in groups according the values of the fg, eg, cg, of, wg, and hg
/// parameters. The fg, eg, cg, of, wg, and hg parameters represent the functional
/// groups identified by the TGroup enum. Calls the function ExtractGroups to
/// extract the group counts based on the separator items in the menu bar.
TBarDescr::TBarDescr(TResId id, int fg, int eg, int cg, int og, int wg, 
                     int hg, TModule* module)
:
  Id(id),
  Module(module),
  BarRes(0),
  CelArray(0)
{
  GadgetFunctor = new TGadgetFunctor;
  SetBuilder(TGadget_FUNCTOR(CreateGadget));

  Gadgets = new TBarDescrGdArray(5);
  
  SetBitmap(id, module);
  
  if (!ExtractGroups()) {
    GroupCount[FileGroup]       = fg;
    GroupCount[EditGroup]       = eg;
    GroupCount[ContainerGroup]   = cg;
    GroupCount[ObjectGroup]     = og;
    GroupCount[WindowGroup]     = wg;
    GroupCount[HelpGroup]       = hg;
  }
}
// -----------------------------------------------------------------------------
/// Not implemented. Forbidden and protected contructor.
TBarDescr::TBarDescr(const TBarDescr& bar)
:
  Id(bar.Id),
  Module(bar.Module)
{
  GadgetFunctor = new TGadgetFunctor;
  SetBuilder(TGadget_FUNCTOR(CreateGadget));

  Gadgets = new TBarDescrGdArray(5);
  BarRes = new TToolbarRes(*bar.BarRes);

  CHECK(BarRes->IsOK());
  { // map colors
    TBtnBitmap bitmap(BarRes->GetBitmap(), 
                      TBtnBitmap::DefaultFaceColor, 
                      NoAutoDelete);
  }
  CelArray = new TCelArray(&BarRes->GetBitmap(),
                           BarRes->GetCount(),
                           TSize(BarRes->GetWidth(), BarRes->GetHeight()), 
                           TPoint(0, 0), // offset
                           BarRes->GetBitmap().Height()/BarRes->GetHeight());
  ExtractGroups();
}
Beispiel #7
0
FilteredStringBuilder::~FilteredStringBuilder()
{
	SetBuilder(0);
}