mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-10-06 05:43:01 +00:00
Squashed commit of the following:
apps/graphics/twm4nx: Try to improve icon text spacing. Not noticeably better, however.
apps/graphics: Split long icon title on two lines below the icon image.
apps/graphics/twm4nx: Both iconification and de-iconification work.
apps/graphics/twm4nx: Various fixed toward de-iconifying a window. Progress but still not there yet.
This commit is contained in:
parent
1879949cdc
commit
02c148e07e
7 changed files with 362 additions and 145 deletions
|
|
@ -169,6 +169,11 @@ namespace NXWidgets
|
|||
|
||||
nxgl_coord_t getStringWidth(const CNxString &text) const;
|
||||
|
||||
inline nxgl_coord_t getStringWidth(FAR const CNxString *text) const
|
||||
{
|
||||
return getStringWidth(*text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the width of a portion of a string in pixels when drawn with this
|
||||
* font.
|
||||
|
|
@ -179,9 +184,15 @@ namespace NXWidgets
|
|||
* @return The width of the substring in pixels.
|
||||
*/
|
||||
|
||||
nxgl_coord_t getStringWidth(const CNxString& text,
|
||||
nxgl_coord_t getStringWidth(const CNxString &text,
|
||||
int startIndex, int length) const;
|
||||
|
||||
inline nxgl_coord_t getStringWidth(FAR const CNxString *text,
|
||||
int startIndex, int length) const
|
||||
{
|
||||
return getStringWidth(*text, startIndex, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets font metrics for a particular character
|
||||
*
|
||||
|
|
|
|||
|
|
@ -257,6 +257,11 @@ namespace NXWidgets
|
|||
|
||||
void setText(const CNxString &text);
|
||||
|
||||
inline void setText(FAR const CNxString *text)
|
||||
{
|
||||
setText(*text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the text in the string.
|
||||
*
|
||||
|
|
@ -433,7 +438,7 @@ namespace NXWidgets
|
|||
* substring.
|
||||
*/
|
||||
|
||||
CNxString *subString(int startIndex) const;
|
||||
FAR CNxString *subString(int startIndex) const;
|
||||
|
||||
/**
|
||||
* Get a substring from this string. It is the responsibility of the
|
||||
|
|
@ -445,7 +450,7 @@ namespace NXWidgets
|
|||
* substring.
|
||||
*/
|
||||
|
||||
CNxString *subString(int startIndex, int length) const;
|
||||
FAR CNxString *subString(int startIndex, int length) const;
|
||||
|
||||
/**
|
||||
* Overloaded assignment operator. Copies the data within the argument
|
||||
|
|
|
|||
|
|
@ -102,16 +102,6 @@ namespace Twm4Nx
|
|||
|
||||
bool createBackgroundImage(FAR const struct NXWidgets::SRlePaletteBitmap *sbitmap);
|
||||
|
||||
/**
|
||||
* Handle the background window redraw.
|
||||
*
|
||||
* @param nxRect The region in the window to be redrawn
|
||||
* @param more More redraw requests will follow
|
||||
* @return true on success
|
||||
*/
|
||||
|
||||
bool redrawBackgroundWindow(FAR const struct nxgl_rect_s *rect, bool more);
|
||||
|
||||
public:
|
||||
/**
|
||||
* CBackground Constructor
|
||||
|
|
@ -157,6 +147,16 @@ namespace Twm4Nx
|
|||
|
||||
void getDisplaySize(FAR struct nxgl_size_s &size);
|
||||
|
||||
/**
|
||||
* Handle the background window redraw.
|
||||
*
|
||||
* @param nxRect The region in the window to be redrawn
|
||||
* @param more More redraw requests will follow
|
||||
* @return true on success
|
||||
*/
|
||||
|
||||
bool redrawBackgroundWindow(FAR const struct nxgl_rect_s *rect, bool more);
|
||||
|
||||
/**
|
||||
* Handle EVENT_BACKGROUND events.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -76,7 +76,8 @@ namespace NXWidgets
|
|||
|
||||
namespace Twm4Nx
|
||||
{
|
||||
class FAR CTwm4Nx; // Forward reference
|
||||
class CTwm4Nx; // Forward reference
|
||||
class CWindow; // Forward reference
|
||||
|
||||
/**
|
||||
* Container class that holds the Icon image and table widgets
|
||||
|
|
@ -87,6 +88,7 @@ namespace Twm4Nx
|
|||
{
|
||||
protected:
|
||||
FAR CTwm4Nx *m_twm4nx; /**< Cached Twm4Nx session */
|
||||
FAR CWindow *m_parent; /**< The parent window (for de-iconify) */
|
||||
mqd_t m_eventq; /**< NxWidget event message queue */
|
||||
FAR NXWidgets::CWidgetControl *m_widgetControl; /**< The controlling widget */
|
||||
|
||||
|
|
@ -96,6 +98,7 @@ namespace Twm4Nx
|
|||
struct nxgl_point_s m_dragOffset; /**< Offset from mouse to window origin */
|
||||
struct nxgl_size_s m_dragCSize; /**< The grab cursor size */
|
||||
bool m_drag; /**< Drag in-progress */
|
||||
bool m_moved; /**< Icon has been moved */
|
||||
|
||||
/**
|
||||
* After the widget has been grabbed, it may be dragged then dropped,
|
||||
|
|
@ -225,12 +228,13 @@ namespace Twm4Nx
|
|||
* Perform widget initialization that could fail and so it not appropriate
|
||||
* for the constructor
|
||||
*
|
||||
* @param parent The parent window. Needed for de-iconification.
|
||||
* @param ibitmap The bitmap image representing the icon
|
||||
* @param title The icon title string
|
||||
* @return True is returned if the widget is successfully initialized.
|
||||
*/
|
||||
|
||||
bool initialize(FAR NXWidgets::IBitmap *ibitmap,
|
||||
bool initialize(FAR CWindow *parent, FAR NXWidgets::IBitmap *ibitmap,
|
||||
FAR const NXWidgets::CNxString &title);
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue