diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-05-02 22:03:05 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-05-02 22:03:05 +0000 |
commit | 4b489525b44d49fa0f8cb95733dd0fdf4553c884 (patch) | |
tree | 8773aca5097c9c4fd1006bf1e35685c55619ce17 /NxWidgets/libnxwidgets/src | |
parent | 5ebf11ee63f1baaf070fd8484d99362810cd5bcc (diff) | |
download | px4-nuttx-4b489525b44d49fa0f8cb95733dd0fdf4553c884.tar.gz px4-nuttx-4b489525b44d49fa0f8cb95733dd0fdf4553c884.tar.bz2 px4-nuttx-4b489525b44d49fa0f8cb95733dd0fdf4553c884.zip |
NxWM updates (with some NX and NxWidget fixes too)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4689 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'NxWidgets/libnxwidgets/src')
-rw-r--r-- | NxWidgets/libnxwidgets/src/cnxtkwindow.cxx | 43 | ||||
-rw-r--r-- | NxWidgets/libnxwidgets/src/cnxtoolbar.cxx | 6 |
2 files changed, 43 insertions, 6 deletions
diff --git a/NxWidgets/libnxwidgets/src/cnxtkwindow.cxx b/NxWidgets/libnxwidgets/src/cnxtkwindow.cxx index bae9cb815..520896fa2 100644 --- a/NxWidgets/libnxwidgets/src/cnxtkwindow.cxx +++ b/NxWidgets/libnxwidgets/src/cnxtkwindow.cxx @@ -124,7 +124,9 @@ CWidgetControl *CNxTkWindow::getWidgetControl(void) const } /** - * Open a toolbar on the framed window + * Open a toolbar on the framed window. This method both instantiates + * the toolbar object AND calls the INxWindow::open() method to + * create the toolbar. The toolbar is ready for use upon return. * * @param height Height of the toolbar */ @@ -133,13 +135,42 @@ CNxToolbar *CNxTkWindow::openToolbar(nxgl_coord_t height) { if (m_hNxTkWindow && !m_toolbar) { - // Create the toolbar. Note that we use the SAME underlying - // widget control. That is because the tool bar really resides - // in the same "physical" window. - + // Get current window style from the widget control + + CWidgetStyle style; + m_widgetControl->getWidgetStyle(&style); + + // Set the background color to the color of the toolbar + + style.colors.background = CONFIG_NXTK_BORDERCOLOR1; + + // Create a new controlling widget for the window + + CWidgetControl *widgetControl = new CWidgetControl(&style); + + // And create the toolbar + m_toolbar = new CNxToolbar(this, m_hNxTkWindow, - m_widgetControl, height); + widgetControl, height); + if (!m_toolbar) + { + delete widgetControl; + return (CNxToolbar *)0; + } + + // Create the new toolbar. Toolbar creation is separate from + // object instantiation so that failures can be reported. + + if (!m_toolbar->open()) + { + // Failed to create the toolbar. Clean-up and return NULL + + delete m_toolbar; + delete widgetControl; + return (CNxToolbar *)0; + } } + return m_toolbar; } diff --git a/NxWidgets/libnxwidgets/src/cnxtoolbar.cxx b/NxWidgets/libnxwidgets/src/cnxtoolbar.cxx index 1c560deb1..b14a0b611 100644 --- a/NxWidgets/libnxwidgets/src/cnxtoolbar.cxx +++ b/NxWidgets/libnxwidgets/src/cnxtoolbar.cxx @@ -69,10 +69,16 @@ CNxToolbar::CNxToolbar(CNxTkWindow *pNxTkWindow, NXTKWINDOW hNxTkWindow, CWidgetControl *pWidgetControl, nxgl_coord_t height) : CCallback(pWidgetControl) { + // Initialize toolbar state data + m_nxTkWindow = pNxTkWindow; m_hNxTkWindow = hNxTkWindow; m_widgetControl = pWidgetControl; m_height = height; + + // Create the CGraphicsPort instance for this window + + m_widgetControl->createGraphicsPort(static_cast<INxWindow*>(this)); } /** |