30 #include "pedigree/native/graphics/Graphics.h" 31 #include "pedigree/native/input/Input.h" 32 #include "pedigree/native/ipc/Ipc.h" 34 #include <cairo/cairo.h> 42 #define WINDOW_BORDER_X 2 43 #define WINDOW_BORDER_Y 2 44 #define WINDOW_TITLE_H 20 47 #define WINDOW_CLIENT_START_X (WINDOW_BORDER_X) 48 #define WINDOW_CLIENT_START_Y (WINDOW_BORDER_Y + WINDOW_TITLE_H) 51 #define WINDOW_CLIENT_END_X (WINDOW_BORDER_X) 52 #define WINDOW_CLIENT_END_Y (WINDOW_BORDER_Y) 56 #define WINDOW_CLIENT_LOST_W (WINDOW_CLIENT_START_X + WINDOW_CLIENT_END_X + 1) 57 #define WINDOW_CLIENT_LOST_H (WINDOW_CLIENT_START_Y + WINDOW_CLIENT_END_Y + 1) 59 #define WINMAN_PANGO_FONT "DejaVu Sans Mono 12" 72 void point(
size_t x,
size_t y);
90 size_t getWidth()
const 92 return m_X2 - m_X + 1;
94 size_t getHeight()
const 96 return m_Y2 - m_Y + 1;
108 size_t m_X, m_Y, m_X2, m_Y2;
129 WObject() : m_Dimensions(0, 0, 0, 0)
137 virtual Type getType()
const = 0;
140 ssize_t horizDistance, ssize_t vertDistance,
WObject *pChild = 0) = 0;
143 size_t x = ~0UL,
size_t y = ~0UL,
size_t w = ~0UL,
size_t h = ~0UL);
145 void bump(ssize_t bumpX = 0, ssize_t bumpY = 0);
147 virtual void resized()
167 virtual void render(cairo_t *cr)
199 uint64_t handle,
int sock,
struct sockaddr *sa,
size_t sa_len,
205 virtual Type getType()
const 207 return WObject::Window;
210 virtual void setTitle(
const std::string &s)
213 m_bPendingDecoration =
true;
216 virtual void render(cairo_t *cr);
219 resize(ssize_t horizDistance, ssize_t vertDistance,
WObject *pChild = 0);
221 virtual void focus();
222 virtual void nofocus();
237 virtual void refreshContext();
239 void *getFramebuffer()
const;
241 virtual void sendMessage(
const char *msg,
size_t len);
243 uint64_t getHandle()
const 263 if (m_bPendingDecoration)
267 rt.update(0, 0, rt.getW(), rt.getH());
275 return m_bPendingDecoration || isClientDirty();
279 bool isClientDirty()
const 282 m_Dirty.getX() == 0 && m_Dirty.getY() == 0 && m_Dirty.getW() == 0 &&
283 m_Dirty.getH() == 0);
292 std::string m_sWindowTitle;
296 bool m_bPendingDecoration;
302 size_t m_nRegionWidth;
303 size_t m_nRegionHeight;
306 struct sockaddr *m_Sa;
317 typedef std::vector<WObject *> WObjectList_t;
327 : m_Children(), m_pParent(pParent), m_Layout(SideBySide),
336 virtual Type getType()
const 338 return WObject::Container;
341 Layout getLayout()
const 346 void setLayout(Layout newLayout)
348 m_Layout = newLayout;
354 return m_pFocusWindow;
357 void setFocusWindow(::
Window *w)
369 m_Children.push_back(pChild);
370 if ((pChild->getType() == WObject::Window) && (m_pFocusWindow == NULL))
372 m_pFocusWindow =
static_cast<::
Window *
>(pChild);
386 WObjectList_t::iterator it = m_Children.begin();
387 for (; it != m_Children.end(); ++it)
391 it = m_Children.erase(it);
392 m_Children.insert(it, pNewChild);
404 WObjectList_t::iterator it = m_Children.begin();
405 for (; it != m_Children.end(); ++it)
407 if ((*it) == pCurrent)
410 it = m_Children.insert(it, pNewChild);
415 if (it == m_Children.end())
417 m_Children.push_back(pNewChild);
428 WObjectList_t::iterator it = m_Children.begin();
429 for (; it != m_Children.end(); ++it)
433 m_Children.erase(it);
439 if (it != m_Children.end())
450 return m_Children.size();
458 if (n > m_Children.size())
463 return m_Children[n];
484 WObject *getLeftObject()
const;
490 WObject *getRightObject()
const;
541 resize(ssize_t horizDistance, ssize_t vertDistance,
WObject *pChild = 0);
546 void render(cairo_t *cr);
549 virtual void norefresh();
552 virtual void yesrefresh();
555 std::vector<WObject *> m_Children;
577 reposition(0, 0, w, h);
580 virtual Type getType()
const 582 return WObject::Root;
586 resize(ssize_t horizDistance, ssize_t vertDistance,
WObject *pChild = 0);
virtual void norefresh()
Don't refresh the context on every reposition.
WObject * getParent() const
virtual void yesrefresh()
Refresh context on every reposition.
void replaceChild(WObject *pChild, WObject *pNewChild)
size_t getChildCount() const
void addChild(WObject *pChild, bool bNoRetile=false)
Abstracts a buffer shared between multiple processes.
void insertChild(WObject *pCurrent, WObject *pNewChild)
void removeChild(WObject *pChild)
WObject * getChild(size_t n) const
virtual void yesrefresh()
Refresh context on every reposition.
virtual void norefresh()
Don't refresh the context on every reposition.
virtual void refreshContext()
Refresh our graphical context, called after reposition.