Added method used to set an element's image.
git-svn-id: http://yate.null.ro/svn/yate/trunk@3338 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
4129f20aef
commit
6b4ae1e4d5
|
@ -1948,6 +1948,17 @@ bool QtWindow::removeMenu(const NamedList& params)
|
|||
return true;
|
||||
}
|
||||
|
||||
// Set an element's image
|
||||
bool QtWindow::setImage(const String& name, const String& image)
|
||||
{
|
||||
if (!name)
|
||||
return false;
|
||||
if (name == m_id)
|
||||
return QtClient::setImage(this,image);
|
||||
QObject* obj = qFindChild<QObject*>(wndWidget(),QtClient::setUtf8(name));
|
||||
return obj && QtClient::setImage(obj,image);
|
||||
}
|
||||
|
||||
// Set a property for this window or for a widget owned by it
|
||||
bool QtWindow::setProperty(const String& name, const String& item, const String& value)
|
||||
{
|
||||
|
|
|
@ -514,6 +514,14 @@ public:
|
|||
*/
|
||||
virtual bool removeMenu(const NamedList& params);
|
||||
|
||||
/**
|
||||
* Set an element's image
|
||||
* @param name Name of the element
|
||||
* @param image Image to set
|
||||
* @return True on success
|
||||
*/
|
||||
virtual bool setImage(const String& name, const String& image);
|
||||
|
||||
/**
|
||||
* Set a property for this window or for a widget owned by it
|
||||
* @param name Name of the element
|
||||
|
|
|
@ -66,6 +66,7 @@ public:
|
|||
createObject,
|
||||
buildMenu,
|
||||
removeMenu,
|
||||
setImage,
|
||||
setProperty,
|
||||
getProperty,
|
||||
openUrl
|
||||
|
@ -401,6 +402,8 @@ bool Window::setParams(const NamedList& params)
|
|||
ok = setCheck(n,s->toBoolean()) && ok;
|
||||
else if (n.startSkip("select:",false))
|
||||
ok = setSelect(n,*s) && ok;
|
||||
else if (n.startSkip("image:",false))
|
||||
ok = setImage(n,*s) && ok;
|
||||
else if (n.startSkip("property:",false)) {
|
||||
// Set property: object_name:property_name=value
|
||||
int pos = n.find(':');
|
||||
|
@ -753,6 +756,9 @@ void ClientThreadProxy::process()
|
|||
case removeMenu:
|
||||
m_rval = m_params && client->removeMenu(*m_params,m_wnd,m_skip);
|
||||
break;
|
||||
case setImage:
|
||||
m_rval = client->setImage(m_name,m_text,m_wnd,m_skip);
|
||||
break;
|
||||
case setProperty:
|
||||
m_rval = client->setProperty(m_name,m_item,m_text,m_wnd,m_skip);
|
||||
break;
|
||||
|
@ -1733,6 +1739,28 @@ bool Client::removeMenu(const NamedList& params, Window* wnd, Window* skip)
|
|||
return ok;
|
||||
}
|
||||
|
||||
// Set an element's image
|
||||
bool Client::setImage(const String& name, const String& image, Window* wnd, Window* skip)
|
||||
{
|
||||
if (!valid())
|
||||
return false;
|
||||
if (needProxy()) {
|
||||
ClientThreadProxy proxy(ClientThreadProxy::setImage,name,image,wnd,skip);
|
||||
return proxy.execute();
|
||||
}
|
||||
if (wnd)
|
||||
return wnd->setImage(name,image);
|
||||
++s_changing;
|
||||
bool ok = false;
|
||||
for (ObjList* o = m_windows.skipNull(); o; o = o->skipNext()) {
|
||||
wnd = static_cast<Window*>(o->get());
|
||||
if (wnd != skip)
|
||||
ok = wnd->setImage(name,image) || ok;
|
||||
}
|
||||
--s_changing;
|
||||
return ok;
|
||||
}
|
||||
|
||||
// Set a property
|
||||
bool Client::setProperty(const String& name, const String& item, const String& value,
|
||||
Window* wnd, Window* skip)
|
||||
|
|
19
yatecbase.h
19
yatecbase.h
|
@ -344,6 +344,14 @@ public:
|
|||
*/
|
||||
virtual bool removeMenu(const NamedList& params) = 0;
|
||||
|
||||
/**
|
||||
* Set an element's image
|
||||
* @param name Name of the element
|
||||
* @param image Image to set
|
||||
* @return True on success
|
||||
*/
|
||||
virtual bool setImage(const String& name, const String& image) = 0;
|
||||
|
||||
/**
|
||||
* Set a property for this window or for a widget owned by it
|
||||
* @param name Name of the element
|
||||
|
@ -1150,6 +1158,17 @@ public:
|
|||
*/
|
||||
bool removeMenu(const NamedList& params, Window* wnd = 0, Window* skip = 0);
|
||||
|
||||
/**
|
||||
* Set an element's image
|
||||
* @param name Name of the element
|
||||
* @param image Image to set
|
||||
* @param wnd Optional target window
|
||||
* @param skip Optional window to skip if wnd is 0
|
||||
* @return True on success
|
||||
*/
|
||||
virtual bool setImage(const String& name, const String& image,
|
||||
Window* wnd = 0, Window* skip = 0);
|
||||
|
||||
/**
|
||||
* Set a property
|
||||
* @param name Name of the element
|
||||
|
|
Loading…
Reference in New Issue