///////////////////////////////////////////////////////////////////////////////
// PreSubclassWindow
void CXHyperLink::PreSubclassWindow() 
{
	// We want to get mouse clicks via STN_CLICKED
	DWORD dwStyle = GetStyle();
	::SetWindowLong(GetSafeHwnd(), GWL_STYLE, dwStyle | SS_NOTIFY);
	
	// Set the URL as the window text
	if (m_strURL.IsEmpty())
		GetWindowText(m_strURL);

	// Check that the window text isn't empty. If it is, set it as the URL.
	CString strWndText;
	GetWindowText(strWndText);
	if (strWndText.IsEmpty()) 
	{
		ASSERT(!m_strURL.IsEmpty());	// Window and URL both NULL. DUH!
		SetWindowText(m_strURL);
	}

	CFont* pFont = GetFont();
	if (!pFont)
	{
		HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
		if (hFont == NULL)
			hFont = (HFONT) GetStockObject(ANSI_VAR_FONT);
		if (hFont)
			pFont = CFont::FromHandle(hFont);
	}
	ASSERT(pFont->GetSafeHandle());

	// Create the underline font
	LOGFONT lf;
	pFont->GetLogFont(&lf);
	m_StdFont.CreateFontIndirect(&lf);
	lf.lfUnderline = (BYTE) TRUE;
	m_UnderlineFont.CreateFontIndirect(&lf);

	PositionWindow();		// Adjust size of window to fit URL if necessary
	SetDefaultCursor();		// Try and load up a "hand" cursor
	SetUnderline();

	// Create the tooltip
	if (m_bToolTip)
	{
		CRect rect; 
		GetClientRect(rect);
		m_ToolTip.Create(this);
		m_ToolTip.AddTool(this, m_strURL, rect, TOOLTIP_ID);
	}

	CStatic::PreSubclassWindow();
}
Example #2
0
bool nuiHyperLink::MouseUnclicked(nuiSize X, nuiSize Y, nglMouseInfo::Flags Button)
{
  if (mClicked && (Button & nglMouseInfo::ButtonLeft))
  {
    mClicked--;
    Ungrab();
    if (!Activated())
    {
      // Open url in default browser
      nuiURL url(mURL);
      url.OpenBrowser();
      SetUnderline(false);
    }
    return true;
  }
  return false;
}
/// Updates the contents of the FontSetting object
/// @param faceName Face name of the font
/// @param pointSize Height of the font, in points
/// @param weight Weight of the font (see .h for values)
/// @param italic Make the font italic style
/// @param underline Make the font underline style
/// @param strikeOut Make the font strikeout style
/// @param color Color to draw the font with
/// @return success or failure
bool FontSetting::SetFontSetting(const wxChar* faceName, wxInt32 pointSize, wxInt32 weight, bool italic, bool underline, bool strikeOut, wxColor color)
{
    //------Last Checked------//
    // - Dec 6, 2004
    if (!SetFaceName(faceName))
        return (false);
    if (!SetPointSize(pointSize))
        return (false);
    if (!SetWeight(weight))
        return (false);
    SetItalic(italic);
    SetUnderline(underline);
    SetStrikeOut(strikeOut);
    SetColor(color);
    
    return (true);
}
    void Init()
        {
        if (!CCoeEnv::Static())
            {
            return;
            }
		
        const CAknLayoutFont* font = AknLayoutUtils::LayoutFontFromId(FontStyleId(), NULL);
        THuiFont huiFont(FontStyleId(), font->FontSpecInTwips());
    
        // transfer the text pane height between the different font specs
        TAknFontSpecification aknFs = font->FontSpecification();
        huiFont.SetTextPaneHeight(aknFs.TextPaneHeight());
        SetUnderline(EFalse);
        SetStrikeThrough(EFalse);
        SetTextColor(KRgbBlack);
        SetFont(&huiFont);
        }
Example #5
0
void CHyperLink::PreSubclassWindow() 
{
    // Enable notifications - CStatic has this disabled by default
    DWORD dwStyle = GetStyle();
    ::SetWindowLong(GetSafeHwnd(), GWL_STYLE, dwStyle | SS_NOTIFY);
    
    // By default use the label text as the URL
    if (m_strURL.IsEmpty())
        GetWindowText(m_strURL);

    CString strWndText;
    GetWindowText(strWndText);
    if (strWndText.IsEmpty()) 
    {
        SetWindowText(m_strURL);
    }

	CFont* pFont = GetFont();
	if (!pFont)
	{
		HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
		if (hFont == NULL)
			hFont = (HFONT) GetStockObject(ANSI_VAR_FONT);
		if (hFont)
			pFont = CFont::FromHandle(hFont);
	}
	ASSERT(pFont->GetSafeHandle());

    LOGFONT lf;
    pFont->GetLogFont(&lf);
	m_StdFont.CreateFontIndirect(&lf);
    lf.lfUnderline = (BYTE) TRUE;
    m_UnderlineFont.CreateFontIndirect(&lf);

    SetDefaultCursor();      // try loading a "hand" cursor
    SetUnderline();

    CRect rect; 
    GetClientRect(rect);
    m_ToolTip.Create(this);
    m_ToolTip.AddTool(this, m_strURL, rect, TOOLTIP_ID);

    CStatic::PreSubclassWindow();
}
Example #6
0
void CHyperLink::PreSubclassWindow()
{
	// Enable notifications - CStatic has this disabled by default
	ModifyStyle(0, SS_NOTIFY);

	// By default use the label text as the URL
	if (m_strURL.IsEmpty())
		GetWindowText(m_strURL);

	CString strWndText;
	GetWindowText(strWndText);
	if (strWndText.IsEmpty())
	{
		SetWindowText(m_strURL);
	}

	LOGFONT lf;
	CFont* pFont = GetFont();
	if (pFont)
		pFont->GetObject(sizeof(lf), &lf);
	else
	{
		NONCLIENTMETRICS metrics = { 0 };
		metrics.cbSize = sizeof(NONCLIENTMETRICS);
		SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &metrics, FALSE);
		memcpy_s(&lf, sizeof(LOGFONT), &metrics.lfMessageFont, sizeof(LOGFONT));
	}
	m_StdFont.CreateFontIndirect(&lf);
	lf.lfUnderline = TRUE;
	m_UnderlineFont.CreateFontIndirect(&lf);

	SetDefaultCursor(); // try loading a "hand" cursor
	SetUnderline();

	CRect rect;
	GetClientRect(rect);
	m_ToolTip.Create(this);
	m_ToolTip.AddTool(this, m_strURL, rect, TOOLTIP_ID);

	CStatic::PreSubclassWindow();
}
Example #7
0
void nuiHyperLink::SetHover(bool Hover)
{
  SetUnderline(Hover);
}
Example #8
0
bool CTerminal::PrintFormattedChar(int c)
{
    if( FOut == NULL ) return(false);

    // levels
    // 12
    // <c>
    // </c>
    // 134

    if( c == '<' ) {
        if( CommandLevel == 1 ) {
            fprintf(FOut,"%c",(char)c);
            BlockCount++;
            Command.str("");
            Command.clear();
            CommandLevel = 0;
            return(true);
        }
        if( CommandLevel != 0 ) {
            fprintf(FOut,"%s","!formating error!");
            Command.str("");
            Command.clear();
            CommandLevel = 0;
            return(false);
        }
        CommandLevel = 1;
        return(true);
    }

    if( c == '/' ) {
        if( CommandLevel == 0 ) {
            fprintf(FOut,"%c",(char)c);
            BlockCount++;
            return(true);
        }
        if( CommandLevel != 1 ) {
            fprintf(FOut,"%s","!formating error1!");
            Command.str("");
            Command.clear();
            CommandLevel = 0;
            return(false);
        }
        CommandLevel = 3;
        return(true);
    }
    if( c == '>' ) {
        if( CommandLevel == 0 ) {
            fprintf(FOut,"%c",(char)c);
            BlockCount++;
            return(true);
        }
        if( (CommandLevel != 2) && (CommandLevel != 4) ) {
            fprintf(FOut,"%s","!formating error2!");
            Command.str("");
            Command.clear();
            CommandLevel = 0;
            return(false);
        }

        std::string cmd = Command.str();

        // apply command
        if( CommandLevel == 2 ) {
            if( cmd == "b" ) {
                SetBold(true);
            } else if ( cmd == "u" ) {
                SetUnderline(true);
            } else if ( cmd == "i" ) {
                SetItalic(true);

            } else if ( cmd == "black" ) {
                SetColors(EC_BLACK);
            } else if ( cmd == "red" ) {
                SetColors(EC_RED);
            } else if ( cmd == "green" ) {
                SetColors(EC_GREEN);
            } else if ( cmd == "yellow" ) {
                SetColors(EC_YELLOW);
            } else if ( cmd == "blue" ) {
                SetColors(EC_BLUE);
            } else if ( cmd == "purple" ) {
                SetColors(EC_PURPLE);
            } else if ( cmd == "cyan" ) {
                SetColors(EC_CYAN);
            } else if ( cmd == "white" ) {
                SetColors(EC_WHITE);
            } else if ( cmd.find("block") == 0 ) {
                BlockMode = true;
                std::string tmp;
                LeftOffset = 0;
                BlockCount = 0;
                Command >> tmp >> LeftOffset;
                for(int i=0; i < LeftOffset; i++ ) fprintf(FOut," ");
            }
        }

        // revers command
        if( CommandLevel == 4 ) {
            if( cmd == "b" ) {
                SetBold(false);
            } else if ( cmd == "u" ) {
                SetUnderline(false);
            } else if ( cmd == "i" ) {
                SetItalic(false);

            } else if ( cmd == "black" ) {
                SetDefault();
            } else if ( cmd == "red" ) {
                SetDefault();
            } else if ( cmd == "green" ) {
                SetDefault();
            } else if ( cmd == "yellow" ) {
                SetDefault();
            } else if ( cmd == "blue" ) {
                SetDefault();
            } else if ( cmd == "purple" ) {
                SetDefault();
            } else if ( cmd == "cyan" ) {
                SetDefault();
            } else if ( cmd == "white" ) {
                SetDefault();
            } else if ( cmd == "block" ) {
                BlockMode = false;
                LeftOffset = 0;
            }
        }

        Command.str("");
        Command.clear();
        CommandLevel = 0;
        return(true);
    }