Beispiel #1
0
 Base::NString CombinePath(const Base::NString& path, const Base::NString& pathAfter)
 {
     if(path.GetLength() == 0)
         return pathAfter;
     Base::NString result = path + _T("\\") + pathAfter;
     result.Replace(_T("/"), _T("\\")).Replace(_T("\\\\"), _T("\\"));
     return result;
 }
Beispiel #2
0
        NEdit* NEdit::ShowTooltip(TooltipIconType iconType, LPCTSTR szTitle, LPCTSTR szText)
        {
            NAssertError(IsWndValid(), _T("call parent->AddChild first"));
            if(!IsWndValid())
                return this;

            nui::Base::NInstPtr<nui::Data::NStringBundle> stringBundle(MemToolParam);
            Base::NString strTitle = stringBundle->GetString(szTitle);
            Base::NString strText = stringBundle->GetString(szText);

            EDITBALLOONTIP tip = {sizeof(EDITBALLOONTIP)};
            tip.pszText = strText.GetData();
            tip.pszTitle = strTitle.GetData();
            tip.ttiIcon = iconType;
            ::SendMessage(realWindow_, EM_SHOWBALLOONTIP, 0, (LPARAM)&tip);
            return this;
        }
Beispiel #3
0
        void NRenderStatus::DrawStatus()
        {
            DWORD currentTime = ::GetTickCount();

            Base::NString status;
            if(currentTime <= lastTime_)
                status.Format(_T("Index: %d\r\nFPS: MAX"), ++ index_);
            else
                status.Format(_T("Index: %d\r\nFPS: %.2f"), ++ index_, (double)1000 / (currentTime - lastTime_));

            lastTime_ = currentTime;

            Base::NRect rcClient;
            ::GetClientRect(hWnd_, rcClient);

            HDC hDc = ::GetDC(hWnd_);

            Base::NRect rcText(rcClient);
            ::DrawText(hDc, status.GetData(), status.GetLength(), rcText, DT_EDITCONTROL | DT_CALCRECT);
            rcText.Offset(rcClient.Width() - rcText.Width() - 8, 8);

            CAlphaDC alphaDc;
            if(alphaDc.Init(hDc, rcText, rcClient.GetSize(), true))
            {
                ::SetBkColor(alphaDc, RGB(255, 255, 0));
                ::SetBkMode(alphaDc, OPAQUE);
                ::DrawText(alphaDc, status.GetData(), status.GetLength(), rcText, DT_EDITCONTROL);

                alphaDc.EndDraw(255);
            }
            ::ReleaseDC(hWnd_, hDc);
        }
Beispiel #4
0
 void NRichFrame::SetText(const Base::NString& text)
 {
     if(text.IsEmpty() && text_  == NULL)
         return;
     if(text_ == NULL)
     {
         text_ = NUiBus::Instance().GetResourceLoader()->CreateText(text, MemToolParam);
     }
     else
     {
         if(text_->GetText() == text)
             return;
         text_->SetText(text);
     }
     AutoSize();
     Invalidate();
 }