示例#1
0
文件: menu.cpp 项目: 3v1n0/wxWidgets
wxMenu::wxMenu(const wxString& title, long style)
    : wxMenuBase( title, style )
{
    m_qtMenu = new QMenu( wxQtConvertString( title ));

    ApplyStyle( m_qtMenu, style );
}
示例#2
0
void RichTxt::Apply(const RichText::FormatInfo& fi, RichPara& pa, const RichStyles& style)
{
	ApplyStyle(fi, pa, style);
	for(int i = 0; i < pa.GetCount(); i++)
		fi.ApplyTo(pa[i].format);
	fi.ApplyTo(pa.format);
}
示例#3
0
文件: menu.cpp 项目: 3v1n0/wxWidgets
wxMenu::wxMenu(long style)
    : wxMenuBase( style )
{
    m_qtMenu = new QMenu();

    ApplyStyle( m_qtMenu, style );
}
示例#4
0
bool RTFparfmt::ApplyStyle(int iStyleNumber, RTFstylesheet* pStylesheet, bool bNumberIsIndex)
{
	int iStyleDef = bNumberIsIndex ? iStyleNumber : pStylesheet->FindStyleByNumber(iStyleNumber);

	if (iStyleDef < 0)
	{
		CHECK_CONDITION_NOT_EXPECTED;
		return false;
	}

	RTFstyle* pStyle = pStylesheet->GetStyle(iStyleDef);

	THROW_ABOUT_TO_USE_NULL_POINTER(pStyle,_T("Have a NULL style"));

	RTFformatting* pFormat = pStyle->GetFormatting();

	THROW_ABOUT_TO_USE_NULL_POINTER(pStyle,_T("Have a NULL format"));

	const RTFparfmt* pStyleDef = pFormat->GetParfmt();

	if (pStyleDef == NULL)
		return false;
	
	ApplyStyle(pStyleDef, pStyle->m_StyleParam);
	m_iStyle = pStyle->m_StyleParam;	// doesn't get passed to the chrfmt in the formatting in the style.
	GetFileContext()->sm_iPersistStyleIntoTextboxAsWordFailsToDoSo = m_iStyle;

	return true;
}
示例#5
0
void wxRichTextStyleListBox::OnLeftDoubleClick(wxMouseEvent& event)
{
    wxVListBox::OnLeftDown(event);

    int item = HitTest(event.GetPosition());
    if (item != wxNOT_FOUND && !GetApplyOnSelection())
        ApplyStyle(item);
}
示例#6
0
文件: NEditImpl.cpp 项目: hufuman/nui
        void NEdit::OnCreate()
        {
            __super::OnCreate();

#ifndef _NO_NUI_PARSER_
            NAssertTempDisable();
            ApplyStyle(_T("@sys_default_style:edit"));
#endif  // _NO_NUI_PARSER_
        }
示例#7
0
bool CInformationPanel::SetFont(const TVTest::Style::Font &Font)
{
	m_StyleFont=Font;

	if (m_hwnd!=NULL) {
		ApplyStyle();
		RealizeStyle();
	}

	return true;
}
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
void LanguageSettings::Apply(ScintillaEdit &scintilla) const
{
  scintilla.SetLexer(lexerId);
  scintilla.SetStyleBits(styleBits);

  scintilla.SetTabWidth(tabWidth);
  scintilla.SetUseTabs(!tabsToSpaces);

  int i;
  int count = GetKeywordSetCount();
  for (i = 0; i < count; ++i)
  {
    const KeywordSet *set = GetKeywordSet(i);
    if (set->keywords)
      scintilla.SetKeywords(set->setId, set->keywords);
  }

//  scintilla.SetWhiteSpaceBGColour(true, defaultBackground);
//  scintilla.SetWhiteSpaceFGColour(true, defaultForeground);

  ApplyStyle(scintilla, defaultStyle);
  /// Copy default style to all.
  scintilla.StyleClearAll();

  scintilla.SetCaretColour(defaultStyle.foreground);
  scintilla.SetSelectionBGColour(true, defaultStyle.foreground);
  scintilla.SetSelectionFGColour(true, defaultStyle.background);

  count = GetStyleCount();
  for (i = 0; i < count; ++i)
  {
    const StyleSettings *style = GetStyle(i);
    ASSERT(style);
    ApplyStyle(scintilla, *style);
  }

  scintilla.Colourise(0, -1);
}
void GUI_Element::UpdateStyle(const GUI_ElementState& l_state, 
	const GUI_Style& l_style)
{
	// Resource management.
	if (l_style.m_backgroundImage != m_style[l_state].m_backgroundImage){
		ReleaseTexture(m_style[l_state].m_backgroundImage);
		RequireTexture(l_style.m_backgroundImage);
	}

	if (l_style.m_glyph != m_style[l_state].m_glyph){
		ReleaseTexture(m_style[l_state].m_glyph);
		RequireTexture(l_style.m_glyph);
	}

	if (l_style.m_textFont != m_style[l_state].m_textFont){
		ReleaseFont(m_style[l_state].m_textFont);
		RequireFont(l_style.m_textFont);
	}
	// Style application.
	m_style[l_state] = l_style;
	if (l_state == m_state){ SetRedraw(true); ApplyStyle(); }
}
示例#10
0
void Styler_SearchHL::Style(StyleRun& sr) {
	const unsigned int rstart =  sr.GetRunStart();
	const unsigned int rend = sr.GetRunEnd();

	// Style the run with search ranges
	for (vector<interval>::const_iterator r = m_searchRanges.begin(); r != m_searchRanges.end(); ++r) {
		if (r->end > rstart && r->start < rend) {
			unsigned int start = wxMax(rstart, r->start);
			unsigned int end   = wxMin(rend, r->end);
			sr.SetBackgroundColor(start, end, m_rangeColor);
		}
	}

	// No need for more styling if no search text
	if (m_text.empty()) return;

	// Extend stylerun start/end to get better search results (round up to whole EXTSIZEs)
	unsigned int sr_start = rstart> 100 ? rstart - 100 : 0;
	const unsigned int ext_end = ((rend/EXTSIZE) * EXTSIZE) + EXTSIZE;
	unsigned int sr_end = ext_end < m_lines.GetLength() ? ext_end : m_lines.GetLength();

	// Make sure the extended positions are valid
	cxLOCKDOC_READ(m_doc)
		sr_start = doc.GetValidCharPos(sr_start);
		if (sr_end != m_lines.GetLength()) sr_end = doc.GetValidCharPos(sr_end);
	cxENDLOCK

	//wxLogDebug("Style %u %u", rstart, rend);
	//wxLogDebug(" %u %u - %u %u", sr_start, sr_end, m_search_start, m_search_end);
	// Check if we need to do a new search
	if (sr_start < m_search_start || m_search_end < sr_end) {
		// Check if there is overlap so we can just extend the search area
		if (sr_end > m_search_start && sr_start < m_search_end) {
			sr_start = wxMin(sr_start, m_search_start);
			sr_end = wxMax(sr_end, m_search_end);
		}
		else {
			// Else we have to move it
			m_matches.clear();
			m_search_start = 0;
			m_search_end = 0;
		}

		// Do the search
		if (sr_start < m_search_start) {
			// Search from top
			DoSearch(sr_start, sr_end);
		}
		else if (sr_end > m_search_end) {
			// Search from bottom
			DoSearch(sr_start, sr_end, true);
		}
		else wxASSERT(false);

		m_search_start = sr_start;
		m_search_end = sr_end;
	}

	// Style the run with matches
	for (vector<interval>::iterator p = m_matches.begin(); p != m_matches.end(); ++p) {
		if (p->start > rend) break;

		// Check for overlap (or zero-length sel at start-of-line)
		if ((p->end > rstart && p->start < rend) || (p->start == p->end && p->end == rstart)) {
			unsigned int start = wxMax(rstart, p->start);
			unsigned int end   = wxMin(rend, p->end);

			// Only draw it if it is in range
			if (!m_searchRanges.empty()) {
				bool inRange = false;
				for (vector<interval>::const_iterator s = m_searchRanges.begin(); s != m_searchRanges.end(); ++s) {
					if (start >= s->start && start < s->end) {
						inRange = true;
						break;
					}
				}
				if (!inRange) continue;
			}
			
			ApplyStyle(sr, start, end);
		}
	}
}