return priv->getPosition();
}
-bool DSWindowShell::setSize(int w, int h)
+bool DSWindowShell::setSize(unsigned int w, unsigned int h)
{
DS_GET_PRIV(DSWindowShell);
return priv->setSize(w, h);
}
+void DSWindowShell::setGeometry(int x, int y, unsigned int w, unsigned int h)
+{
+ DS_GET_PRIV(DSWindowShell);
+ return priv->setGeometry(x, y, w, h);
+}
+
+stGeometry DSWindowShell::getGeometry(void)
+{
+ DS_GET_PRIV(DSWindowShell);
+ return priv->getGeometry();
+}
bool DSWindowShell::show(void)
{
bool setPosition(int x, int y);
stPosition getPosition(void);
- bool setSize(int w, int h);
+ bool setSize(unsigned int w, unsigned int h);
+
+ void setGeometry(int x, int y, unsigned int w, unsigned int h);
+ stGeometry getGeometry(void);
bool show(void);
bool hide(bool autoFocus = true);
DSWindowShellPrivate::DSWindowShellPrivate(DSWindowShell *p_ptr, DSWindow *window)
: __p_ptr(p_ptr),
- __window(window)
+ __window(window),
+ __x(0), __y(0),
+ __w(1), __h(1)
{
}
bool DSWindowShellPrivate::create(int x, int y, unsigned int w, unsigned int h, DSWindowShell *pParent)
{
+ __x = x;
+ __y = y;
+ __w = w;
+ __h = h;
+
+ if (__window)
+ __window->setSize(__w, __h);
+
return true;
}
bool DSWindowShellPrivate::setPosition(int x, int y)
{
+ __x = x;
+ __y = y;
+
return true;
}
{
stPosition pos;
- pos.x = 0;
- pos.y = 0;
+ pos.x = __x;
+ pos.y = __y;
return pos;
}
-bool DSWindowShellPrivate::setSize(int w, int h)
+bool DSWindowShellPrivate::setSize(unsigned int w, unsigned int h)
{
+ __w = w;
+ __h = h;
+
+ if (__window)
+ __window->setSize(__w, __h);
+
return true;
}
+void DSWindowShellPrivate::setGeometry(int x, int y, unsigned int w, unsigned int h)
+{
+ __x = x;
+ __y = y;
+ __w = w;
+ __h = h;
+
+ if (__window)
+ __window->setSize(__w, __h);
+}
+
+stGeometry DSWindowShellPrivate::getGeometry(void)
+{
+ stGeometry geo;
+ geo.x = __x;
+ geo.y = __y;
+ geo.w = __w;
+ geo.h = __h;
+ return geo;
+}
+
bool DSWindowShellPrivate::show(void)
{
#ifndef _DS_WINDOW_SHELL_PRIVATE_H_
#define _DS_WINDOW_SHELL_PRIVATE_H_
+#include "DSWindow.h"
+
namespace display_server
{
bool setPosition(int x, int y);
stPosition getPosition(void);
- bool setSize(int w, int h);
+ bool setSize(unsigned int w, unsigned int h);
+
+ void setGeometry(int x, int y, unsigned int w, unsigned int h);
+ stGeometry getGeometry(void);
bool show(void);
bool hide(bool autoFocus = true);
private:
DSWindow *__window;
+ int __x, __y;
+ unsigned int __w, __h;
};
}
__windowShellList.push_front(shell);
__windowShellMap.insert(std::make_pair(ptrWindow->surface(), shell.get()));
+ shell->setGeometry(__position.x, __position.y, __size.w, __size.h);
+
// emit a signal of the shell created
__windowShellCreatedSignal.emit(shell);
EXPECT_TRUE(shell->setSize(720, 1280) == true);
}
+TEST_F(DSWindowShellTest, Geometry_P1)
+{
+ stGeometry geo;
+
+ auto window = std::make_shared<DSWindow>();
+ std::unique_ptr<DSWindowShell> shell = std::make_unique<DSWindowShell>(window.get());
+ EXPECT_TRUE(shell != nullptr);
+
+ EXPECT_TRUE(shell->create(0, 0, 720, 1280, nullptr) == true);
+
+ shell->setGeometry(100, 150, 480, 800);
+ geo = shell->getGeometry();
+
+ EXPECT_TRUE(geo.x == 100);
+ EXPECT_TRUE(geo.y == 150);
+ EXPECT_TRUE(geo.w == 480);
+ EXPECT_TRUE(geo.h == 800);
+}
+
TEST_F(DSWindowShellTest, show_P1)
{
auto window = std::make_shared<DSWindow>();