summaryrefslogtreecommitdiff
path: root/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-07 21:25:24 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-07 21:25:24 +0000
commit9bc51533db436502b50aaa0014aa272576968df2 (patch)
tree69130cca051fdf38817fd4c99502b30f804981e8 /NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx
parent1d7b4d2140b3d4dec9554a333e0e442103e3708f (diff)
downloadnuttx-9bc51533db436502b50aaa0014aa272576968df2.tar.gz
nuttx-9bc51533db436502b50aaa0014aa272576968df2.tar.bz2
nuttx-9bc51533db436502b50aaa0014aa272576968df2.zip
Various fixes for running the NxWM unit test on the STM3240G-EVAL
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4711 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx')
-rw-r--r--NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx37
1 files changed, 37 insertions, 0 deletions
diff --git a/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx b/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx
index 9c90a5bfd..afd17e6e2 100644
--- a/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx
+++ b/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx
@@ -84,6 +84,7 @@ CWidgetControl::CWidgetControl(FAR const CWidgetStyle *style)
m_port = (CGraphicsPort *)NULL;
m_modal = false;
+ m_haveGeometry = false;
m_clickedWidget = (CNxWidget *)NULL;
m_focusedWidget = (CNxWidget *)NULL;
@@ -440,14 +441,25 @@ void CWidgetControl::geometryEvent(NXHANDLE hWindow,
m_hWindow = hWindow;
nxgl_rectcopy(&m_bounds, bounds);
+ }
+
+ // In the normal start up sequence, the window is created with zero size
+ // at position 0,0. The safe thing to do is to set the position (still
+ // with size 0, then then set the size. Assuming that is what is being
+ // done, we will not report that we have valid geometry until the size
+ // becomes nonzero.
+ if (!m_haveGeometry && size->h > 0 && size->w > 0)
+ {
// Wake up any threads waiting for initial position information.
// REVISIT: If the window is moved or repositioned, then the
// position and size data will be incorrect for a period of time.
// That case should be handled here as well.
+ m_haveGeometry = true;
giveGeoSem();
}
+
sched_unlock();
}
@@ -650,6 +662,31 @@ void CWidgetControl::newCursorControlEvent(ECursorControl cursorControl)
}
/**
+ * The creation sequence is:
+ *
+ * 1) Create a dumb CWigetControl instance
+ * 2) Pass the dumb CWidgetControl instance to the window constructor
+ * that inherits from INxWindow.
+ * 3) The call this method with the static_cast to INxWindow to,
+ * finally, create the CGraphicsPort for this window.
+ * 4) After that, the fully smartend CWidgetControl instance can
+ * be used to generate additional widgets.
+ *
+ * @param window The instance of INxWindow needed to construct the
+ * CGraphicsPort instance
+ */
+
+bool CWidgetControl::createGraphicsPort(INxWindow *window)
+{
+#ifdef CONFIG_NX_WRITEONLY
+ m_port = new CGraphicsPort(window, m_style.colors.background);
+#else
+ m_port = new CGraphicsPort(window);
+#endif
+ return m_port != (CGraphicsPort *)NULL;
+}
+
+/**
* Copy a widget style
*
* @param dest The destination style