Esempio n. 1
0
void ButtonCargo::setCargo( Noun * pCargo )
{
	m_Cargo = pCargo;

	// set the tool tip
	if ( WidgetCast<NounUnit>( pCargo ) )
	{
		setTip( CharString().format("%s %s", pCargo->name(), ((NounUnit *)pCargo)->status() ) );
		setIcon( ((NounUnit *)pCargo)->icon() );
	}
	else if(WidgetCast<CargoEnhancement>( pCargo ) )
	{
		CargoEnhancement * pCargoEnhancement = (CargoEnhancement *)pCargo;
		
		setTip( pCargoEnhancement->status() );
		if ( pCargoEnhancement->enhancement() != NULL )
		{
			setIcon( pCargoEnhancement->enhancement()->icon() );
			setColor( pCargoEnhancement->enhancement()->color() );
		}	
	}
	else 
	{
		setTip( pCargo->name() );
		setIcon( pCargo->icon() );
	}

	setEnable( true );
}
Esempio n. 2
0
void *DockWnd::processEvent(Event *e)
{
    switch (e->type()){
    case EventMessageReceived:
    case EventMessageRead:
    case EventMessageDeleted:
        reset();
        break;
    case EventSetMainIcon:
        m_state = (const char*)(e->param());
        if (!bBlink)
            setIcon(m_state);
        break;
    case EventSetMainText:
        m_tip = (const char*)(e->param());
        setTip(m_tip);
        break;
    case EventIconChanged:
        setIcon((bBlink && m_unread) ? m_unread : m_state);
        break;
    case EventLanguageChanged:
        setTip(m_tip);
        break;
    case EventQuit:
        quit();
        break;
    }
    return NULL;
}
Esempio n. 3
0
void WindowButton::updateButton( bool bVisible, bool bEnabled /*= true*/, const char * pTip /*= NULL*/ )
{
	setVisible( bVisible );
	setEnable( bVisible );
	setGreyed( ! bEnabled );

	if ( pTip != NULL )
	{
		if ( bEnabled )
			setTip( pTip );
		else
			setTip( "" );
	}
}
Esempio n. 4
0
void ButtonCargo::onUpdate( float t )
{
	WindowButton::onUpdate( t );

	if ( enabled() )
	{
		Noun * pCargo = m_Cargo;
		if (! pCargo )
			return;

		if ( WidgetCast<CargoEnhancement>( pCargo ) )
		{
			setTip(((CargoEnhancement *)pCargo)->status());
			m_HotKey = 0;
			return;
		}

		GameDocument * pDoc = (GameDocument *)document();
		ASSERT( pDoc );
		NounShip * pShip = pDoc->ship();
		if (! pShip )
			return;

		bool validAction = false;

		Noun * pTarget = pDoc->target();
		if ( pTarget != NULL )
		{
			if ( pShip->canUnload( pTarget, pCargo ) )
			{
				setTip( CharString().format( "Unload %s onto %s", 
					pCargo->name(), pTarget->name() ) );
				setIconColor( WHITE );

				validAction = true;
				m_HotKey = 'U';
			}
		}

		if ( !validAction )
		{
			if ( WidgetCast<NounUnit>( pCargo ) )
				setTip( CharString().format("%s %s", pCargo->name(), ((NounUnit *)pCargo)->status() ) );
			else
				setTip( pCargo->name() );
			setIconColor( GREY );
			m_HotKey = 0;
		}
	}
}
Esempio n. 5
0
void DockWnd::reset()
{
    list<msgInfo> msgs;
    pMain->fillUnread(msgs);
    QString s;
    if (msgs.size()){
        QStringList str;
        for (list<msgInfo>::iterator it_msg = msgs.begin(); it_msg != msgs.end(); ++it_msg){
            CUser u((*it_msg).uin);
            str.append(i18n("%1 from %2")
                       .arg(SIMClient::getMessageText((*it_msg).type, (*it_msg).count))
                       .arg(u.name(true)));
        }
#ifdef WIN32
        s = str.join(" ");
#else
        s = str.join("<br>");
#endif
    }else{
        if (!pClient->isConnecting()){
            s = pClient->getStatusText();
        }else{
            s = i18n("Connecting");
        }
    }
    setTip(s);
    showIcon = Unknown;
    timer();
}
Esempio n. 6
0
ToolBar::ToolBar(int x, int y, int w, const char *name, const char *tip) 
	: Container(x,y,w,2),name(NULL),fixedWidth(w) {
	if ( name ) {
		this->name = strdup(name);
		fixedWidth = w = MAX((int)strlen(name)+4,w);
	}
	if ( tip ) setTip(tip);
}
Esempio n. 7
0
ToolBar::ToolBar(int x, int y, const char *name, const char *tip) 
	: Container(x,y,0,2),name(NULL),fixedWidth(0) {
	if ( name ) {
		this->name = strdup(name);
		w = strlen(name)+4;
	}
	if ( tip ) setTip(tip);
}
Esempio n. 8
0
ModelAcquaintance::ModelAcquaintance(CString *date)
{
	setTip(Acquaintance);
	setNume(date[0]);
	setPrenume(date[1]);
	setNrTel(date[2]);
	setAtribut(date[3]);
}
Esempio n. 9
0
ModelColleague::ModelColleague(CString *date)
{
	setTip(Colleague);
	setNume(date[0]);
	setPrenume(date[1]);
	setNrTel(date[2]);
	setAtribut(date[3]);
}
Esempio n. 10
0
void DockWnd::reset()
{
    m_unread = NULL;
    QString oldUnreadText = m_unreadText;
    m_unreadText = "";
    MAP_COUNT count;
    MAP_COUNT::iterator itc;
    for (list<msg_id>::iterator it = m_plugin->core->unread.begin(); it != m_plugin->core->unread.end(); ++it){
        if (m_unread == NULL){
            CommandDef *def = m_plugin->core->messageTypes.find((*it).type);
            if (def)
                m_unread = def->icon;
        }
        msgIndex m;
        m.contact = (*it).contact;
        m.type    = (*it).type;
        itc = count.find(m);
        if (itc == count.end()){
            count.insert(MAP_COUNT::value_type(m, 1));
        }else{
            (*itc).second++;
        }
    }
    if (!count.empty()){
        for (itc = count.begin(); itc != count.end(); ++itc){
            CommandDef *def = m_plugin->core->messageTypes.find((*itc).first.type);
            if (def == NULL)
                continue;
            MessageDef *mdef = (MessageDef*)(def->param);
            QString msg = i18n(mdef->singular, mdef->plural, (*itc).second);

            Contact *contact = getContacts()->contact((*itc).first.contact);
            if (contact == NULL)
                continue;
            msg = i18n("%1 from %2")
                  .arg(msg)
                  .arg(contact->getName());
#ifdef WIN32
            if (m_unreadText.length() + 2 + msg.length() >= 64){
                m_unreadText += "...";
                break;
            }
#endif

            if (!m_unreadText.isEmpty())
#ifdef WIN32
                m_unreadText += ", ";
#else
                m_unreadText += "\n";
#endif
            m_unreadText += msg;
        }
    }
    if (m_unread && !blinkTimer->isActive())
        blinkTimer->start(1500);
    if (m_unreadText != oldUnreadText)
        setTip(m_tip);
}
Esempio n. 11
0
void ViewEngineering::ButtonGadget::setGadget( NounGadget * pGadget )
{
	m_rGadget = pGadget;

	setName( pGadget->name() );
	setIcon( pGadget->icon() );
	setTip( String().format("%s\n%d%%", pGadget->nounContext()->name(), int( pGadget->damageRatioInv() * 100) ) );
	setEnable( true );
}
Esempio n. 12
0
status_t TipManager::setTip(
	const char*				text,
	BView*						view,
	offset_mode_t			offsetMode	/*=LEFT_OFFSET_FROM_RECT*/,
	BPoint						offset			/*=s_useDefaultOffset*/,
	uint32 						flags				/*=NONE*/) {

	return setTip(
		BRect(), text, view, offsetMode, offset, flags);
}
Esempio n. 13
0
bool ButtonContact::onCursorMove( const RectInt & window, const PointInt & position, const PointInt & delta )
{
	if ( WindowButton::onCursorMove( window, position, delta ) )
	{
		if ( m_Noun.valid() )
		{
			((GameDocument *)document())->setCursorTarget( m_Noun );
			if ( ViewGame::sm_pViewGame->updateAction( true ) )
				setTip( "" );					// clear the button tip
			else
				setTip( m_Noun->displayName( false ) );		// restore the tool tip then..

			WindowNavigation::sm_bStickyCursorTarget = true;
			return true;
		}
	}

	return false;
}
Esempio n. 14
0
Button::Button(const char *label,const char *tip,widget_callback_t cbk, void *userData) 
	: pressed(false),label(NULL) {
	if ( label != NULL ) {
		setLabel(label);
	}
	if ( tip != NULL ) setTip(tip);
	this->x=0;
	this->y=0;
	this->userData=userData;
	this->cbk=cbk;
}
Esempio n. 15
0
Button::Button(int x,int y,int width, int height,const char *label,const char *tip,widget_callback_t cbk, void *userData) 
	: pressed(false), label(NULL) {
	if ( label != NULL ) setLabel(label);
	if ( tip != NULL ) setTip(tip);
	w=width;
	h=height;
	this->x=x;
	this->y=y;
	this->userData=userData;
	this->cbk=cbk;
}
Esempio n. 16
0
void ButtonUnit::setButton( NounUnit * pUnit )
{
	m_Unit = pUnit;
	if ( m_Unit.valid() )
	{
		m_Icon = pUnit->icon();

		setTip( CharString().format("%s\n%s", pUnit->name(), pUnit->status()) );
		setEnable( true );
	}
	else
		setEnable( false );
}
Esempio n. 17
0
ModelFriend::ModelFriend(CString *date)
{
	setTip(Friend);
	setNume(date[0]);
	setPrenume(date[1]);
	setNrTel(date[2]);

	if(setAtribut(date[3])==false)
	{
		CString txt;
		txt="0/0/0";
		setAtribut(txt);
	}
}
Esempio n. 18
0
void DockWnd::reset()
{
    unsigned unread = messages.size();
    QString s;
    if (unread){
        s = i18n("%n unread message", "%n unread messages", unread);
    }else{
        if ((pClient->m_state == ICQClient::Logoff) || (pClient->m_state == ICQClient::Logged)){
            s = pClient->getStatusText();
        }else{
            s = i18n("Connecting");
        }
    }
    setTip(s);
    showIcon = Unknown;
    timer();
}
Esempio n. 19
0
void ButtonGadget::onUpdate( float t )
{
	WindowButton::onUpdate( t );

	if ( enabled() )
	{
		GameDocument * pDoc = (GameDocument *)document();
		if (! pDoc )
			return;
		NounGadget * pGadget = m_Gadget;
		if (! pGadget )
			return;

		// fade  or show the window background based on if the gadget can be used on the current target
		bool isShiftDown = Keyboard::shiftDown();
		if ( pGadget->useActive() )
		{
			setTargetAlpha( 0.75f );
			m_IconColor = WHITE;
		}
		else if ( pGadget->usable( pDoc->target(), isShiftDown  ) )
		{
			setTargetAlpha( 0.75f );
			m_IconColor = GREEN;
		}
		else
		{
			setTargetAlpha( 0.35f );
			m_IconColor = GREY;
		}

		if ( m_bCursorOver )
		{
			// update the tool tip
			CharString sTip;
			sTip += pGadget->nounContext()->name();
			sTip += CharString("\n") + pGadget->useTip( pDoc->target(), isShiftDown );

			setTip( sTip );
		}
	}
}
Esempio n. 20
0
ModelColleague::ModelColleague()
{
	setTip(Colleague);
}
Esempio n. 21
0
ModelAcquaintance::ModelAcquaintance()
{
	setTip(Acquaintance);
}
Esempio n. 22
0
void ButtonContact::setButton( Noun * pNoun )
{
	ASSERT( pNoun != NULL );

	m_Flags |= NOCLIP;
	m_Style = HAS_BACK | EFFECT_HIGHLIGHT | SMOOTH_LL;
	//m_Alpha = 0.75f;

	// set the window name to the same as our contact
	setName( pNoun->name() );

	// set the noun
	m_Noun = pNoun;
	if ( WidgetCast<NounShip>( pNoun ) )
		setIcon( WidgetCast<Material>( resource( NounShip::typeText( ((NounShip *)pNoun)->type() ) ) ) );
	else if ( WidgetCast<NounPlanet>( pNoun ) )
		setIcon( WidgetCast<Material>( resource( "PLANET" ) ) );
	else if ( WidgetCast<NounStar>( pNoun ) )
		setIcon( WidgetCast<Material>( resource( "STAR" ) ) );
	else if ( WidgetCast<NounNebula>( pNoun ) )
		setIcon( WidgetCast<Material>( resource( "NEBULA" ) ) );
	else if ( WidgetCast<NounAsteroid>( pNoun ) )
		setIcon( WidgetCast<Material>( resource( "ASTEROID" ) ) );
	else if ( WidgetCast<NounTarget>( pNoun ) )
		setIcon( WidgetCast<Material>( resource( "TARGET" ) ) );
	else if ( WidgetCast<NounJumpGate>( pNoun ) )
		setIcon( WidgetCast<Material>( resource( "JUMPGATE" ) ) );
	else if ( WidgetCast<NounProjectile>( pNoun ) )
		setIcon( WidgetCast<Material>( resource( "PROJECTILE" ) ) );
	else
		setIcon( WidgetCast<Material>( resource( "UNKNOWN" ) ) );

	// determine if this contact is an objective!
	GameDocument * pDoc = (GameDocument *)document();
	ASSERT( pDoc );
	GameContext * pContext = pDoc->context();
	ASSERT( pContext );
	GameClient * pClient = pDoc->client();
	ASSERT( pClient );

	int myFaction = pDoc->factionId();

	m_IsObjective = false;
	for(int i=0;i<pContext->conditionCount();i++)
	{
		const GameContext::Condition & condition = pContext->conditionN( i );
		for(int j=0;j<condition.objectives.size();j++)
			if ( condition.objectives[j].noun == m_Noun->key() && condition.objectives[j].factionId == myFaction )
			{
				m_IsObjective = true;
				m_Objective = (ObjectiveType)condition.objectives[j].type;
				break;
			}

		if ( m_IsObjective )
			break;
	}

	if ( pNoun->userId() != 0 )
	{
		Group * pGroup = pClient->group();
		if ( pGroup != NULL )
		{
			m_bGroupLeader = pGroup->isLeader( pNoun->userId() );
			m_bGroupPending = pGroup->isPending( pNoun->userId() );
		}
	}

	// set the tool tip
	CharString tip( pNoun->name() );
	if ( m_IsObjective )
		tip += CharString().format(" / Objective: %s", GameContext::objectiveText( m_Objective ) );

	setTip( tip );
}
Esempio n. 23
0
void MultipleChoiceButton::setTip(unsigned choiceValue, char const *stringUtf8)
{
	setTip(choiceValue, stringUtf8 != nullptr? std::string(stringUtf8) : std::string());
}
Esempio n. 24
0
bool ButtonBuildStructure::setButton( Noun * pTarget, NounStructure * pBuild )
{
	if ( !pTarget || !pBuild )
		return false;

	NounDropTarget * pDrop = WidgetCast<NounDropTarget>( pTarget );
	NounStructure * pUpgrade = WidgetCast<NounStructure>( pTarget );
	if (! pDrop && !pUpgrade )
		return false;
	NounPlanet * pPlanet = pDrop != NULL ? pDrop->planet() : pUpgrade->planet();

	m_Target = pTarget;
	m_Build = pBuild;

	// set the icon for the structure
	setIcon( pBuild->icon() );

	// update tool tip
	CharString sTip;
	sTip += CharString().format("<color;ffffff>Build %s</color>\n%s\n\n", 
		pBuild->nounContext()->name(), pBuild->nounContext()->description() );

	sTip += "Requires:\n";

	if ( pBuild->buildTechnology() > 0 )
	{
		sTip += CharString().format("<color;%s>%d Technology\n", pPlanet->technology() < pBuild->buildTechnology() ? "8080ff" : "ffffff",
			pBuild->buildTechnology() );
	}
	if ( pBuild->workers() > 0 )
	{
		int workers = (pPlanet->workersAvailable() - pPlanet->workersNeeded()) - pBuild->workers();
		sTip += CharString().format("<color;%s>%d Workers</color>\n", (workers >= 0 ? "ffffff" : "8080ff"), pBuild->workers() );
	}
	if ( pBuild->power() < 0 )
	{
		int power = (pPlanet->powerAvailable() - pPlanet->powerNeeded()) + pBuild->power();
		sTip += CharString().format("<color;%s>%d Power</color>\n", (power >= 0 ? "ffffff" : "8080ff"), -pBuild->power() );
	}
	if ( pBuild->buildCost() > 0 )
	{
		int cost = pPlanet->resources() - pBuild->buildCost();
		sTip += CharString().format("<color;%s>%d Resources</color>\n", (cost >= 0 ? "ffffff" : "8080ff"),  pBuild->buildCost() );
	}

	if ( pBuild->buildFlags() != 0 )
	{
		dword nFlags = pBuild->buildFlags();
		for(int i=0;i<32;i++)
		{
			dword nBit = 1 << i;
			if ( (nFlags & nBit) != 0 )
			{
				sTip += CharString().format("<color;%s>%s\n", 
					(pPlanet->flags() & nBit) ? "ffffff" : "8080ff", NounPlanet::flagName( nBit ) );
			}
		}
	}

	sTip += CharString().format("\n<color;ffffff>Time: %d:%2.2d</color>", pBuild->buildTime() / 60, pBuild->buildTime() % 60 );

	setTip( sTip );

	setName( pBuild->name() );
	setEnable( true );

	return true;
}
Image::Image(int x,int y,int w, int h, const char *tip) : Widget(x,y,w,h), back(TCODColor::black) {
	if ( tip ) setTip(tip);
}
Esempio n. 26
0
void StateButton::setTip(int state, char const *stringUtf8)
{
	setTip(state, QString::fromUtf8(stringUtf8));
}
Esempio n. 27
0
Label::Label(int x, int y, const char *label, const char *tip) : Widget(x,y,0,1) {
	this->label=label;
	if ( tip ) setTip(tip);
}
Esempio n. 28
0
	Separator(const char *txt, const char *tip=NULL) : Widget(0,0,0,1),txt(NULL) {
		if ( txt ) {
			this->txt=strdup(txt);
		}
		if ( tip ) setTip(tip);
	}
Esempio n. 29
0
void *DockWnd::processEvent(Event *e)
{
    switch (e->type()){
    case EventMessageReceived:
    case EventMessageRead:
    case EventMessageDeleted:
        reset();
        break;
    case EventSetMainIcon:
        m_state = (const char*)(e->param());
        if (!bBlink)
            setIcon(m_state);
        break;
    case EventSetMainText:
        m_tip = (const char*)(e->param());
        setTip(m_tip);
        break;
    case EventIconChanged:
        setIcon((bBlink && m_unread) ? m_unread : m_state);
        break;
    case EventLanguageChanged:
        setTip(m_tip);
        break;
    case EventQuit:
        quit();
        break;
#ifdef WIN32
    case EventShowError:{
            if (!m_bBalloon)
                return NULL;
            clientErrorData *data = (clientErrorData*)(e->param());
            if (data->id == 0)
                return NULL;
            for (list<BalloonItem>::iterator it = m_queue.begin(); it != m_queue.end(); ++it){
                if ((*it).id == data->id)
                    return e->param();
            }
            QString arg;
            if (data->args){
                arg = QString::fromUtf8(data->args);
				free(data->args);
			}
            BalloonItem item;
            item.id   = data->id;
            item.client = data->client;
            item.flags  = (data->flags & ERR_INFO) ? NIIF_INFO : NIIF_ERROR;
            item.text = i18n(data->err_str);
            if (item.text.find("%1") >= 0)
                item.text = item.text.arg(arg);
            if (!m_queue.empty()){
                m_queue.push_back(item);
                return e->param();
            }
            item.title = "SIM";
            if (getContacts()->nClients() > 1){
                for (unsigned i = 0; i < getContacts()->nClients(); i++){
                    if (getContacts()->getClient(i) == data->client){
                        item.title = getContacts()->getClient(i)->name().c_str();
                        int n = item.title.find(".");
                        if (n > 0)
                            item.title = item.title.left(n) + " " + item.title.mid(n + 1);
                    }
                }
            }
            m_queue.push_back(item);
            if (showBalloon())
                return e->param();
            return NULL;
        }
#endif
    }
    return NULL;
}
Esempio n. 30
0
DockWnd::DockWnd(DockPlugin *plugin, const char *icon, const char *text)
        : QWidget(NULL, "dock",  WType_TopLevel | WStyle_Customize | WStyle_NoBorder | WStyle_StaysOnTop),
        EventReceiver(LowPriority)
{
#ifndef WIN32
#if !defined(QT_MACOSX_VERSION) && !defined(QT_MAC)
    wharfIcon = NULL;
#endif
#endif
    m_plugin = plugin;
    setMouseTracking(true);
    bNoToggle = false;
    bBlink = false;
    m_state = icon;
    blinkTimer = new QTimer(this);
    connect(blinkTimer, SIGNAL(timeout()), this, SLOT(blink()));
#ifdef WIN32
    m_bBalloon = false;
    hShell = NULL;
    setIcon(icon);
    QWidget::hide();
    gDock = this;
    WM_DOCK = RegisterWindowMessageA("SIM dock");
    if (IsWindowUnicode(winId())){
        oldDockProc = (WNDPROC)SetWindowLongW(winId(), GWL_WNDPROC, (LONG)DockWindowProc);
/*
        OSVERSIONINFOA osvi;
        osvi.dwOSVersionInfoSize = sizeof(osvi);
        GetVersionExA(&osvi);
        if ((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) && (osvi.dwMajorVersion > 4))
            m_bBalloon = true;
*/
        __NOTIFYICONDATAW notifyIconData;
        if (m_bBalloon){
            memset(&notifyIconData, 0, sizeof(notifyIconData));
            notifyIconData.cbSize = sizeof(notifyIconData);
            notifyIconData.uVersion = NOTIFYICON_VERSION;
            Shell_NotifyIconW(NIM_SETVERSION, (NOTIFYICONDATAW*)&notifyIconData);
        }
        memset(&notifyIconData, 0, sizeof(notifyIconData));
        notifyIconData.cbSize = sizeof(notifyIconData);
        notifyIconData.hIcon = topData()->winIcon;
        notifyIconData.hWnd = winId();
        notifyIconData.uCallbackMessage = WM_DOCK;
        notifyIconData.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
        Shell_NotifyIconW(NIM_ADD, (NOTIFYICONDATAW*)&notifyIconData);
    }else{
        oldDockProc = (WNDPROC)SetWindowLongA(winId(), GWL_WNDPROC, (LONG)DockWindowProc);
        __NOTIFYICONDATAA notifyIconData;
        memset(&notifyIconData, 0, sizeof(notifyIconData));
        notifyIconData.cbSize = sizeof(notifyIconData);
        notifyIconData.hIcon = topData()->winIcon;
        notifyIconData.hWnd = winId();
        notifyIconData.uCallbackMessage = WM_DOCK;
        notifyIconData.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
        Shell_NotifyIconA(NIM_ADD, (NOTIFYICONDATAA*)&notifyIconData);
    }
#else
    setMinimumSize(22, 22);
    resize(22, 22);
#if !defined(QT_MACOSX_VERSION) && !defined(QT_MAC)
    bInit = false;
    inTray = false;
    inNetTray = false;

    Display *dsp = x11Display();
    WId win = winId();

    bool bEnlightenment = false;
    QWidget tmp;
    Atom enlightenment_desktop = XInternAtom(dsp, "ENLIGHTENMENT_DESKTOP", false);
    WId w = tmp.winId();
    Window p, r;
    Window *c;
    unsigned int nc;
    while (XQueryTree(dsp, w, &r, &p, &c, &nc)){
        if (c && nc > 0)
            XFree(c);
        if (! p) {
            log(L_WARN, "No parent");
            break;
        }
        unsigned char *data_ret = NULL;
        Atom type_ret;
        int i_unused;
        unsigned long l_unused;
        if ((XGetWindowProperty(dsp, p, enlightenment_desktop, 0, 1, False, XA_CARDINAL,
                                &type_ret, &i_unused, &l_unused, &l_unused,
                                &data_ret) == Success) && (type_ret == XA_CARDINAL)) {
            if (data_ret)
                XFree(data_ret);
            bEnlightenment = true;
            log(L_DEBUG, "Detect Enlightenment");
            break;
        }
        if (p == r) break;
        w = p;
    }

    if (bEnlightenment){
        bInit = true;
        resize(48, 48);
        setFocusPolicy(NoFocus);
        move(m_plugin->getDockX(), m_plugin->getDockY());
        MWMHints mwm;
        mwm.flags = MWM_HINTS_DECORATIONS;
        mwm.functions = 0;
        mwm.decorations = 0;
        mwm.inputMode = 0;
        mwm.status = 0;
        Atom a = XInternAtom(dsp, "_MOTIF_WM_HINTS", False);
        XChangeProperty(dsp, win, a, a, 32, PropModeReplace,
                        (unsigned char *)&mwm, sizeof(MWMHints) / 4);
        XStoreName(dsp, win, "SIM");
        XClassHint *xch = XAllocClassHint();
        xch->res_name  = (char*)"SIM";
        xch->res_class = (char*)"Epplet";
        XSetClassHint(dsp, win, xch);
        XFree(xch);
        XSetIconName(dsp, win, "SIM");
        unsigned long val = (1 << 0) /* | (1 << 9) */ ;
        a = XInternAtom(dsp, "_WIN_STATE", False);
        XChangeProperty(dsp, win, a, XA_CARDINAL, 32, PropModeReplace,
                        (unsigned char *)&val, 1);
        val = 2;
        a = XInternAtom(dsp, "_WIN_LAYER", False);
        XChangeProperty(dsp, win, a, XA_CARDINAL, 32, PropModeReplace,
                        (unsigned char *)&val, 1);
        val = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 5);
        a = XInternAtom(dsp, "_WIN_HINTS", False);
        XChangeProperty(dsp, win, a, XA_CARDINAL, 32, PropModeReplace,
                        (unsigned char *)&val, 1);
        win_name = "SIM";
        win_version = VERSION;
        win_info = "";
        while (!comms_win)
        {
            ECommsSetup(dsp);
            sleep(1);
        }
        char s[256];
        snprintf(s, sizeof(s), "set clientname %s", win_name);
        ECommsSend(s);
        snprintf(s, sizeof(s), "set version %s", win_version);
        ECommsSend(s);
        snprintf(s, sizeof(s), "set info %s", win_info);
        ECommsSend(s);
        ESYNC;

        set_background_properties(this);

        setIcon(icon);
        show();
        return;
    }

    wharfIcon = new WharfIcon(this);
#endif
    setBackgroundMode(X11ParentRelative);
    setIcon(icon);

#if !defined(QT_MACOSX_VERSION) && !defined(QT_MAC)
    XClassHint classhint;
    classhint.res_name  = (char*)"sim";
    classhint.res_class = (char*)"Wharf";
    XSetClassHint(dsp, win, &classhint);

    Screen *screen = XDefaultScreenOfDisplay(dsp);
    int screen_id = XScreenNumberOfScreen(screen);
    char buf[32];
    snprintf(buf, sizeof(buf), "_NET_SYSTEM_TRAY_S%d", screen_id);
    Atom selection_atom = XInternAtom(dsp, buf, false);
    XGrabServer(dsp);
    Window manager_window = XGetSelectionOwner(dsp, selection_atom);
    if (manager_window != None)
        XSelectInput(dsp, manager_window, StructureNotifyMask);
    XUngrabServer(dsp);
    XFlush(dsp);
    if (manager_window != None){
        inNetTray = true;
        if (!send_message(dsp, manager_window, SYSTEM_TRAY_REQUEST_DOCK, win, 0, 0)){
            inNetTray = false;
        }
    }

    Atom kde_net_system_tray_window_for_atom = XInternAtom(dsp, "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", false);

    long data[1];
    data[0] = 0;
    XChangeProperty(dsp, win, kde_net_system_tray_window_for_atom, XA_WINDOW,
                    32, PropModeReplace,
                    (unsigned char*)data, 1);

    XWMHints *hints;
    hints = XGetWMHints(dsp, win);
    hints->initial_state = WithdrawnState;
    hints->icon_x = 0;
    hints->icon_y = 0;
    hints->icon_window = wharfIcon->winId();
    hints->window_group = win;
    hints->flags = WindowGroupHint | IconWindowHint | IconPositionHint | StateHint;
    XSetWMHints(dsp, win, hints);
    XFree( hints );

    Event eArgc(EventArgc);
    int argc = (int)eArgc.process();
    Event eArgv(EventArgv);
    char **argv = (char**)eArgv.process();
    XSetCommand(dsp, win, argv, argc);

    if (!inNetTray){
        move(-21, -21);
        resize(22, 22);
    }
#endif
    show();
#endif
    setTip(text);
    reset();
}