void TSigTextView::FrameResized(float /*width*/, float /*height*/) { BRect r(Bounds()); r.InsetBy(3, 3); SetTextRect(r); }
// -------------------------------------------------------------------------- RHTML_text_view - FrameResized - void RHTMLtextview::FrameResized(float new_width, float new_height) { if (DoesWordWrap() && fTarget->IsEnabled()) { SetTextRect(BRect(3, 3, Bounds().right - 2, Bounds().bottom - Bounds().top)); } BTextView::FrameResized(new_width, new_height); }
void DTextView::UpdateTextRect(void) { BRect r(Bounds()); r.InsetBy(5.0, 5.0); SetTextRect(r); }
//初期化 void Player::OnCreate() { //初期位置などの設定 auto Ptr = GetComponent<Transform>(); Ptr->SetScale(Vec3(m_Scale)); //直径25センチの球体 Ptr->SetRotation(0.0f, 0.0f, 0.0f); Ptr->SetPosition(m_StartPos); //衝突判定をつける auto PtrCol = AddComponent<CollisionSphere>(); //判定するだけなのでアクションはNone PtrCol->SetIsHitAction(IsHitAction::None); PsSphereParam param; //basecrossのスケーリングは直径基準なので、半径基準にする param.m_Radius = m_Scale * 0.5f; param.m_Mass = 1.0f; //慣性テンソルの計算 param.m_Inertia = BasePhysics::CalcInertiaSphere(param.m_Radius, param.m_Mass); //プレイヤーなのでスリープしない param.m_UseSleep = false; param.m_MotionType = PsMotionType::MotionTypeActive; param.m_Quat.identity(); param.m_Pos = m_StartPos; param.m_LinearVelocity = Vec3(0); auto PsPtr = AddComponent<PsSphereBody>(param); PsPtr->SetAutoTransform(false); PsPtr->SetDrawActive(true); //文字列をつける auto PtrString = AddComponent<StringSprite>(); PtrString->SetText(L""); PtrString->SetTextRect(Rect2D<float>(16.0f, 16.0f, 640.0f, 480.0f)); //影をつける(シャドウマップを描画する) auto ShadowPtr = AddComponent<Shadowmap>(); //影の形(メッシュ)を設定 ShadowPtr->SetMeshResource(L"DEFAULT_SPHERE"); //描画コンポーネントの設定 auto PtrDraw = AddComponent<BcPNTStaticDraw>(); //描画するメッシュを設定 PtrDraw->SetMeshResource(L"DEFAULT_SPHERE"); //描画するテクスチャを設定 PtrDraw->SetTextureResource(L"TRACE_TX"); //透明処理 SetAlphaActive(true); //カメラを得る auto PtrCamera = dynamic_pointer_cast<LookAtCamera>(OnGetDrawCamera()); if (PtrCamera) { //LookAtCameraである //LookAtCameraに注目するオブジェクト(プレイヤー)の設定 PtrCamera->SetTargetObject(GetThis<GameObject>()); PtrCamera->SetTargetToAt(Vec3(0, 0.25f, 0)); } }
void TexView::FrameResized(float w,float h) { //nice resizable text if(w > 250 && h > 250) { BRect r = BRect(0,0,w,h); r.InsetBy(5,5); SetTextRect(r); } }
//初期化 void ScoreObject::OnCreate(){ //文字列をつける auto PtrString = AddComponent<StringSprite>(); PtrString->SetText(L""); PtrString->SetTextRect(Rect2D<float>(16.0f, 16.0f, 640.0f, 480.0f)); //イベントマシンの構築 m_EventMachine = make_shared< EventMachine<ScoreObject>>(GetThis<ScoreObject>()); //イベントキーとイベントステートを結び付ける m_EventMachine->AddEventState(L"TorusHit", TorusHitEvent::Instance()); m_EventMachine->AddEventState(L"PlayerHit", PlayerHitEvent::Instance()); }
/*********************************************************** * ResetTextRect ***********************************************************/ void HWrapTextView::ResetTextRect() { BRect textRect = Bounds(); textRect.left = 4.0; textRect.top = 4.0; textRect.right -= 4.0; textRect.bottom -= 4.0; if(fUseRuler) textRect.right = fRightLimit; SetTextRect(textRect); }
void TTimeTextView::Init() { m_IsLocked = false; SetTextRect(Bounds()); SetAlignment(B_ALIGN_CENTER); // Set up max number of character SetMaxBytes(11); // Set font and color BFont theFont(be_plain_font); theFont.SetSize(10); SetViewColor(kWhite); SetFontAndColor(&theFont, B_FONT_ALL, &kBlack); // Set up time rects. We divide the area up into four areas // for hour, minutes, seconds and frames float numberWidth; float spaceWidth; BRect bounds = Bounds(); numberWidth = StringWidth("00"); spaceWidth = StringWidth(":"); m_HoursRect.left = bounds.left; m_HoursRect.top = bounds.top; m_HoursRect.right = m_HoursRect.left + numberWidth; m_HoursRect.bottom = bounds.bottom; m_MinutesRect.left = m_HoursRect.right + spaceWidth; m_MinutesRect.top = bounds.top; m_MinutesRect.right = m_MinutesRect.left + numberWidth; m_MinutesRect.bottom = bounds.bottom; m_SecondsRect.left = m_MinutesRect.right + spaceWidth; m_SecondsRect.top = bounds.top; m_SecondsRect.right = m_SecondsRect.left + numberWidth; m_SecondsRect.bottom = bounds.bottom; m_FramesRect.left = m_SecondsRect.right + spaceWidth; m_FramesRect.top = bounds.top; m_FramesRect.right = bounds.right; m_FramesRect.bottom = bounds.bottom; // Select first cell //Select(0,2); //ScrollToSelection(); m_CurrentCell = 1; }
void InputTextView::_CheckTextRect() { // update text rect and make sure // the cursor/selection is in view BRect textRect(TextRect()); float width = ceilf(StringWidth(Text()) + 2.0); if (textRect.Width() < width) { textRect.right = textRect.left + width; SetTextRect(textRect); ScrollToSelection(); } }
/* * Hook function-override, we the view is resized we have to change * the current writable area to suite the new size */ void NoteText :: FrameResized (float width, float height){ // Variables BRect frameText; // Obtain the current size of the view and adapt the writable area frameText = Bounds(); frameText.InsetBy(TEXT_INSET,TEXT_INSET); SetTextRect(frameText); // All the rest is handled by the superclass method BTextView :: FrameResized(width,height); }
//初期化 void Ball::OnCreate() { //初期位置などの設定 auto Ptr = GetComponent<Transform>(); Ptr->SetScale(0.25f, 0.25f, 0.25f); //直径25センチの球体 Ptr->SetRotation(0.0f, 0.0f, 0.0f); Ptr->SetPosition(m_StartPos); //Rigidbodyをつける auto PtrRedid = AddComponent<Rigidbody>(); PtrRedid->SetReflection(1.0f); //衝突判定をつける auto PtrCol = AddComponent<CollisionSphere>(); //デバッグ用文字列をつける auto PtrString = AddComponent<StringSprite>(); PtrString->SetText(L""); if (isOne) { PtrString->SetTextRect(Rect2D<float>(640.0f, 16.0f, 1280.0f, 320.0f)); } else { PtrString->SetTextRect(Rect2D<float>(640.0f, 320.0f, 1280.0f, 640.0f)); } //影をつける(シャドウマップを描画する) auto ShadowPtr = AddComponent<Shadowmap>(); //影の形(メッシュ)を設定 ShadowPtr->SetMeshResource(L"DEFAULT_SPHERE"); //描画コンポーネントの設定 auto PtrDraw = AddComponent<BcPNTStaticDraw>(); //描画するメッシュを設定 PtrDraw->SetMeshResource(L"DEFAULT_SPHERE"); //描画するテクスチャを設定 PtrDraw->SetTextureResource(L"SKY_TX"); }
//初期化 void Player::Create(){ //初期位置などの設定 auto Ptr = GetComponent<Transform>(); Ptr->SetScale(0.25f, 0.25f, 0.25f); //直径25センチの球体 Ptr->SetRotation(0.0f, 0.0f, 0.0f); Ptr->SetPosition(0, 5.0f, 0); //Rigidbodyをつける auto PtrRedit = AddComponent<Rigidbody>(); //重力をつける auto PtrGravity = AddComponent<Gravity>(); //最下地点 PtrGravity->SetBaseY(0.125f); //衝突判定をつける auto PtrCol = AddComponent<CollisionSphere>(); //文字列をつける auto PtrString = AddComponent<StringSprite>(); PtrString->SetText(L""); PtrString->SetTextRect(Rect2D<float>(16.0f, 16.0f, 640.0f, 480.0f)); //影をつける(シャドウマップを描画する) auto ShadowPtr = AddComponent<Shadowmap>(); //影の形(メッシュ)を設定 ShadowPtr->SetMeshResource(L"DEFAULT_SPHERE"); //描画コンポーネントの設定 auto PtrDraw = AddComponent<BasicPNTDraw>(); //描画するメッシュを設定 PtrDraw->SetMeshResource(L"DEFAULT_SPHERE"); //描画するテクスチャを設定 PtrDraw->SetTextureResource(L"TRACE_TX"); //透明処理 SetAlphaActive(true); //0番目のビューのカメラを得る //LookAtCameraである auto PtrCamera = dynamic_pointer_cast<LookAtCamera>(GetStage()->GetCamera(0)); if (PtrCamera){ //LookAtCameraに注目するオブジェクト(プレイヤー)の設定 PtrCamera->SetTargetObject(GetThis<GameObject>()); } //ステートマシンの構築 m_StateMachine = make_shared< StateMachine<Player> >(GetThis<Player>()); //最初のステートをDefaultStateに設定 m_StateMachine->SetCurrentState(DefaultState::Instance()); //DefaultStateの初期化実行を行う m_StateMachine->GetCurrentState()->Enter(GetThis<Player>()); }
//初期化 void Player::OnCreate() { //初期位置などの設定 auto Ptr = AddComponent<Transform>(); Ptr->SetScale(0.25f, 0.25f, 0.25f); //直径25センチの球体 Ptr->SetRotation(0.0f, 0.0f, 0.0f); Ptr->SetPosition(0, 0.125f, 0); //Rigidbodyをつける auto PtrRedid = AddComponent<Rigidbody>(); //衝突判定をつける auto PtrCol = AddComponent<CollisionSphere>(); PtrCol->SetIsHitAction(IsHitAction::Auto); //文字列をつける auto PtrString = AddComponent<StringSprite>(); PtrString->SetText(L""); PtrString->SetTextRect(Rect2D<float>(16.0f, 16.0f, 640.0f, 480.0f)); //影をつける(シャドウマップを描画する) auto ShadowPtr = AddComponent<Shadowmap>(); //影の形(メッシュ)を設定 ShadowPtr->SetMeshResource(L"DEFAULT_SPHERE"); //描画コンポーネントの設定 auto PtrDraw = AddComponent<BcPNTStaticDraw>(); //描画するメッシュを設定 PtrDraw->SetMeshResource(L"DEFAULT_SPHERE"); //描画するテクスチャを設定 PtrDraw->SetTextureResource(L"TRACE_TX"); //透明処理 SetAlphaActive(true); //カメラを得る auto PtrCamera = dynamic_pointer_cast<LookAtCamera>(OnGetDrawCamera()); if (PtrCamera) { //LookAtCameraである //LookAtCameraに注目するオブジェクト(プレイヤー)の設定 PtrCamera->SetTargetObject(GetThis<GameObject>()); PtrCamera->SetTargetToAt(Vec3(0, 0.25f, 0)); } //最初はAボタンはジャンプ m_PlayerAction = PlayerAction::Jump; //ステートマシンの構築 m_StateMachine.reset(new LayeredStateMachine<Player>(GetThis<Player>())); //最初のステートをPlayerDefaultにリセット m_StateMachine->Reset(PlayerDefaultState::Instance()); }
void WrappingTextView::ResetTextRect() { BRect bounds = Bounds(); BRect textRect = bounds; textRect.left = 4.0; textRect.top = m_vertical_offset + 4.0f; if (m_fixed_width) textRect.right = 8.0f + StringWidth( "0") * float(m_fixed_width); else textRect.right -= 4.0f; textRect.bottom -= 4.0f; SetTextRect(textRect); // we have to readjust the scrollbar-proportion, since // the BTextView doesn't do it correctly when we have // fooled in a vertical_offset: float small, big; BScrollBar* bar = ScrollBar( B_VERTICAL); if (!bar) return; bar->GetSteps( &small, &big); float height = TextHeight( 0, TextLength()); if (height+m_vertical_offset) bar->SetProportion( MIN( 1.0f, big/(height+m_vertical_offset))); else bar->SetProportion( 1.0f); if (BeamOnDano) { // circumvent a special feature/bug in Zeta with respect to // the scrollbar not always calling ValueChanged() on a click. // Seemingly, changing the value twice hides the bug: bar->SetValue(1); bar->SetValue(0); } bar = ScrollBar( B_HORIZONTAL); if (!bar) return; float width = bounds.Width(); float maxWidth = MAX( width, textRect.right); int numChildren = IsEditable() ? 0 : CountChildren(); for( int i=0; i<numChildren; ++i) { float w = ChildAt( i)->Frame().Width(); if (w > maxWidth) maxWidth = w; } bar->SetSteps( width/10, width); bar->SetRange( 0, MAX(0, maxWidth-width)); bar->SetProportion( MIN( 1.0f, width/maxWidth)); }
void URLInputGroup::URLTextView::_AlignTextRect() { // Layout the text rect to be in the middle, normally this means there // is one pixel spacing on each side. BRect textRect(Bounds()); textRect.left = 0.0; float vInset = max_c(1, floorf((textRect.Height() - LineHeight(0)) / 2.0 + 0.5)); float hInset = kHorizontalTextRectInset; if (be_control_look) hInset = be_control_look->DefaultLabelSpacing(); textRect.InsetBy(hInset, vInset); SetTextRect(textRect); }
void _BTextInput_::AlignTextRect() { // the label font could require the control to be higher than // necessary for the text view, we compensate this by layouting // the text rect to be in the middle, normally this means there // is one pixel spacing on each side BRect textRect(Bounds()); float vInset = max_c(1, floorf((textRect.Height() - LineHeight(0)) / 2.0)); float hInset = 2; float textFontWidth = TextRect().right; if (be_control_look != NULL) { switch (Alignment()) { case B_ALIGN_LEFT: hInset = be_control_look->DefaultLabelSpacing(); break; case B_ALIGN_RIGHT: hInset = textRect.right - textFontWidth; hInset -= be_control_look->DefaultLabelSpacing(); break; case B_ALIGN_CENTER: hInset = (textRect.right - textFontWidth) / 2.0; break; default: break; } } textRect.InsetBy(hInset, vInset); SetTextRect(textRect); }
// What a hack... void BComboBox::TextInput::AlignTextRect() { BRect bounds = Bounds(); BRect textRect = TextRect(); switch (Alignment()) { default: case B_ALIGN_LEFT: textRect.OffsetTo(B_ORIGIN); break; case B_ALIGN_CENTER: textRect.OffsetTo((bounds.Width() - textRect.Width()) / 2, textRect.top); break; case B_ALIGN_RIGHT: textRect.OffsetTo(bounds.Width() - textRect.Width(), textRect.top); break; } SetTextRect(textRect); }
AboutTextView(BRect rect) : BTextView(rect,NULL,rect.OffsetToCopy(B_ORIGIN),B_FOLLOW_NONE,B_WILL_DRAW) { int32 major = 0,middle = 0,minor = 0,variety = 0,internal = 1; // get version information for app app_info appInfo; if (be_app->GetAppInfo(&appInfo) == B_OK) { BFile file(&appInfo.ref,B_READ_ONLY); if (file.InitCheck() == B_OK) { BAppFileInfo info(&file); if (info.InitCheck() == B_OK) { version_info versionInfo; if (info.GetVersionInfo(&versionInfo,B_APP_VERSION_KIND) == B_OK) { major = versionInfo.major; middle = versionInfo.middle; minor = versionInfo.minor; variety = versionInfo.variety; internal = versionInfo.internal; } } } } // prepare version variety string const char *varietyStrings[] = {"Development","Alpha","Beta","Gamma","Golden master","Final"}; char varietyString[32]; strcpy(varietyString,varietyStrings[variety % 6]); if (variety < 5) sprintf(varietyString + strlen(varietyString),"/%li",internal); char s[512]; sprintf(s, "Mail Daemon Replacement\n\n" "by Dr. Zoidberg Enterprises. All rights reserved.\n\n" "Version %ld.%ld.%ld %s\n\n" "See LICENSE file included in the installation package for more information.\n\n\n\n" "You can contact us at:\n" "%s\n\n" "Please submit bug reports using the %s\n\n" "Project homepage at:\n%s", major,middle,minor,varietyString, kEMail,kBugsitePretty,kWebsite); SetText(s); MakeEditable(false); MakeSelectable(false); SetAlignment(B_ALIGN_CENTER); SetStylable(true); // aethetical changes BFont font; GetFont(&font); font.SetSize(24); SetFontAndColor(0,23,&font,B_FONT_SIZE); // center the view vertically rect = TextRect(); rect.OffsetTo(0,(Bounds().Height() - TextHeight(0,42)) / 2); SetTextRect(rect); // set the link regions int start = strstr(s,kEMail) - s; int finish = start + strlen(kEMail); GetTextRegion(start,finish,&fMail); SetFontAndColor(start,finish,NULL,0,&kLinkColor); start = strstr(s,kBugsitePretty) - s; finish = start + strlen(kBugsitePretty); GetTextRegion(start,finish,&fBugsite); SetFontAndColor(start,finish,NULL,0,&kLinkColor); start = strstr(s,kWebsite) - s; finish = start + strlen(kWebsite); GetTextRegion(start,finish,&fWebsite); SetFontAndColor(start,finish,NULL,0,&kLinkColor); }
BOOL CTaskbarNotifier::LoadConfiguration(LPCTSTR pszFilePath) { struct _stat st; st.st_mtime = -1; // '-1' = missing file (void)_tstat(pszFilePath, &st); if ( m_strConfigFilePath.CompareNoCase(pszFilePath) == 0 && st.st_mtime == m_tConfigFileLastModified) return TRUE; TCHAR szConfigDir[MAX_PATH]; int iTextNormalRed, iTextNormalGreen, iTextNormalBlue; int iTextSelectedRed, iTextSelectedGreen, iTextSelectedBlue; int iLeft, iTop, iRight, iBottom; int iBmpTransparentRed, iBmpTransparentGreen, iBmpTransparentBlue; int iFontSize; CString strFontType, strBmpFilePath, strBmpFileName; Hide(); m_strConfigFilePath = pszFilePath; CIni ini(pszFilePath, _T("Config")); _tcsncpy(szConfigDir, pszFilePath, _countof(szConfigDir)); szConfigDir[_countof(szConfigDir)-1] = _T('\0'); LPTSTR pszFileName = _tcsrchr(szConfigDir, _T('\\')); if (pszFileName == NULL) return FALSE; *(pszFileName + 1) = _T('\0'); iTextNormalRed = ini.GetInt(_T("TextNormalRed"), 255); iTextNormalGreen = ini.GetInt(_T("TextNormalGreen"), 255); iTextNormalBlue = ini.GetInt(_T("TextNormalBlue"), 255); iTextSelectedRed = ini.GetInt(_T("TextSelectedRed"), 255); iTextSelectedGreen = ini.GetInt(_T("TextSelectedGreen"), 255); iTextSelectedBlue = ini.GetInt(_T("TextSelectedBlue"), 255); // for backward compatibility read the old values (which had a typo) and then the new values iBmpTransparentRed = ini.GetInt(_T("BmpTrasparentRed"), 255); iBmpTransparentRed = ini.GetInt(_T("BmpTransparentRed"), iBmpTransparentRed); iBmpTransparentGreen = ini.GetInt(_T("BmpTrasparentGreen"), 0); iBmpTransparentGreen = ini.GetInt(_T("BmpTransparentGreen"), iBmpTransparentGreen); iBmpTransparentBlue = ini.GetInt(_T("BmpTrasparentBlue"), 255); iBmpTransparentBlue = ini.GetInt(_T("BmpTransparentBlue"), iBmpTransparentBlue); strFontType = ini.GetString(_T("FontType"), _T("MS Shell Dlg")); iFontSize = ini.GetInt(_T("FontSize"), 8) * 10; m_dwTimeToStay = ini.GetInt(_T("TimeToStay"), 4000); m_dwTimeToShow = ini.GetInt(_T("TimeToShow"), 500); m_dwTimeToHide = ini.GetInt(_T("TimeToHide"), 200); strBmpFileName = ini.GetString(_T("BmpFileName"), _T("")); if (!strBmpFileName.IsEmpty()) { if (PathIsRelative(strBmpFileName)) strBmpFilePath.Format(_T("%s%s"), szConfigDir, strBmpFileName); else strBmpFilePath = strBmpFileName; } // get text rectangle coordinates iLeft = ini.GetInt(_T("rcTextLeft"), 5); iTop = ini.GetInt(_T("rcTextTop"), 45); iRight = ini.GetInt(_T("rcTextRight"), 220); iBottom = ini.GetInt(_T("rcTextBottom"), 85); if (iLeft <= 0) iLeft = 1; if (iTop <= 0) iTop = 1; if (iRight <= 0) iRight = 1; if (iBottom <= 0) iBottom = 1; SetTextRect(CRect(iLeft, iTop, iRight, iBottom)); // get close button rectangle coordinates iLeft = ini.GetInt(_T("rcCloseBtnLeft"), 286); iTop = ini.GetInt(_T("rcCloseBtnTop"), 40); iRight = ini.GetInt(_T("rcCloseBtnRight"), 300); iBottom = ini.GetInt(_T("rcCloseBtnBottom"), 54); if (iLeft <= 0) iLeft = 1; if (iTop <= 0) iTop = 1; if (iRight <= 0) iRight = 1; if (iBottom <= 0) iBottom = 1; SetCloseBtnRect(CRect(iLeft, iTop, iRight, iBottom)); // get history button rectangle coordinates iLeft = ini.GetInt(_T("rcHistoryBtnLeft"), 283); iTop = ini.GetInt(_T("rcHistoryBtnTop"), 14); iRight = ini.GetInt(_T("rcHistoryBtnRight"), 299); iBottom = ini.GetInt(_T("rcHistoryBtnBottom"), 39); if (iLeft <= 0) iLeft = 1; if (iTop <= 0) iTop = 1; if (iRight <= 0) iRight = 1; if (iBottom <= 0) iBottom = 1; SetHistoryBtnRect(CRect(iLeft, iTop, iRight, iBottom)); if (strBmpFilePath.IsEmpty() || !SetBitmap(strBmpFilePath, iBmpTransparentRed, iBmpTransparentGreen, iBmpTransparentBlue)) { CEnBitmap imgTaskbar; if (imgTaskbar.LoadImage(IDR_TASKBAR, _T("GIF"))) { if (!SetBitmap(&imgTaskbar, iBmpTransparentRed, iBmpTransparentGreen, iBmpTransparentBlue)) return FALSE; } } SetTextFont(strFontType, iFontSize, TN_TEXT_NORMAL, TN_TEXT_UNDERLINE); SetTextColor(RGB(iTextNormalRed, iTextNormalGreen, iTextNormalBlue), RGB(iTextSelectedRed, iTextSelectedGreen, iTextSelectedBlue)); m_tConfigFileLastModified = st.st_mtime; return TRUE; }
BOOL CTaskbarNotifier::LoadConfiguration(LPCTSTR szFileName) { TCHAR szConfigDir[MAX_PATH]; int nRed, nGreen, nBlue, sRed, sGreen, sBlue; int rcLeft, rcTop, rcRight, rcBottom; int bmpTrasparentRed, bmpTrasparentGreen, bmpTrasparentBlue; int fontSize; CString fontType, bmpFullPath, strBmpFileName; Hide(); m_strConfigFilePath = szFileName; CIni ini(szFileName, _T("CONFIG")); _tcsncpy(szConfigDir, szFileName, _countof(szConfigDir)); szConfigDir[_countof(szConfigDir)-1] = _T('\0'); LPTSTR pszFileName = _tcsrchr(szConfigDir, _T('\\')); if (pszFileName == NULL) return FALSE; *(pszFileName + 1) = _T('\0'); nRed = ini.GetInt(_T("TextNormalRed"),255); nGreen = ini.GetInt(_T("TextNormalGreen"),255); nBlue = ini.GetInt(_T("TextNormalBlue"),255); sRed = ini.GetInt(_T("TextSelectedRed"),255); sGreen = ini.GetInt(_T("TextSelectedGreen"),255); sBlue = ini.GetInt(_T("TextSelectedBlue"),255); bmpTrasparentRed = ini.GetInt(_T("bmpTrasparentRed"),255); bmpTrasparentGreen = ini.GetInt(_T("bmpTrasparentGreen"),0); bmpTrasparentBlue = ini.GetInt(_T("bmpTrasparentBlue"),255); fontType = ini.GetString(_T("FontType"), _T("MS Shell Dlg")); fontSize = ini.GetInt(_T("FontSize"), 8) * 10; m_dwTimeToStay = ini.GetInt(_T("TimeToStay"), 4000); m_dwTimeToShow = ini.GetInt(_T("TimeToShow"), 500); m_dwTimeToHide = ini.GetInt(_T("TimeToHide"), 200); strBmpFileName = ini.GetString(_T("bmpFileName"), _T("")); if (!strBmpFileName.IsEmpty()) { if (PathIsRelative(strBmpFileName)) bmpFullPath.Format(_T("%s%s"), szConfigDir, strBmpFileName); else bmpFullPath = strBmpFileName; } // get text rectangle coordinates rcLeft = ini.GetInt(_T("rcTextLeft"),5); rcTop = ini.GetInt(_T("rcTextTop"),45); rcRight = ini.GetInt(_T("rcTextRight"),220 ); rcBottom = ini.GetInt(_T("rcTextBottom"), 85); if (rcLeft<=0) rcLeft=1; if (rcTop<=0) rcTop=1; if (rcRight<=0) rcRight=1; if (rcBottom<=0) rcBottom=1; SetTextRect(CRect(rcLeft,rcTop,rcRight,rcBottom)); // get close button rectangle coordinates rcLeft = ini.GetInt(_T("rcCloseBtnLeft"),286); rcTop = ini.GetInt(_T("rcCloseBtnTop"),40); rcRight = ini.GetInt(_T("rcCloseBtnRight"), 300); rcBottom = ini.GetInt(_T("rcCloseBtnBottom"), 54); if (rcLeft<=0) rcLeft=1; if (rcTop<=0) rcTop=1; if (rcRight<=0) rcRight=1; if (rcBottom<=0) rcBottom=1; SetCloseBtnRect(CRect(rcLeft,rcTop,rcRight,rcBottom)); // get history button rectangle coordinates rcLeft = ini.GetInt(_T("rcHistoryBtnLeft"),283); rcTop = ini.GetInt(_T("rcHistoryBtnTop"),14); rcRight = ini.GetInt(_T("rcHistoryBtnRight"), 299); rcBottom = ini.GetInt(_T("rcHistoryBtnBottom"), 39); if (rcLeft<=0) rcLeft=1; if (rcTop<=0) rcTop=1; if (rcRight<=0) rcRight=1; if (rcBottom<=0) rcBottom=1; SetHistoryBtnRect(CRect(rcLeft,rcTop,rcRight,rcBottom)); if (bmpFullPath.IsEmpty() || !SetBitmap(bmpFullPath, bmpTrasparentRed, bmpTrasparentGreen, bmpTrasparentBlue)) { CEnBitmap imgTaskbar; if (imgTaskbar.LoadImage(IDR_TASKBAR, _T("GIF"))) { if (!SetBitmap(&imgTaskbar, bmpTrasparentRed, bmpTrasparentGreen, bmpTrasparentBlue)) return FALSE; } } SetTextFont(fontType, fontSize, TN_TEXT_NORMAL,TN_TEXT_UNDERLINE); SetTextColor(RGB(nRed, nGreen, nBlue), RGB(sRed, sGreen, sBlue)); return TRUE; }
void EditorTextView::FrameResized(float new_width, float new_height) { SetTextRect(BRect(0, 0, new_width, new_height)); }