Beispiel #1
0
void CGUIResizeControl::Resize(float x, float y)
{
  float width = m_width + x;
  float height = m_height + y;
  // check if we are within the bounds
  if (width < m_x1) width = m_x1;
  if (height < m_y1) height = m_y1;
  if (width > m_x2) width = m_x2;
  if (height > m_y2) height = m_y2;
  // ok, now set the default size of the resize control
  SetWidth(width);
  SetHeight(height);
}
CFriendListItem::CFriendListItem( DWORD dwUserTag, BYTE btStatus, const char* pszName )
{
	SetHeight( 20 );
	SetWidth( 180 );
	m_dwUserTag = dwUserTag;
	m_btStatus = btStatus;
	assert( pszName );
	if( pszName )
		m_strName = pszName;

	m_online_image_id	= CResourceMgr::GetInstance()->GetImageNID( UI_IMAGE_RES_ID, "CLAN01_MARK_ONLINE" );;
	m_offline_image_id	= CResourceMgr::GetInstance()->GetImageNID( UI_IMAGE_RES_ID, "CLAN01_MARK_OFFLINE" );

}
Beispiel #3
0
//--------------------------------------------------------------------
void CForm::Create( IGUIControl* p_pParent, int p_nLeft, int p_nTop,
                    int p_nWidth, int p_nHeight )
{
    IGUIControl::Create();
    SetParent( p_pParent );
    SetLeft( p_nLeft );
    SetTop( p_nTop );
    SetWidth( p_nWidth );
    SetHeight( p_nHeight );
    if( m_pColor == NULL )
    {
        SetFontColor( *(new CColor( CColor::WHITE )) );
    }
}
Beispiel #4
0
void IconTextItem::Update(BView *owner, const BFont *font) {
	(void)owner;

	font_height fontHeight;
	font->GetHeight(&fontHeight);
	fFontHeight = fontHeight.descent + fontHeight.leading + fontHeight.ascent;
	
	if (fIcon) {
		fIconHeight = fIcon->Bounds().Height() + 1;
		fIconWidth = fIcon->Bounds().Width();

		if (fIconHeight > fFontHeight) {
			SetHeight(fIconHeight + (kEdgeOffset * 2));
			fFontOffset = ((fIconHeight - fFontHeight) / 2) + (kEdgeOffset * 2);
		} else {
			SetHeight(fFontHeight + (kEdgeOffset * 2));
			fFontOffset = kEdgeOffset;
		};
	} else {
		SetHeight(fFontHeight + (kEdgeOffset * 2));
		fFontOffset = kEdgeOffset;
	};	
};
//-----------------------------------------------------------------------------
// Purpose: Retract and stop attacking
//-----------------------------------------------------------------------------
void CNPC_CeilingTurret::Retire( void )
{
	if ( PreThink( TURRET_RETIRING ) )
		return;

	//Level out the turret
	m_vecGoalAngles = GetAbsAngles();
	SetNextThink( gpGlobals->curtime );

	//Set ourselves to close
	if ( GetActivity() != ACT_CEILING_TURRET_CLOSE )
	{
		//Set our visible state to dormant
		SetEyeState( TURRET_EYE_DORMANT );

		SetActivity( (Activity) ACT_CEILING_TURRET_OPEN_IDLE );
		
		//If we're done moving to our desired facing, close up
		if ( UpdateFacing() == false )
		{
			SetActivity( (Activity) ACT_CEILING_TURRET_CLOSE );
			EmitSound( "NPC_CeilingTurret.Retire" );

			//Notify of the retraction
			m_OnRetire.FireOutput( NULL, this );
		}
	}
	else if ( IsActivityFinished() )
	{	
		SetHeight( CEILING_TURRET_RETRACT_HEIGHT );

		m_bActive		= false;
		m_flLastSight	= 0;

		SetActivity( (Activity) ACT_CEILING_TURRET_CLOSED_IDLE );

		//Go back to auto searching
		if ( m_bAutoStart )
		{
			SetThink( &CNPC_CeilingTurret::AutoSearchThink );
			SetNextThink( gpGlobals->curtime + 0.05f );
		}
		else
		{
			//Set our visible state to dormant
			SetEyeState( TURRET_EYE_DISABLED );
			SetThink( &CNPC_CeilingTurret::SUB_DoNothing );
		}
	}
}
UIHandle::Result TrackPanelResizeHandle::Cancel(AudacityProject *pProject)
{
   auto pTrack = pProject->GetTracks()->Lock(mpTrack);
   if ( !pTrack )
      return RefreshCode::Cancelled;

   TrackList *const tracks = pProject->GetTracks();

   switch (mMode) {
   case IsResizing:
   {
      pTrack->SetHeight(mInitialActualHeight);
      pTrack->SetMinimized(mInitialMinimized);
   }
   break;
   case IsResizingBetweenLinkedTracks:
   {
      Track *const next = tracks->GetNext(pTrack.get());
      pTrack->SetHeight(mInitialUpperActualHeight);
      pTrack->SetMinimized(mInitialMinimized);
      next->SetHeight(mInitialActualHeight);
      next->SetMinimized(mInitialMinimized);
   }
   break;
   case IsResizingBelowLinkedTracks:
   {
      Track *const prev = tracks->GetPrev(pTrack.get());
      pTrack->SetHeight(mInitialActualHeight);
      pTrack->SetMinimized(mInitialMinimized);
      prev->SetHeight(mInitialUpperActualHeight);
      prev->SetMinimized(mInitialMinimized);
   }
   break;
   }

   return RefreshCode::RefreshAll;
}
Beispiel #7
0
void FitProportional(LPRECT rect)
        {
        ERect Result;
        ERect r(rect->left,rect->top,rect->right,rect->bottom);
        r.Normalize();
        float w=Width();
        float h=Height();
        float cw=r.Width();
        float ch=r.Height();
        /*float resolution=(float)th/(float)tw;
        tw=(float)trh*resolution;
        if(tw<Width())
                {
                tw=Width();
                resolution=((float)tw/(float)th);
                th=(float)trw/resolution;
                SetWidth(trw);
                SetHeight(th);
                }else
                {
                tw=Width();
                resolution=((float)tw/(float)th);
                tw=(float)trh/resolution;
                SetWidth(tw);
                SetHeight(trh);
                }  */
        float xyaspect=w/h;
        if(w>h)
                {
                w=cw;
                h=cw/xyaspect;
                if(h>ch)
                        {
                        h=ch;
                        w=ch*xyaspect;
                        }
                }else
                {
                h=ch;
                w=ch*xyaspect;
                if(w>cw)
                        {
                        w=cw;
                        h=cw/xyaspect;
                        }
                }
        SetWidth(w);
        SetHeight(h);
        }
Beispiel #8
0
//--------------------------------------------------------------------
void CForm::Create( IGUIControl* p_pParent, int p_nLeft, int p_nTop,
                    CBitmap& p_Bitmap )
{
    IGUIControl::Create();
    SetParent( p_pParent );
    SetLeft( p_nLeft );
    SetTop( p_nTop );
    SetBG( p_Bitmap );
    SetWidth( p_Bitmap.Width() );
    SetHeight( p_Bitmap.Height() );
    if( m_pColor == NULL )
    {
        SetFontColor( *(new CColor( CColor::WHITE )) );
    }
}
CZLBAppendText::CZLBAppendText( const char* pszText, int iWidth, DWORD dwColor)
{
	SetWidth( iWidth );

	if( pszText )
	{
		m_jString.SetSplitType( CJStringParser::SPLIT_WORD );
		m_jString.SetDefaultColor( dwColor );

		m_jString.SetString( pszText, iWidth - 10 );

		if( m_jString.GetStringCount() )
			SetHeight( m_jString.GetString(0)->GetStringHeight() * m_jString.GetStringCount() + 3 );
	}
}
Beispiel #10
0
Player::Player()
{
	SetPosition(a_playerPos);
	SetSpeed(a_playerSpd);
	SetWidth(c_iPlayerWidth);
	SetHeight( c_iPlayerHeight );
	SetSpriteID(iPlayerSpriteID);
	Create("./images/GrayBox.png");
	m_iMaxAmmo = 5;
	m_iAmmo = m_iMaxAmmo;
	m_bShot = false;
	m_iTimer = 0;
	m_iHp = 3;
	Bullets = CreateBullets(m_iMaxAmmo);		
}
Beispiel #11
0
cMinecart::cMinecart(ePayload a_Payload, double a_X, double a_Y, double a_Z) :
	super(etMinecart, a_X, a_Y, a_Z, 0.98, 0.7),
	m_Payload(a_Payload),
	m_LastDamage(0),
	m_DetectorRailPosition(0, 0, 0),
	m_bIsOnDetectorRail(false)
{
	SetMass(20.0f);
	SetGravity(-16.0f);
	SetAirDrag(0.05f);
	SetMaxHealth(6);
	SetHealth(6);
	SetWidth(1);
	SetHeight(0.9);
}
Beispiel #12
0
GUIVidget::GUIVidget()
{
	Init();
	SetX(0);
	SetY(0);
	SetWidth(0);
	SetHeight(0);
	SetColor(DEFAULT_CONTROL_COLOR);
	SetVisible(false);
	SetDead(false);
	SetTexture(NULL);
	SetParent((GUIBaseControl*)NULL);
	SetBorder(false);
	SetBorderType(btNone);
}
/*--------------------------------------------------------------------------------*/
AudioObjectParameters& AudioObjectParameters::operator *= (const PositionTransform& transform)
{
  Position centre = GetPosition(), corner = centre;

  SetPosition(centre * transform);
 
  if (centre.polar)
  {
    corner.pos.az += GetWidth();
    corner.pos.el += GetHeight();
    corner.pos.d  += GetDepth();
  }
  else
  {
    corner.pos.x  += GetWidth();
    corner.pos.y  += GetDepth();
    corner.pos.z  += GetHeight();
  }

  corner = (corner * transform) - centre;

  if (centre.polar)
  {
    SetWidth(static_cast<float>(corner.pos.az));
    SetHeight(static_cast<float>(corner.pos.el));
    SetDepth(static_cast<float>(corner.pos.d));
  }
  else
  {
    SetWidth(static_cast<float>(corner.pos.x));
    SetDepth(static_cast<float>(corner.pos.y));
    SetHeight(static_cast<float>(corner.pos.z));
  }
  
  return *this;
}
Window_Base::Window_Base(int x, int y, int width, int height) {
	windowskin_name = Game_System::GetSystemName();
	if (!windowskin_name.empty()) {
		SetWindowskin(Cache::System(windowskin_name));
	} else {
		SetWindowskin(Bitmap::Create(160, 80, false));
	}

	SetX(x);
	SetY(y);
	SetWidth(width);
	SetHeight(height);
	SetStretch(Game_System::GetMessageStretch() == RPG::System::Stretch_stretch);
	SetZ(3000);
}
Beispiel #15
0
Request::FieldsDialog::ListFieldMultiple::ListFieldMultiple(
    PurpleRequestField *field)
    : ListBox(AUTOSIZE, 1), field(field)
{
    g_assert(field);

    // TODO display label of the field somewhere

    int height = 0;
    for (GList *list = purple_request_field_list_get_items(field); list;
            list = list->next, height++)
        AppendWidget(*(new ListFieldItem(field,
                                         reinterpret_cast<const char*>(list->data))));
    SetHeight(height);
}
Beispiel #16
0
void
BackupListItem::Update(BView* owner, const BFont* font)
{
	BListItem::Update(owner, font);
	font_height height;
	font->GetHeight(&height);

	float lineHeight = ceilf(height.ascent) + ceilf(height.descent)
		+ ceilf(height.leading);

	fFirstlineOffset = 2 + ceilf(height.ascent + height.leading / 2);
	fSecondlineOffset = fFirstlineOffset + lineHeight;

	SetHeight(2 * lineHeight + 4);
}
Beispiel #17
0
void CPWFindToolBar::ShowFindToolBar(bool bShow)
{
  if (this->GetSafeHwnd() == NULL)
    return;

  if (bShow) {
    CRect rt;
    GetItemRect(0, &rt);
    const int iBtnHeight = rt.Height();

    /**
     * Bjorne's suggestion: Set Find fonts to tree/list view font
     * However, from BR 1371 it is better to use the Add/Edit font
     * which is already used for CEdit controls.
     *
     * Unfortunately, as unable to change size of the CEdit controls so
     * that the text fits, we will dynamically reduce the font size
     * until it fits in the CEdit controls.
     *
     * We also do this if the user changes the Add/Edit font.
     *
     * Note: It is better this way as we did not do any sanity checks that
     * the user hadn't set an enormous point size e.g. 72!
     */
    if (!m_bFontSet) {
      ChangeFont();
    }

    SetHeight(iBtnHeight + 4);  // Add border
    m_findedit.ChangeColour();
    m_findedit.SetWindowPos(NULL, 0, 0, EDITCTRL_WIDTH, iBtnHeight,
                            SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE);

    m_findedit.SetSel(0, -1);  // Select all text
    m_findedit.Invalidate();

    m_findresults.SetWindowPos(NULL, 0, 0, FINDRESULTS_WIDTH, iBtnHeight,
                               SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE);
  }

  GetToolBarCtrl().AutoSize();

  ::ShowWindow(this->GetSafeHwnd(), bShow ? SW_SHOW : SW_HIDE);
  ::EnableWindow(this->GetSafeHwnd(), bShow ? TRUE : FALSE);
  m_findedit.SetFocus();

  m_bVisible = bShow;
}
void
InternalResampleAttributes::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("InternalResampleAttributes");
    if(searchNode == 0)
        return;

    DataNode *node;
    if((node = searchNode->GetNode("useTargetVal")) != 0)
        SetUseTargetVal(node->AsBool());
    if((node = searchNode->GetNode("targetVal")) != 0)
        SetTargetVal(node->AsInt());
    if((node = searchNode->GetNode("width")) != 0)
        SetWidth(node->AsInt());
    if((node = searchNode->GetNode("height")) != 0)
        SetHeight(node->AsInt());
    if((node = searchNode->GetNode("depth")) != 0)
        SetDepth(node->AsInt());
    if((node = searchNode->GetNode("prefersPowersOfTwo")) != 0)
        SetPrefersPowersOfTwo(node->AsBool());
    if((node = searchNode->GetNode("defaultVal")) != 0)
        SetDefaultVal(node->AsFloat());
    if((node = searchNode->GetNode("useBounds")) != 0)
        SetUseBounds(node->AsBool());
    if((node = searchNode->GetNode("minX")) != 0)
        SetMinX(node->AsDouble());
    if((node = searchNode->GetNode("minY")) != 0)
        SetMinY(node->AsDouble());
    if((node = searchNode->GetNode("minZ")) != 0)
        SetMinZ(node->AsDouble());
    if((node = searchNode->GetNode("maxX")) != 0)
        SetMaxX(node->AsDouble());
    if((node = searchNode->GetNode("maxY")) != 0)
        SetMaxY(node->AsDouble());
    if((node = searchNode->GetNode("maxZ")) != 0)
        SetMaxZ(node->AsDouble());
    if((node = searchNode->GetNode("useArbitrator")) != 0)
        SetUseArbitrator(node->AsBool());
    if((node = searchNode->GetNode("arbitratorLessThan")) != 0)
        SetArbitratorLessThan(node->AsBool());
    if((node = searchNode->GetNode("arbitratorVarName")) != 0)
        SetArbitratorVarName(node->AsString());
    if((node = searchNode->GetNode("distributedResample")) != 0)
        SetDistributedResample(node->AsBool());
}
Beispiel #19
0
AnimationSprite::AnimationSprite(ID2D1Bitmap *pTexture, int row, int column, float x, float y, float width, float height) 
	: Sprite(pTexture,  x, y)
{
	SetRow(row);
	SetColumn(column);
	SetCX(0);
	SetCY(0);

	SetWidth(width);
	SetHeight(height);
	SetLocation(x, y);

	fps = column*1.f;
	isPlaying = false;
	totalTime = 0;
}
Beispiel #20
0
///////////////////////////////////////////////
//  CONSTRUCTOR / DECONSTRUCT / OP OVERLOADS
///////////////////////////////////////////////
CBullet::CBullet()
{
	m_pOwner = NULL;	
	SetWidth(16);
	SetHeight(16);
	SetDamage(5);
	SetType(OBJ_BULLET);
	ES->RegisterClient("enemyhit",this);
	ES->RegisterClient("camerachange",this);
	m_fTimer = 0.0f;
	m_fRotation = 0.0f;

	// Screw specifics
	m_bScrew = false;
	m_bPuke = false;
};
Beispiel #21
0
void
BStringItem::Update(BView* owner, const BFont* font)
{
	if (fText != NULL) {
		SetWidth(font->StringWidth(fText)
			+ be_control_look->DefaultLabelSpacing());
	}

	font_height fheight;
	font->GetHeight(&fheight);

	fBaselineOffset = 2 + ceilf(fheight.ascent + fheight.leading / 2);

	SetHeight(ceilf(fheight.ascent) + ceilf(fheight.descent)
		+ ceilf(fheight.leading) + 4);
}
//-----------------------------------------------------------------------------
// Purpose: Deploy and start searching for targets.
//-----------------------------------------------------------------------------
void CNPC_CombineCamera::Deploy()
{
	m_vecGoalAngles = GetAbsAngles();

	SetNextThink( gpGlobals->curtime );

	SetEyeState(CAMERA_EYE_IDLE);
	m_bActive = true;

	SetHeight(COMBINE_CAMERA_DEPLOY_HEIGHT);
	SetIdealActivity((Activity) ACT_COMBINE_CAMERA_OPEN_IDLE);
	m_flPlaybackRate = 0;
	SetThink(&CNPC_CombineCamera::SearchThink);

	EmitSound("NPC_CombineCamera.Move");
}
Beispiel #23
0
	//--------------------------------------------------------------------
	void CScrollBar::SetSlider( CBitmap& p_SliderBitmap )
	{
		m_pSlider = &p_SliderBitmap;

		if( m_eType == ESBT_Horizontal )
		{
			SetHeight( m_pSlider->Height() );
		}
		else
		{
			SetWidth( m_pSlider->Width() );
		}

		m_vecImages.push_back( CImage( SSGUIManager::Instance()->GetGraphics().CreateImage( 
			*m_pSlider, 0, 0, m_nWidth, m_nHeight, EBF_Smooth ) ) );
	}
Beispiel #24
0
void ColorItem::Update(BView *owner, const BFont *font)
{
	if (fText)
		SetWidth(font->StringWidth(fText));

	font_height fheight;
	font->GetHeight(&fheight);

	float height = ceilf(fheight.ascent) + ceilf(fheight.descent)
		+ ceilf(fheight.leading) + 1;

	if (height < COLOR_ITEM_HEIGHT) height = COLOR_ITEM_HEIGHT;
	fBaselineOffset = (height / 2) + fheight.descent + 1;
	
	SetHeight(height);
}
CheckBoxObject::CheckBoxObject(std::string name_) :
Object(name_),
borderWidth(1),
padding(5)
{
    //Create the SFGUI CheckBox object
    obj = sfg::CheckButton::Create("Texte");

    SetString("Case à cocher");

    //Default size of the object
    SetWidth(180);
    SetHeight(24);

    fontSize = 12;

    //Colors "Schemes"
    borderColor = new ColorScheme(sf::Color(146, 147, 151, 255),
                                  sf::Color(146, 147, 151, 255),
                                  sf::Color(146, 147, 151, 255),
                                  sf::Color(173, 173, 173, 255));

    backgroundColor = new ColorScheme(sf::Color(255, 255, 255, 255),
                                      sf::Color(201, 201, 201, 255),
                                      sf::Color(230, 230, 230, 255),
                                      sf::Color(140, 140, 140, 255));

    textColor = new ColorScheme(sf::Color(0, 0, 0, 255),
                                sf::Color(0, 0, 0, 255),
                                sf::Color(0, 0, 0, 255),
                                sf::Color(100, 100, 100, 255));

    checkColor = new ColorScheme(sf::Color(122, 122, 122, 255));

    SetBoxSize(14);
    SetCheckSignSize(6);

    obj->SetPosition( sf::Vector2f( GetX(), GetY() ) );

    obj->SetId(ToString<void*>(this));

    ConnectSignals();
    ResetEventInformations();

    UpdateProperties();
}
void
MediaListItem::Update(BView* owner, const BFont* font)
{
	// we need to override the update method so we can make sure our
	// list item size doesn't change
	BListItem::Update(owner, font);

	float iconHeight = MediaIcons::sBounds.Height() + 1;
	if ((Height() < iconHeight + kITEM_MARGIN * 2)) {
		SetHeight(iconHeight + kITEM_MARGIN * 2);
	}

	Renderer renderer;
	renderer.SetTitle(Label());
	SetRenderParameters(renderer);
	SetWidth(renderer.ItemWidth());
}
Beispiel #27
0
void
InterfaceListItem::Update(BView* owner, const BFont* font)
{
	BListItem::Update(owner, font);
	font_height height;
	font->GetHeight(&height);

	float lineHeight = ceilf(height.ascent) + ceilf(height.descent)
		+ ceilf(height.leading);

	fFirstlineOffset = 2 + ceilf(height.ascent + height.leading / 2);
	fSecondlineOffset = fFirstlineOffset + lineHeight;
	fThirdlineOffset = fFirstlineOffset + (lineHeight * 2);

	SetHeight(std::max(3 * lineHeight + 4, fIcon->Bounds().Height() + 8));
		// either to the text height or icon height, whichever is taller
}
Beispiel #28
0
ActorLifebar::ActorLifebar() : Sprite()
{
	Health = 50; // Out of 100!
	pending_health = 0;
	time = 0;

	SetImage(GameState::GetInstance().GetSkinImage("healthbar.png"));

	SetWidth(PlayfieldHeight / 2);
	SetHeight(Configuration::GetSkinConfigf("Height", "Lifebar" ));
	Centered = Configuration::GetSkinConfigf( "Centered", "Lifebar" ) != 0;
	SetPosition( Configuration::GetSkinConfigf("X", "Lifebar" ), Configuration::GetSkinConfigf("Y", "Lifebar" ));
	SetRotation( Configuration::GetSkinConfigf("Rotation", "Lifebar" ) );
	AffectedByLightning = true;

	UpdateHealth();
}
Beispiel #29
0
Paddle::Paddle(unsigned id)
  : Entity(id)
  , keysym_up_(-1)
  , keysym_down_(-1)
  , up_key_down_(false)
  , down_key_down_(false)
  , events_enabled_(true)
  , speed_increse_(0)
{
  SetWidth(WIDTH);
  SetHeight(HEIGHT);

  finger_down.connect([this] (int x, int y, int dx, int dy) {
    if (!paused_ && events_enabled_ && input_boundary_.PointInside({x, y}))
      SetY(y - height() / 2);
  });
}
Beispiel #30
0
void CUITextBox::_StringSplit()
{
	m_vecBoxString.clear();

	if (m_Str.empty() == true)
		return;

	// 문자열이 출력될 수 있는 크기.
	m_nBoxWidth = GetWidth() - m_nStartX * 2;		

	// 스크롤이 연결되어 있다면 스크롤바 width만큼 빼준다.
	if (m_pScroll != NULL)
		m_nBoxWidth -= m_pScroll->getThumbWidth();	

	// 폰트 하나의 width
	int nFontWidth = _pUIFontTexMgr->GetFontWidth() + _pUIFontTexMgr->GetFontSpacing();	

	// 박스 크기 / 폰트 하나의 크기 = 한라인에 차지하는 문자열.
	int nTextCnt = m_nBoxWidth / nFontWidth;

	switch (m_eSplitType)
	{
	case SPLIT_NONE:
		SplitNone(nTextCnt);
		break;
	case SPLIT_SPACE:
		SplitSpace(nTextCnt);
		break;
	case SPLIT_HYPHEN:
		SplitHyphen(nTextCnt);
		break;
	case SPLIT_MIXED:
		SplitMixed( nTextCnt);
		break;
	case SPLIT_CHAR_COUNT:
		SplitCharCount();
		break;
		
	}

	if (m_bUpdateHeight == TRUE)
	{
		SetHeight( GetTextTotalHeight() );
	}
	ASSERT(m_vecBoxString.size());
}