Пример #1
1
void ViewerWindow::setSizeFullScreenWindow()
{
	// Save position of window.
	GetWindowPlacement(m_hWnd, &m_workArea);

	// Get size of desktop.
	HMONITOR hmon = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
	MONITORINFO mi;
	mi.cbSize = sizeof(mi);

	RECT fullScreenWindowsRect;
	if (!!GetMonitorInfo(hmon, &mi)) {
		fullScreenWindowsRect = mi.rcMonitor;
	}
	else {
		m_logWriter.warning(_T("Get monitor info is failed. Use second method (no multi-screen)."));
		GetWindowRect(GetDesktopWindow(), &fullScreenWindowsRect);
	}
	Rect fullScreenRect;
	fullScreenRect.fromWindowsRect(&fullScreenWindowsRect);
	m_logWriter.detail(_T("full screen window rect: %d, %d; %d, %d"),
		fullScreenRect.left, fullScreenRect.top,
		fullScreenRect.getWidth(), fullScreenRect.getHeight());

	setStyle((getStyle() | WS_MAXIMIZE) & ~(WS_CAPTION | WS_BORDER | WS_THICKFRAME | WS_MAXIMIZEBOX));
	setExStyle(getExStyle() | WS_EX_TOPMOST);

	SetWindowPos(m_hWnd, 0,
		fullScreenRect.left, fullScreenRect.top,
		fullScreenRect.getWidth(), fullScreenRect.getHeight(),
		SWP_SHOWWINDOW);
}
Пример #2
0
/* StyleSet::applyTo
 * Applies all the styles in this set to the text styles in scintilla
 * text control [stc]
 *******************************************************************/
void StyleSet::applyTo(TextEditor* stc)
{
	// Set default style
	ts_default.applyTo(stc);

	// Apply default style to all
	stc->StyleClearAll();

	// Apply other styles
	for (unsigned a = 0; a < styles.size(); a++)
		styles[a]->applyTo(stc);

	// Set selection background if customised
	if (ts_selection.hasBackground())
		stc->SetSelBackground(true, WXCOL(ts_selection.background));
	else
		stc->SetSelBackground(false, wxColour("red"));

	// Set selection foreground if customised
	if (ts_selection.hasForeground())
		stc->SetSelForeground(true, WXCOL(ts_selection.foreground));
	else
		stc->SetSelForeground(false, wxColour("red"));

	// Set caret colour to text foreground colour
	stc->SetCaretForeground(WXCOL(ts_default.foreground));

	// Update code folding margin
	stc->setupFoldMargin(getStyle("foldmargin"));

	// Set indent and right margin line colour
	stc->SetEdgeColour(WXCOL(getStyle("guides")->getForeground()));
	stc->StyleSetBackground(wxSTC_STYLE_INDENTGUIDE, WXCOL(getStyleBackground("guides")));
	stc->StyleSetForeground(wxSTC_STYLE_INDENTGUIDE, WXCOL(getStyleForeground("guides")));
}
Пример #3
0
void QtZigzag::draw(QPainter &painter) const {
    Point2D tl = Zigzag::center - Zigzag::size * 0.5;
    Point2D br = Zigzag::center + Zigzag::size * 0.5;
    Color p = getStyle().lineColor;
    Color f = getStyle().fillColor;
    if (isSelected()) f.alpha = 0.5;
    painter.setPen(QColor(p.red * 255, p.green * 255, p.blue * 255, p.alpha * 255));
    painter.setBrush(QBrush(QColor(f.red * 255, f.green * 255, f.blue * 255, f.alpha * 255)));

    float partLine = (br.x - tl.x) / (float)pointsAmount;

    QPointF *points = new QPointF[pointsAmount];

    for(int i = 0; i < pointsAmount; i++) {

        points[i].setX(tl.x + i*partLine);

        if (i % 2) {
            points[i].setY(tl.y);
        } else {
            points[i].setY(br.y);
        }
    }

    painter.drawPolyline(points, pointsAmount);

    if(selected) {
        painter.setBrush(QBrush(QColor(255, 180, 120)));
        painter.drawEllipse(QPoint(tl.x, tl.y), 2, 2);
        painter.drawEllipse(QPoint(br.x, br.y), 2, 2);

    }
}
Пример #4
0
        FormIO(GUI::Context& mCtx)
            : GUI::Form{mCtx, "IO", Vec2f{300.f, 300.f}, Vec2f{100.f, 100.f}},
              mainStrip(create<GUI::Strip>(
                  GUI::At::Top, GUI::At::Bottom, GUI::At::Bottom)),
              lblCurrentPath(mainStrip.create<GUI::Label>("CURRENT: null")),
              tboxFilename(mainStrip.create<GUI::TextBox>(
                  getStyle().getBtnSizePerChar(14))),
              stripBtns(mainStrip.create<GUI::Strip>(
                  GUI::At::Left, GUI::At::Right, GUI::At::Right)),
              btnSave(stripBtns.create<GUI::Button>(
                  "save", getStyle().getBtnSizePerChar(6))),
              btnLoad(stripBtns.create<GUI::Button>(
                  "load", getStyle().getBtnSizePerChar(6)))
        {
            setScaling(GUI::Scaling::FitToChildren);
            setResizable(false);
            setPadding(2.f);

            mainStrip.attach(GUI::At::Center, *this, GUI::At::Center);
            mainStrip.setPadding(2.f);

            tboxFilename.setString("./level.lvl");

            btnSave.onLeftClick += [this]
            {
                if(!tboxFilename.getString().empty())
                    onSave(tboxFilename.getString());
            };
            btnLoad.onLeftClick += [this]
            {
                if(!tboxFilename.getString().empty())
                    onLoad(tboxFilename.getString());
            };
        }
Пример #5
0
void StylesPlugin::setStyles()
{
    QStyle *style = NULL;
#if QT_VERSION >= 300
    if (*getStyle())
        style = QStyleFactory::create(getStyle());
#else
if (*getStyle()){
    string s = getStyle();
    if (s == "windows"){
        style = new QWindowsStyle;
    }else if (s == "motif"){
        style = new QMotifStyle;
    }else if (s == "cde"){
        style = new QCDEStyle;
    }else if (s == "motifplus"){
        style = new QMotifPlusStyle;
    }else if (s == "platinum"){
        style = new QPlatinumStyle;
    }else if (s == "sgi"){
        style = new QSGIStyle;
#ifdef WIN32
    }else{
        bool bOK = true;
        if (s == "xpstyle"){
            HINSTANCE hLib = LoadLibraryA("UxTheme.dll");
            if (hLib){
                FreeLibrary(hLib);
            }else{
                bOK = false;
            }
        }
        if (bOK){
            string dll = "plugins\\styles\\";
            dll += s;
            dll += ".dll";
            HINSTANCE hLib = LoadLibraryA(app_file(dll.c_str()).c_str());
            if (hLib){
                StyleInfo*  (*getStyleInfo)() = NULL;
                (DWORD&)getStyleInfo = (DWORD)GetProcAddress(hLib,"GetStyleInfo");
                if (getStyleInfo){
                    StyleInfo *info = getStyleInfo();
                    if (info && info->create)
                        style = info->create();
                }
            }
        }
#endif
    }
}
#endif
    if (style){
        QApplication::setStyle(style);
        if (!getSystemColors())
            setColors();
    }else{
        setStyle(NULL);
    }
}
Пример #6
0
TPalette::~TPalette() {
  std::set<TColorStyle *> table;
  int i = 0;
  for (i = 0; i < getStyleCount(); i++) {
    assert(table.find(getStyle(i)) == table.end());
    table.insert(getStyle(i));
  }
  clearPointerContainer(m_pages);
}
Пример #7
0
ChEXPORT void WrdStyleSheet::resolve (WrdParagraphProperties& io_paraProps) const
{
    ChUINT2 unStyleIndex = io_paraProps.getParagraphStyleIndex();

    // Design-wise, a more elegant solution is to access the first base style,
    // and then apply the derived style's properties on top of the base style, 
    // and recursively do this, until lastly, the delta paragraph properties
    // are applied. However, to do this elegantly requires using recursion, 
    // and also requires the creation of an additional WrdParagraphProperties
    // structure which contains the base style and the derived style's merged
    // results. Given the need to minimize stack usage and heap memory, the
    // alternative is to traverse the style's backwards and apply all 
    // changes directly to the delta set of properties. Thus, we get the 
    // style that the delta references, apply its properties, then get the
    // base style, and apply its properties, and go upwards to the top-most 
    // style.
    do
    {
        const WrdStyle&               style = getStyle(unStyleIndex);
        const WrdParagraphProperties& styleParaProps = style.getResolvedParaProps();

        io_paraProps.applyBaseProperties(styleParaProps);

        ChUINT2 unBaseStyleIndex = style.getBaseStyleIndex();
        if (unBaseStyleIndex == unStyleIndex)
        {
            // Stop processing if the style's base refers to itself.
            break;
        }
        unStyleIndex = unBaseStyleIndex;
    }
    while (unStyleIndex != 0x0FFF);

    // If there is a table style index override, use that ALSO.	(otherwise can miss lists).
    if (io_paraProps.isTableStyleIndexOverridden() == 1)
    {
        unStyleIndex = io_paraProps.getTableStyleIndex();
		do
		{
			const WrdStyle&               style = getStyle(unStyleIndex);
			const WrdParagraphProperties& styleParaProps = style.getResolvedParaProps();

			io_paraProps.applyBaseProperties(styleParaProps);

			ChUINT2 unBaseStyleIndex = style.getBaseStyleIndex();
			if (unBaseStyleIndex == unStyleIndex)
			{
				// Stop processing if the style's base refers to itself.
				break;
			}
			unStyleIndex = unBaseStyleIndex;
		}
		while (unStyleIndex != 0x0FFF);
    }
}
Пример #8
0
void YGNode::resolveDimension() {
  for (uint32_t dim = YGDimensionWidth; dim < YGDimensionCount; dim++) {
    if (getStyle().maxDimensions[dim].unit != YGUnitUndefined &&
        YGValueEqual(
            getStyle().maxDimensions[dim], style_.minDimensions[dim])) {
      resolvedDimensions_[dim] = style_.maxDimensions[dim];
    } else {
      resolvedDimensions_[dim] = style_.dimensions[dim];
    }
  }
}
    void TextBlock::specialDraw() const
    {
        // Super call
        Block::specialDraw();

        // Draw text (emulation of shader bevavior for color mixing)
        glm::vec4 color = getStyle()->fontColor;
        color.a *= mAlpha;
        color *= (1.0f - mDimming.getValue()) + (mDimming.getValue() * getStyle()->dimColor);
        mupTextFlow->draw(1.0f, color);
    }
Пример #10
0
void scigraphics::sequence::graphViewPoints::drawUnorderedByX( painter &Painter, const pairScales& Scales, sequence::data::iterator Begin, sequence::data::iterator End ) const
{
  if ( getStyle().getShape() == pointStyle::None )
    return;

  for ( sequence::data::iterator Point = Begin; Point != End; ++Point )
  {
    if ( ! Point->isValid() )
      continue;
    const fpoint FPoint = Scales.npoint2fpoint( npoint(*Point) );
    Painter.drawPointF( FPoint, getStyle() );
  }
}
Пример #11
0
QString MupElement::tagAttributs(){
    QString attributes;

    if(!getLabel().isEmpty())
        attributes += toHtmlAttribute("id", getLabel());

    //qDebug() << attributes;

    if(!getStyle().isEmpty())
        attributes += toHtmlAttribute("style", getStyle());

    //qDebug() << getStyle() << attributes;

    return attributes;
}
Пример #12
0
void RTFDocVisitor::visit(DocInclude *inc)
{
  if (m_hide) return;
  DBG_RTF("{\\comment RTFDocVisitor::visit(DocInclude)}\n");
  switch(inc->type())
  {
   case DocInclude::IncWithLines:
      { 
         m_t << "{" << endl;
         m_t << "\\par" << endl;
         m_t << rtf_Style_Reset << getStyle("CodeExample");
         QFileInfo cfi( inc->file() );
         FileDef fd( cfi.dirPath(), cfi.fileName() );
         Doxygen::parserManager->getParser(inc->extension())
                               ->parseCode(m_ci,inc->context(),
                                           inc->text(),
                                           inc->isExample(),
                                           inc->exampleFile(), &fd);
         m_t << "\\par";
         m_t << "}" << endl;
      }
      break;
   case DocInclude::Include: 
      m_t << "{" << endl;
      m_t << "\\par" << endl;
      m_t << rtf_Style_Reset << getStyle("CodeExample");
      Doxygen::parserManager->getParser(inc->extension())
                            ->parseCode(m_ci,inc->context(),
                                        inc->text(),inc->isExample(),
                                        inc->exampleFile());
      m_t << "\\par";
      m_t << "}" << endl;
      break;
    case DocInclude::DontInclude: 
      break;
    case DocInclude::HtmlInclude: 
      break;
    case DocInclude::VerbInclude: 
      m_t << "{" << endl;
      m_t << "\\par" << endl;
      m_t << rtf_Style_Reset << getStyle("CodeExample");
      filter(inc->text());
      m_t << "\\par";
      m_t << "}" << endl;
      break;
  }
  m_lastIsPara=TRUE;
}
Пример #13
0
//--------------------------------------------------------------
// constructor
mgUglyButton::mgUglyButton(
  mgControl* parent,
  const char* cntlName)
: mgButtonControl(parent, cntlName)
{
  m_mode = MG_BUTTON_UP;

  mgStyle* style = getStyle();

  // assume style has set all our format elements
  style->getFontAttr(MG_STYLE_BUTTON, m_cntlName, "font", m_font);

  style->getFrameAttr(MG_STYLE_BUTTON, m_cntlName, "upFrame", m_upFrame);
  style->getFrameAttr(MG_STYLE_BUTTON, m_cntlName, "hoverFrame", m_hoverFrame);
  style->getFrameAttr(MG_STYLE_BUTTON, m_cntlName, "downFrame", m_downFrame);
  style->getFrameAttr(MG_STYLE_BUTTON, m_cntlName, "disFrame", m_disFrame);

  style->getColorAttr(MG_STYLE_BUTTON, m_cntlName, "upColor", m_upColor);
  style->getColorAttr(MG_STYLE_BUTTON, m_cntlName, "hoverColor", m_hoverColor);
  style->getColorAttr(MG_STYLE_BUTTON, m_cntlName, "downColor", m_downColor);
  style->getColorAttr(MG_STYLE_BUTTON, m_cntlName, "disColor", m_disColor);

  m_actionListeners = NULL;
  addMouseListener((mgMouseListener*) this);
  addFocusListener((mgFocusListener*) this);
}
Пример #14
0
/* StyleSet::getDefaultFontSize
 * Returns the default style font size
 *******************************************************************/
int StyleSet::getDefaultFontSize()
{
	if (txed_override_font != "" && txed_override_font_size > 0)
		return txed_override_font_size;
	else
		return getStyle("default")->getFontSize();
}
Пример #15
0
QString QtZigzag::svgElementCode() const {
    Point2D tl = Zigzag::center - Zigzag::size * 0.5;
    Point2D br = Zigzag::center + Zigzag::size * 0.5;
    Color p = getStyle().lineColor;
    float partLine = (br.x - tl.x) / (float)pointsAmount;

    QString stream = QString("<polyline points=\"");
    float x, y;
    for(int i = 0; i < pointsAmount; i++) {
        x = tl.x + i*partLine;
        if (i % 2) {
            y = tl.y;
        } else {
            y = br.y;
        }

        stream.append("%1,%2 ");
        stream = stream.arg((int)x).arg((int)y);
    }

    stream.append("\" style=\"fill:none;stroke:rgb(%1,%2,%3);stroke-width:2\" />");
    stream = stream.arg(p.red*255).arg(p.green*255).arg(p.blue*255);

    return stream;
}
Пример #16
0
 //GetStyle for compatibility with earlier QGIS versions
 void writeGetStyle( QgsServerInterface *serverIface, const QgsProject *project, const QString &version,
                     const QgsServerRequest &request, QgsServerResponse &response )
 {
   QDomDocument doc = getStyle( serverIface, project, version, request );
   response.setHeader( QStringLiteral( "Content-Type" ), QStringLiteral( "text/xml; charset=utf-8" ) );
   response.write( doc.toByteArray() );
 }
Пример #17
0
//--------------------------------------------------------------
// constructor
mgSimpleField::mgSimpleField(
  mgControl* parent,
  const char* cntlName)
: mgFieldControl(parent, cntlName)
{
  m_displayCount = 20;  // default
  m_cursorPosn = 0;
  m_scrollPosn = 0;
  m_insertMode = true;
  m_changed = false;
  m_history = NULL;  // not enabled

  mgStyle* style = getStyle();

  // assume style has set all our format elements
  style->getFontAttr(MG_STYLE_FIELD, getName(), "font", m_font);

  style->getFrameAttr(MG_STYLE_FIELD, getName(), "upFrame", m_upFrame);
  style->getFrameAttr(MG_STYLE_FIELD, getName(), "hoverFrame", m_hoverFrame);
  style->getFrameAttr(MG_STYLE_FIELD, getName(), "downFrame", m_downFrame);
  style->getFrameAttr(MG_STYLE_FIELD, getName(), "disFrame", m_disFrame);

  style->getColorAttr(MG_STYLE_FIELD, getName(), "upColor", m_upColor);
  style->getColorAttr(MG_STYLE_FIELD, getName(), "hoverColor", m_hoverColor);
  style->getColorAttr(MG_STYLE_FIELD, getName(), "downColor", m_downColor);
  style->getColorAttr(MG_STYLE_FIELD, getName(), "disColor", m_disColor);

  m_hasMouse = false;

  m_changeListeners = NULL;
  addMouseListener((mgMouseListener*) this);
  addKeyListener((mgKeyListener*) this);
  addFocusListener((mgFocusListener*) this);
}
Пример #18
0
//--------------------------------------------------------------
// constructor
mgSimpleWindow::mgSimpleWindow(
  mgSimpleDesktop* desktop,
  mgControl* parent,
  const char* cntlName)
: mgControl(parent, cntlName)
{
  m_desktop = desktop;

  m_contentPane = new mgControl(this);
  new mgColumnLayout(m_contentPane);

  mgStyle* style = getStyle();

  // assume style has set all our format elements
  style->getFontAttr(MG_STYLE_WINDOW, getName(), "font", m_font);

  style->getFrameAttr(MG_STYLE_WINDOW, getName(), "onFrame", m_onFrame);
  style->getColorAttr(MG_STYLE_WINDOW, getName(), "onColor", m_onColor);

  style->getFrameAttr(MG_STYLE_WINDOW, getName(), "offFrame", m_offFrame);
  style->getColorAttr(MG_STYLE_WINDOW, getName(), "offColor", m_offColor);

  addMouseListener(this);

  m_pressMode = PRESS_NONE;

  m_closeBtn = NULL;
  m_maxBtn = NULL;
  m_minBtn = NULL;

  m_flags = 0;
  m_barHeight = 0;
  m_iconsWidth = 0;
  m_iconsHeight = 0;
}
Пример #19
0
void RTFDocVisitor::visitPre(DocParamSect *s)
{
  if (m_hide) return;
  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocParamSect)}\n");
  m_t << "{"; // start param list
  if (!m_lastIsPara) m_t << "\\par" << endl;
  //m_t << "{\\b "; // start bold
  m_t << "{" << rtf_Style["Heading5"]->reference << endl;
  switch(s->type())
  {
    case DocParamSect::Param: 
      m_t << theTranslator->trParameters(); break;
    case DocParamSect::RetVal: 
      m_t << theTranslator->trReturnValues(); break;
    case DocParamSect::Exception: 
      m_t << theTranslator->trExceptions(); break;
    case DocParamSect::TemplateParam: 
      /* TODO: add this 
      m_t << theTranslator->trTemplateParam(); break;
      */
      m_t << "Template Parameters"; break;
    default:
      ASSERT(0);
  }
  m_t << ":";
  m_t << "\\par";
  m_t << "}" << endl;
  incIndentLevel();
  m_t << rtf_Style_Reset << getStyle("DescContinue");
  m_lastIsPara=TRUE;
}
Пример #20
0
UIWidgetPtr UIManager::createWidgetFromOTML(const OTMLNodePtr& widgetNode, const UIWidgetPtr& parent)
{
    OTMLNodePtr originalStyleNode = getStyle(widgetNode->tag());
    if(!originalStyleNode)
        stdext::throw_exception(stdext::format("'%s' is not a defined style", widgetNode->tag()));

    OTMLNodePtr styleNode = originalStyleNode->clone();
    styleNode->merge(widgetNode);

    std::string widgetType = styleNode->valueAt("__class");

    // call widget creation from lua
    UIWidgetPtr widget = g_lua.callGlobalField<UIWidgetPtr>(widgetType, "create");
    if(parent)
        parent->addChild(widget);

    if(widget) {
        widget->callLuaField("onCreate");

        widget->setStyleFromNode(styleNode);

        for(const OTMLNodePtr& childNode : styleNode->children()) {
            if(!childNode->isUnique()) {
                createWidgetFromOTML(childNode, widget);
                styleNode->removeChild(childNode);
            }
        }
    } else
        stdext::throw_exception(stdext::format("unable to create widget of type '%s'", widgetType));

    widget->callLuaField("onSetup");
    return widget;
}
Пример #21
0
/* StyleSet::getDefaultFontFace
 * Returns the default style font face
 *******************************************************************/
string StyleSet::getDefaultFontFace()
{
	if (txed_override_font != "")
		return txed_override_font;
	else
		return getStyle("default")->getFontFace();
}
Пример #22
0
void RTFDocVisitor::visitPre(DocHtmlDescData *)
{
  if (m_hide) return;
  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlDescData)}\n");
  incIndentLevel();
  m_t << "{" << rtf_Style_Reset << getStyle("DescContinue");
}
Пример #23
0
std::string UIManager::getStyleClass(const std::string& styleName)
{
    OTMLNodePtr style = getStyle(styleName);
    if(style && style->get("__class"))
        return style->valueAt("__class");
    return "";
}
    void Button::specialDraw() const
    {
        if(mThreshold.getValue() > 0)
        {
            mpThresholdItem->bind();
            mpThresholdItem->getShader()->fillValue("matrix", mFullDrawMatrix);
            mpThresholdItem->getShader()->fillValue("thresholdColor", getStyle()->thresholdColor);
            mpThresholdItem->getShader()->fillValue("threshold", mThreshold.getValue());
            mpThresholdItem->getShader()->fillValue("alpha", mAlpha);
            if(!mUseCircleThreshold)
            {
                float orientation = 0;
                if (getParent() != NULL)
                {
                    if (getParent()->getOrientation() == Element::Orientation::VERTICAL)
                    {
                        orientation = 1;
                    }
                }
                mpThresholdItem->getShader()->fillValue("orientation", orientation);
            }
            mpThresholdItem->getShader()->fillValue("mask", 0); // mask is always in slot 0
            mpThresholdItem->draw();
        }

		// Super call
		IconElement::specialDraw();
    }
Пример #25
0
void LineCbBox::paintEvent (QPaintEvent *event)
{
	QStyleOption opt;
	opt.initFrom(this);
	QPainter painter(this);
	style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);

	painter.save();

//	painter.setRenderHint(QPainter::Antialiasing);

	QColor ContourColor = Qt::gray;

	if(!isEnabled()) ContourColor = Qt::lightGray;

	QRect r = event->rect();
//	QRect g = rect();
	painter.setBrush(Qt::NoBrush);
	painter.setBackgroundMode(Qt::TransparentMode);

	QPen LinePen(m_Color);
	LinePen.setStyle(getStyle(m_Style));
	LinePen.setWidth(m_Width);
	painter.setPen(LinePen);
	painter.drawLine(r.left()+5, r.height()/2, r.width()-10, r.height()/2);

//	QPen ContourPen(ContourColor);
//	painter.setPen(ContourPen);
//	r.adjust(0,2,-1,-3);
//	painter.drawRoundRect(r,5,40);

	painter.restore();
}
Пример #26
0
// This method creates the control for the first time. It should only be called
// on creation
void LibraryMenuControl::init(QSharedPointer<Library>& library)
{
	destroy();

	if (!winOS->GetLibraryManager())
		return;
	
	getStyle().setFloating(true);
	
	_dropDownMenu = new DropDownMenu();
	
	LibraryMenuItem* toSelect = NULL;
	const QList< QSharedPointer<Library> >& libraries = winOS->GetLibraryManager()->getLibraries();
	QListIterator< QSharedPointer<Library> > iter(libraries);
	while (iter.hasNext())
	{
		QSharedPointer<Library> lib = iter.next();
		LibraryMenuItem* item = new LibraryMenuItem(lib);
		if (lib->getHashKey().startsWith(QT_NT("usr_")) && library != lib)
			item->setDeleteable(true);
		_dropDownMenu->addItem(item);
		if (lib->getHashKey() == library->getHashKey())
			toSelect = item;
	}
	
	BrowseFolderMenuItem* browseFolder = new BrowseFolderMenuItem(QString("More places..."));
	_dropDownMenu->addItem(browseFolder);

	if (toSelect)
		_dropDownMenu->select(toSelect);

	this->addItem(_dropDownMenu);
	scnManager->registerOverlay(this);
	fadeOut(_unHoveredAlpha);
}
Пример #27
0
ATDropdownList::ATDropdownList(){
    twWndStyle style=getStyle();
    style.border=twBS_panel;
    setStyle(style);
    m_drag=false;
    m_selectedIndex=0;
}
Пример #28
0
// Returns true on error.
static bool format(std::string FileName) {
  FileManager Files((FileSystemOptions()));
  DiagnosticsEngine Diagnostics(
      IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs),
      new DiagnosticOptions);
  SourceManager Sources(Diagnostics, Files);
  OwningPtr<MemoryBuffer> Code;
  if (error_code ec = MemoryBuffer::getFileOrSTDIN(FileName, Code)) {
    llvm::errs() << ec.message() << "\n";
    return true;
  }
  if (Code->getBufferSize() == 0)
    return true; // Empty files are formatted correctly.
  FileID ID = createInMemoryFile(FileName, Code.get(), Sources, Files);
  std::vector<CharSourceRange> Ranges;
  if (fillRanges(Sources, ID, Code.get(), Ranges))
    return true;

  FormatStyle FormatStyle = getStyle(Style, FileName);
  Lexer Lex(ID, Sources.getBuffer(ID), Sources,
            getFormattingLangOpts(FormatStyle.Standard));
  tooling::Replacements Replaces = reformat(FormatStyle, Lex, Sources, Ranges);
  if (OutputXML) {
    llvm::outs()
        << "<?xml version='1.0'?>\n<replacements xml:space='preserve'>\n";
    for (tooling::Replacements::const_iterator I = Replaces.begin(),
                                               E = Replaces.end();
         I != E; ++I) {
      llvm::outs() << "<replacement "
                   << "offset='" << I->getOffset() << "' "
                   << "length='" << I->getLength() << "'>"
                   << I->getReplacementText() << "</replacement>\n";
    }
    llvm::outs() << "</replacements>\n";
  } else {
    Rewriter Rewrite(Sources, LangOptions());
    tooling::applyAllReplacements(Replaces, Rewrite);
    if (Inplace) {
      if (Replaces.size() == 0)
        return false; // Nothing changed, don't touch the file.

      std::string ErrorInfo;
      llvm::raw_fd_ostream FileStream(FileName.c_str(), ErrorInfo,
                                      llvm::sys::fs::F_Binary);
      if (!ErrorInfo.empty()) {
        llvm::errs() << "Error while writing file: " << ErrorInfo << "\n";
        return true;
      }
      Rewrite.getEditBuffer(ID).write(FileStream);
      FileStream.flush();
    } else {
      if (Cursor.getNumOccurrences() != 0)
        outs() << "{ \"Cursor\": " << tooling::shiftedCodePosition(
                                          Replaces, Cursor) << " }\n";
      Rewrite.getEditBuffer(ID).write(outs());
    }
  }
  return false;
}
Пример #29
0
//--------------------------------------------------------------
// constructor
mgUglyList::mgUglyList(
  mgControl* parent,
  const char* cntlName)
: mgListControl(parent, cntlName)
{
  m_selected = -1;
  m_displayLines = 5;
  m_multiSelect = false;
  m_hasIcons = false;
  m_scrollPosn = 0;
  m_hover = -1;
  
  mgStyle* style = getStyle();
  style->getFontAttr(MG_STYLE_LIST, m_cntlName, "font", m_font);
  
  style->getFrameAttr(MG_STYLE_LIST, m_cntlName, "upFrame", m_upFrame);
  style->getFrameAttr(MG_STYLE_LIST, m_cntlName, "disFrame", m_disFrame);

  style->getFrameAttr(MG_STYLE_LIST, m_cntlName, "itemUpFrame", m_itemUpFrame);
  style->getFrameAttr(MG_STYLE_LIST, m_cntlName, "itemHoverFrame", m_itemHoverFrame);
  style->getFrameAttr(MG_STYLE_LIST, m_cntlName, "itemDownFrame", m_itemDownFrame);
  style->getFrameAttr(MG_STYLE_LIST, m_cntlName, "itemDisFrame", m_itemDisFrame);

  style->getColorAttr(MG_STYLE_LIST, m_cntlName, "itemUpColor", m_itemUpColor);
  style->getColorAttr(MG_STYLE_LIST, m_cntlName, "itemHoverColor", m_itemHoverColor);
  style->getColorAttr(MG_STYLE_LIST, m_cntlName, "itemDownColor", m_itemDownColor);
  style->getColorAttr(MG_STYLE_LIST, m_cntlName, "itemDisColor", m_itemDisColor);

  // set icon height to 80% line height
  m_iconHeight = (m_font->getHeight()*8)/10;
  m_lineHeight = max(m_iconHeight, m_font->getHeight());

  // add any item framing -- all frames should be same size as itemUpFrame
  if (m_itemUpFrame != NULL)
  {
    mgDimension size;
    m_itemUpFrame->getOutsideSize(mgDimension(0, m_lineHeight), size);
    m_lineHeight = size.m_height;
  }
      
  // create the scrollbars, so we can get preferred size correct
  m_vertScroller = new mgUglyScrollbar(this);
  m_vertScroller->setHorizontal(false);
  m_vertScroller->setVisible(false);
  m_vertScroller->addScrollListener(this);

  m_horzScroller = NULL;
/* =-= not used or laid out correctly
  m_horzScroller = new mgUglyScrollbar(this);
  m_horzScroller->setHorizontal(true);
  m_horzScroller->setVisible(false);
  m_horzScroller->addScrollListener(this);
*/

  m_selectListeners = NULL;

  addMouseListener(this);
  addFocusListener(this);
}
Пример #30
0
void RTFDocVisitor::visitPre(DocSimpleListItem *)
{
  if (m_hide) return;
  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocSimpleListItem)}\n");
  m_t << "\\par" << rtf_Style_Reset << getStyle("ListBullet") << endl;
  m_lastIsPara=FALSE;
  incIndentLevel();
}