Пример #1
0
PaletteCell* Palette::add(int idx, Element* s, const QString& name, QString tag, qreal mag)
      {
      if (s) {
            s->setPos(0.0, 0.0);
            s->setUserOff(QPointF());
            s->setReadPos(QPointF());
            }

      PaletteCell* cell = new PaletteCell;
      if (idx < cells.size()) {
            delete cells[idx];
            }
      else {
            for (int i = cells.size(); i <= idx; ++i)
                  cells.append(0);
            }
      cells[idx]      = cell;
      cell->element   = s;
      cell->name      = name;
      cell->tag       = tag;
      cell->drawStaff = needsStaff(s);
      cell->xoffset   = 0;
      cell->yoffset   = 0;
      cell->mag       = mag;
      cell->readOnly  = false;
      update();
      if (s && s->type() == Element::ICON) {
            Icon* icon = static_cast<Icon*>(s);
            connect(getAction(icon->action()), SIGNAL(toggled(bool)), SLOT(actionToggled(bool)));
            }
Пример #2
0
bool IconSprite::init(const Icon &icon) {
	if (!DynamicSprite::init(icon.getTexture(), icon.getTextureRect(), icon.getDensity())) {
		return false;
	}

	_icon = icon;

	return true;
}
Пример #3
0
void prop_cb(Fl_Widget*, void* ic)
{
	Icon* icon = (Icon*)ic;
	assert(icon != NULL);

	IconDialog id(icon->icon_settings(), icon->icon_image());
	printf("%s\n", icon->icon_settings()->name.c_str());
	id.exec();
}
int* IconSet::getIcon(int index)
{
	if (index < 0 || index > numIcons)
		throw string("Icon index not in range");

	BOOL result;
	//Clear the DC
	memset(pixels, 0x0, width * height * sizeof(UINT));	
	memset(mask, 0x0, width * height * sizeof(UINT));	

	Icon icon = icons[index];

	//Paint the icon onto the DC		
	result = DrawIconEx(iconContext, 0, 0, icon.getIcon(), icon.getWidth(), icon.getHeight(), 0, NULL, DI_NORMAL); 	
	checkResult(result, "Failed to draw icon into memory");

	//Paint the icon onto the DC		
	result = DrawIconEx(maskContext, 0, 0, icon.getIcon(), icon.getWidth(), icon.getHeight(), 0, NULL, DI_MASK); 
	checkResult(result, "Failed to draw icon alpha mask into memory");

	//pixels and mask now contain the data
	int *dimensions = new int[2];
	dimensions[0] = icon.getWidth();
	dimensions[1] = icon.getHeight();

	return dimensions;
}
Пример #5
0
Mcascade::Mcascade()
  {
  Icon *i;
  stborder(new Mborder());
  redge(0);
  i=new Icon();
   i->st(picrtarw);
  add(i);
  ledge(0);
  auxrtol(i,0);
  }
Пример #6
0
static Icon createIcon(bool isPlus)
{
    Icon icon;
    QColor stdColor=QColor(QApplication::palette().color(QPalette::Active, QPalette::ButtonText));
    QColor highlightColor=stdColor.red()<100 ? stdColor.lighter(50) : stdColor.darker(50);
    QList<int> sizes=QList<int>() << 16 << 22;

    foreach (int s, sizes) {
        icon.addPixmap(createPixmap(s, stdColor, 1.0, isPlus));
        icon.addPixmap(createPixmap(s, stdColor, 0.5, isPlus), QIcon::Disabled);
        icon.addPixmap(createPixmap(s, highlightColor, 1.0, isPlus), QIcon::Active);
    }
Пример #7
0
void
WindowImpl::on_resize(int, int)
{
  titlebar->set_position(CL_Rect(CL_Point(3+16,3), CL_Size(parent->get_width()-6-18-18-18, 12+3)));
  close->set_position(3, 3);
  minimize->set_position(parent->get_width()-3-18-18, 3);
  maximize->set_position(parent->get_width()-3-18, 3);
  CL_Rect rect = parent->get_position();
  client_area->set_position(CL_Rect(CL_Point(4, 3+12+7), 
                                    CL_Size(rect.get_width()-10,
                                            rect.get_height()-28)));
}
Пример #8
0
void CasualtiesList::addCasualty( GenericFightUnit * unit )
{
    if( unit ) {
        _none->hide();
        QString f;
        f.sprintf( "units/face_%i_%i.png", unit->getRace(), unit->getLevel() );
        Icon * photo = new Icon( _present, "photo" );
        photo->setPixmap( QPixmap( IMAGE_PATH + f ) );
        _layPresent->addWidget( photo );
        _layPresent->addStretch( 2 );
    }
}
Пример #9
0
void Button::AddIcon(Renderer* pRenderer, const std::string &fileName, int texWidth, int texHeight, int width, int height, int xOffset, int yOffset, float depth)
{
	// texWidth and texHeight should always be a power of 2.

	Icon* lpNewIcon = new Icon(pRenderer, fileName, texWidth, texHeight);
	lpNewIcon->SetDimensions(xOffset, yOffset, width, height);
	lpNewIcon->SetDepth(depth);

	m_vpAddedComponentList.push_back(lpNewIcon);

	Add(lpNewIcon);
}
Пример #10
0
void MenuModule::addmoduleicon(int type,int state){

	QPixmap pixmap;
	Icon icon = imageReader::icon(type, state);
	module_icon = new QLabel(this);  //模块图标	
	pixmap = icon.getPixmap();
	module_icon->setPixmap(pixmap);
	QString tips = icon.getText();
	module_icon->move(20, 18);
	module_icon->setToolTip(tips);

}
Пример #11
0
void Style::Unload()
{
    for( unsigned int i = 0; i < tools.Count(); i++ ) {
        Tool* tool = (Tool*) tools.Item( i );
        tool->Unload();
    }

    for( unsigned int i = 0; i < icons.Count(); i++ ) {
        Icon* icon = (Icon*) icons.Item( i );
        icon->Unload();
    }
}
Пример #12
0
int create_new_dnd_icon(int x, int y, char *filename) //create icon from dnd data
{
    if (filename) 
    {
        char config[FL_PATH_MAX];
	const char *name = fl_file_filename(filename);
	snprintf(config, sizeof(config)-1, "%s/.ede/desktop/%s.desktop", getenv("HOME"), name);
	
        if (!fl_file_exists((char*)config))
        {
	    char val[FL_PATH_MAX];
	    Fl_Config checkconf(filename, true, false);
	
	    if(!checkconf.get("Desktop Entry", "Exec", val, 0, sizeof(val))) 
	    {	
    	        Fl_Config cfg(config);
		cfg.set_section("Desktop Entry");
		
		checkconf.get("Desktop Entry", "Icon", val, "no icon", sizeof(val)); 
        	cfg.write("Icon", val);
        	cfg.write("X", x);
        	cfg.write("Y", y);
        	cfg.write(get_localized_string(), get_localized_name(checkconf));

                checkconf.get("Desktop Entry", "Exec", val, filename, sizeof(val));
        	cfg.write("Exec", val);
        	cfg.flush();
	    }
	    else
	    {
	        Fl_Config cfg(config);
    	        cfg.set_section("Desktop Entry");
        	cfg.write("Icon", "no icon");
        	cfg.write("X", x);
        	cfg.write("Y", y);
        	cfg.write(get_localized_string(), name);
                cfg.write("Exec", filename);
        	cfg.flush();
	    }	
	    desktop->begin();
            Icon *icon = new Icon((char*)config);
    	    icon->show();
    	    desktop->end();
    	    desktop->redraw();
	}
	else 
	{
	    fl_alert(_("The icon with the same name already exists."));
	}  
    }  
    return 0;
}
Пример #13
0
void Desktop::update_icons()
{
    for(int n=0; n<children(); n++) {
        Fl_Widget *w = child(n);
        if(w==popup) continue;
        Icon *i = (Icon *)w;
        i->update_all();
    }
    if(auto_arr)
        auto_arrange();

    Fl::flush();
}
Пример #14
0
static void populateIconPalette(Palette* p, const IconAction* a)
      {
      while (a->subtype != -1) {
            Icon* ik = new Icon(gscore);
            ik->setSubtype(a->subtype);
            Shortcut* s = getShortcut(a->action);
            QAction* action = getAction(s);
            QIcon icon(action->icon());
            ik->setAction(a->action, icon);
            p->append(ik, s->help);
            ++a;
            }
      }
Пример #15
0
void populateIconPalette(Palette* p, const IconAction* a)
      {
      while (a->subtype != IconType::NONE) {
            Icon* ik = new Icon(gscore);
            ik->setIconType(a->subtype);
            Shortcut* s = Shortcut::getShortcut(a->action);
            QAction* action = s->action();
            QIcon icon(action->icon());
            ik->setAction(a->action, icon);
            p->append(ik, s->help());
            ++a;
            }
      }
Пример #16
0
void
IconImpl::mouse_up  (const CL_InputEvent& event)
{
  if (is_enabled)
  {
    down         = false;
    parent->release_mouse();

    if (parent->has_mouse_over())
    {
      sig_on_click();
    }
  }
}
Пример #17
0
Icon Icon::getMediaIcon(const QString &name)
{
    static QList<QIcon::Mode> modes=QList<QIcon::Mode>() << QIcon::Normal << QIcon::Disabled << QIcon::Active << QIcon::Selected;
    Icon icn;
    Icon icon(name);

    foreach (QIcon::Mode mode, modes) {
        icn.addPixmap(icon.pixmap(QSize(64, 64), mode).scaled(QSize(28, 28), Qt::KeepAspectRatio, Qt::SmoothTransformation), mode);
        icn.addPixmap(icon.pixmap(QSize(48, 48), mode), mode);
        icn.addPixmap(icon.pixmap(QSize(32, 32), mode), mode);
        icn.addPixmap(icon.pixmap(QSize(24, 24), mode), mode);
        icn.addPixmap(icon.pixmap(QSize(22, 22), mode), mode);
        icn.addPixmap(icon.pixmap(QSize(16, 16), mode), mode);
    }
Пример #18
0
void IconProvider::remove(Icon icon)
{
    if (!icon.isValid())
        return;

    auto id = icon.id();
    FridaIcon *iconHandle;
    {
        QMutexLocker locker(&m_mutex);
        iconHandle = m_icons[id];
        m_icons.remove(id);
    }
    g_object_unref(iconHandle);
}
Пример #19
0
void rename_cb(Fl_Widget*, void* ic)
{
	Icon* icon = (Icon*)ic;
	assert(icon != NULL);
	const char* val = fl_input(_("Rename icon:"), icon->label().c_str());

	if(val)
	{
		if(strlen(val) == 0)
			fl_alert(_("Please do not use empty values as icon names"));
		else
			icon->update_label(val);
	}
}
Пример #20
0
static void icon_free(void *val)
{
	Icon *icon = val;

	if (icon) {
		if (icon->drawinfo_free) {
			icon->drawinfo_free(icon->drawinfo);
		}
		else if (icon->drawinfo) {
			MEM_freeN(icon->drawinfo);
		}
		MEM_freeN(icon);
	}
}
Пример #21
0
/* this method is invisible: called by Wall::whenIntersect */
void Icon::stick(Wall *pwall, void *_picon, time_t s, time_t u)
{
  Icon *picon = (Icon *) _picon;

  picon->pos.az = pwall->pos.az;	// same angle than obstacle

  GLfloat iconcolor[3] = {1, 0, 0};	// red
  picon->setFlashy(iconcolor);		// flash the icon
  GLfloat wallcolor[3] = {1, 1, 0};	// yellow
  pwall->setFlashy(wallcolor);		// flash the wall

  //dax picon->updatePositionAndGrid(picon->pos);
  picon->updatePosition();
  picon->enableBehavior(COLLIDE_ONCE);
  picon->taken = false;
}
Пример #22
0
void
IconImpl::mouse_down(const CL_InputEvent& event)
{
  if (is_enabled)
  {
    down         = true;
    parent->capture_mouse();
  }
}
Пример #23
0
void initload(void) {

	OEMCHAR	path[MAX_PATH];

	icon.loadIcon(xmil_icon); //for dialog
	
	milstr_ncpy(path, file_getcd(inifile), NELEMENTS(path));
	profile_iniread(path, ini_title, iniitem, NELEMENTS(iniitem), NULL);
}
Пример #24
0
 void ImageList::replace ( const Icon& image, int index )
 {
     const ::BOOL result = ImageList_ReplaceIcon(
         handle(), index, image.handle()
         );
     if ( result == FALSE ) {
         UNCHECKED_WIN32C_ERROR(ImageList_ReplaceIcon,0);
     }
 }
Пример #25
0
 int ImageList::add ( const Icon& image )
 {
     const int result = ImageList_AddIcon(
         handle(), image.handle()
         );
     if ( result == -1 ) {
         UNCHECKED_WIN32C_ERROR(ImageList_AddIcon,0);
     }
     return (result);
 }
Пример #26
0
void
ShapeIterator::NextPath()
{
	CALLED();
	if (fPath) {
		fIcon->Paths()->AddPath(fPath);
		fShape->Paths()->AddPath(fPath);
	}
	fPath = NULL;
}
Пример #27
0
	void run(void) {
		icon.set(ID_ICON_SWO2),

		form1.setText(L"リソース確認テスト")
			.show();

		form2.setText(L"リソース確認テスト2")
			.setIcon(icon)
			.show();
	}
Пример #28
0
FX_BOOL Document::icons(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
{
	if (vp.IsSetting()) {
		CJS_Context* pContext = static_cast<CJS_Context*>(cc);
		sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY);
		return FALSE;
	}

	if (!m_pIconTree)
	{
		vp.SetNull();
		return TRUE;
	}

	CJS_Array Icons(m_isolate);
	IconElement* pIconElement = NULL;
	int iIconTreeLength = m_pIconTree->GetLength();

	CJS_Context* pContext = (CJS_Context *)cc;
	CJS_Runtime* pRuntime = pContext->GetJSRuntime();

	for (int i = 0; i < iIconTreeLength; i++)
	{
		pIconElement = (*m_pIconTree)[i];

		JSFXObject  pObj = JS_NewFxDynamicObj(*pRuntime, pContext, JS_GetObjDefnID(*pRuntime, L"Icon"));
		if (pObj.IsEmpty()) return FALSE;

		CJS_Icon * pJS_Icon = (CJS_Icon *)JS_GetPrivate(pObj);
		if (!pJS_Icon) return FALSE;

		Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject();
		if (!pIcon)return FALSE;

		pIcon->SetStream(pIconElement->IconStream->GetStream());
		pIcon->SetIconName(pIconElement->IconName);
		Icons.SetElement(i, CJS_Value(m_isolate,pJS_Icon));
	}

	vp << Icons;
	return TRUE;
}
Пример #29
0
 void Tooltip::title ( const string& text, const Icon& icon )
 {
     const ::BOOL result = static_cast<::BOOL>(::SendMessageW(
         handle(), TTM_SETTITLE, icon.value(),
         reinterpret_cast< ::LPARAM >(text.data()))
         );
     if ( result == FALSE ) {
         const ::DWORD error = ::GetLastError();
         UNCHECKED_WIN32C_ERROR(SendMessage, error);
     }
 }
//Loop through all the icons, and figure out the maximum width and height	
void IconSet::getIconDimensions()
{	
	vector<Icon>::const_iterator start = icons.begin();
	vector<Icon>::const_iterator end = icons.end();

	width = height = 0;

	while (start != end)
	{
		Icon icon = *start;

		if (icon.getWidth() > width)
			width = icon.getWidth();

		if (icon.getHeight() > height)
			height = icon.getHeight();		

		start++;
	}	
}