mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-02 03:51:35 +08:00
NxWM updates (with some NX and NxWidget fixes too)
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4689 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user