wxLayoutStyleInfo ctor doesn't set all fields to -1
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2726 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1772,22 +1772,38 @@ wxLayoutList::MoveCursorWord(int n)
|
|||||||
wxLayoutObject *obj = *i;
|
wxLayoutObject *obj = *i;
|
||||||
if( obj->GetType() != WXLO_TYPE_TEXT )
|
if( obj->GetType() != WXLO_TYPE_TEXT )
|
||||||
{
|
{
|
||||||
// any non text objects count as one word
|
// any visible non text objects count as one word
|
||||||
n > 0 ? n-- : n++;
|
if ( obj->IsVisibleObject() )
|
||||||
|
{
|
||||||
|
n > 0 ? n-- : n++;
|
||||||
|
|
||||||
moveDistance += obj->GetLength();
|
moveDistance += obj->GetLength();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else // text object
|
||||||
{
|
{
|
||||||
// text object
|
|
||||||
wxLayoutObjectText *tobj = (wxLayoutObjectText *)obj;
|
wxLayoutObjectText *tobj = (wxLayoutObjectText *)obj;
|
||||||
|
|
||||||
|
bool canAdvance = true;
|
||||||
|
|
||||||
if ( offset == tobj->GetLength() )
|
if ( offset == tobj->GetLength() )
|
||||||
{
|
{
|
||||||
// at end of object
|
// at end of object
|
||||||
n > 0 ? n-- : n++;
|
if ( n > 0 )
|
||||||
|
{
|
||||||
|
// can't move further in this text object
|
||||||
|
n--;
|
||||||
|
|
||||||
|
canAdvance = false;
|
||||||
|
}
|
||||||
|
else if ( offset > 0 )
|
||||||
|
{
|
||||||
|
// offset is off by 1, make it a valid index
|
||||||
|
offset--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if ( canAdvance )
|
||||||
{
|
{
|
||||||
const char *start = tobj->GetText().c_str();
|
const char *start = tobj->GetText().c_str();
|
||||||
const char *p = start + offset;
|
const char *p = start + offset;
|
||||||
|
@@ -203,6 +203,10 @@ public:
|
|||||||
*/
|
*/
|
||||||
static wxLayoutObject *Read(wxString &istr);
|
static wxLayoutObject *Read(wxString &istr);
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
/// returns TRUE if the object is shown on the screen (i.e. not cmd object)
|
||||||
|
bool IsVisibleObject() const { return GetType() != WXLO_TYPE_CMD; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// optional data for application's use
|
/// optional data for application's use
|
||||||
UserData *m_UserData;
|
UserData *m_UserData;
|
||||||
@@ -214,7 +218,7 @@ KBLIST_DEFINE(wxLayoutObjectList, wxLayoutObject);
|
|||||||
/// An illegal iterator to save typing.
|
/// An illegal iterator to save typing.
|
||||||
#define NULLIT (wxLayoutObjectList::iterator(NULL))
|
#define NULLIT (wxLayoutObjectList::iterator(NULL))
|
||||||
/// The iterator type.
|
/// The iterator type.
|
||||||
#define wxLOiterator wxLayoutObjectList::iterator
|
typedef wxLayoutObjectList::iterator wxLOiterator;
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
|
||||||
@@ -316,23 +320,21 @@ private:
|
|||||||
wxBitmap *m_Icon;
|
wxBitmap *m_Icon;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** This structure holds all formatting information. Members which are
|
/** This structure holds all formatting information.
|
||||||
undefined (for a CmdObject this means: no change), are set to -1.
|
|
||||||
*/
|
*/
|
||||||
struct wxLayoutStyleInfo
|
struct wxLayoutStyleInfo
|
||||||
{
|
{
|
||||||
wxLayoutStyleInfo(int ifamily = -1,
|
wxLayoutStyleInfo(int ifamily = wxDEFAULT,
|
||||||
int isize = -1,
|
int isize = WXLO_DEFAULTFONTSIZE,
|
||||||
int istyle = -1,
|
int istyle = wxNORMAL,
|
||||||
int iweight = -1,
|
int iweight = wxNORMAL,
|
||||||
int iul = -1,
|
int iul = FALSE,
|
||||||
wxColour *fg = NULL,
|
wxColour *fg = NULL,
|
||||||
wxColour *bg = NULL);
|
wxColour *bg = NULL);
|
||||||
wxColour & GetBGColour()
|
|
||||||
{
|
|
||||||
return m_bg;
|
|
||||||
}
|
|
||||||
wxLayoutStyleInfo & operator=(const wxLayoutStyleInfo &right);
|
wxLayoutStyleInfo & operator=(const wxLayoutStyleInfo &right);
|
||||||
|
|
||||||
|
wxColour & GetBGColour() { return m_bg; }
|
||||||
|
|
||||||
/// Font change parameters.
|
/// Font change parameters.
|
||||||
int size, family, style, weight, underline;
|
int size, family, style, weight, underline;
|
||||||
/// Colours
|
/// Colours
|
||||||
@@ -340,7 +342,7 @@ struct wxLayoutStyleInfo
|
|||||||
int m_fg_valid, m_bg_valid; // bool, but must be int!
|
int m_fg_valid, m_bg_valid; // bool, but must be int!
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// a cached font
|
||||||
class wxFontCacheEntry
|
class wxFontCacheEntry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -366,6 +368,8 @@ public:
|
|||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
wxFont *m_Font;
|
wxFont *m_Font;
|
||||||
|
|
||||||
|
// VZ: I wonder why it doesn't use wxLayoutStyleInfo instead of those?
|
||||||
int m_Family, m_Size, m_Style, m_Weight;
|
int m_Family, m_Size, m_Style, m_Weight;
|
||||||
bool m_Underline;
|
bool m_Underline;
|
||||||
};
|
};
|
||||||
|
@@ -633,10 +633,9 @@ wxLayoutWindow::OnPaint( wxPaintEvent &WXUNUSED(event))
|
|||||||
void
|
void
|
||||||
wxLayoutWindow::DoPaint(const wxRect *updateRect)
|
wxLayoutWindow::DoPaint(const wxRect *updateRect)
|
||||||
{
|
{
|
||||||
// Causes bad flicker under wxGTK!!!
|
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
InternalPaint(updateRect);
|
InternalPaint(updateRect);
|
||||||
#else
|
#else // Causes bad flicker under wxGTK!!!
|
||||||
Refresh(FALSE); //, updateRect);
|
Refresh(FALSE); //, updateRect);
|
||||||
|
|
||||||
if ( !::UpdateWindow(GetHwnd()) )
|
if ( !::UpdateWindow(GetHwnd()) )
|
||||||
|
Reference in New Issue
Block a user