// implementation
// ===========================================================================
+/* LEAVE IT HERE UNTIL WXGTK WORKS AGAIN!!! */
+#ifdef __WXGTK__
+/// allows me to compare to wxPoints
+static bool operator != (wxPoint const &p1, wxPoint const &p2)
+{
+ return p1.x != p2.x || p1.y != p2.y;
+}
+#endif // __WXGTK__
+
+#ifndef wxWANTS_CHARS
+ #define wxWANTS_CHARS 0
+#endif
+
// ----------------------------------------------------------------------------
// wxLayoutWindow
// ----------------------------------------------------------------------------
wxHSCROLL | wxVSCROLL |
wxBORDER |
wxWANTS_CHARS)
-
{
SetStatusBar(NULL); // don't use statusbar
m_Editable = false;
wxColour *bg)
{
GetLayoutList()->Clear(family,size,style,weight,underline,fg,bg);
- SetBackgroundColour(GetLayoutList()->GetDefaults()->GetBGColour());
+ SetBackgroundColour(GetLayoutList()->GetDefaultStyleInfo().GetBGColour());
ResizeScrollbars(true);
SetDirty();
SetModified(false);
-
+ wxScrolledWindow::Clear();
DoPaint((wxRect *)NULL);
}
{
if(! m_Selecting)
{
- m_llist->StartSelection();
+ m_llist->StartSelection(wxPoint(-1, -1), m_ClickPosition);
m_Selecting = true;
- DoPaint(FALSE);
+ DoPaint(); // TODO: we don't have to redraw everything!
}
else
{
- m_llist->ContinueSelection(cursorPos);
- DoPaint(FALSE);
+ m_llist->ContinueSelection(cursorPos, m_ClickPosition);
+ DoPaint(); // TODO: we don't have to redraw everything!
}
}
if(m_Selecting && ! event.LeftIsDown())
{
- m_llist->EndSelection(cursorPos);
+ m_llist->EndSelection(cursorPos, m_ClickPosition);
m_Selecting = false;
- DoPaint(FALSE);
+ DoPaint(); // TODO: we don't have to redraw everything!
}
- if(u) u->DecRef();
- return;
- }
- // always move cursor to mouse click:
- if(eventId == WXLOWIN_MENU_LCLICK)
+ if ( u )
+ {
+ u->DecRef();
+ u = NULL;
+ }
+ }
+ else if(eventId == WXLOWIN_MENU_LCLICK)
{
+ // always move cursor to mouse click:
m_llist->MoveCursorTo(cursorPos);
+ // clicking a mouse removes the selection
+ if ( m_llist->HasSelection() )
+ {
+ m_llist->DiscardSelection();
+ DoPaint(); // TODO: we don't have to redraw everything!
+ }
+
// Calculate where the top of the visible area is:
int x0, y0;
ViewStart(&x0,&y0);
#endif // 0
#ifdef __WXGTK__
- DoPaint(FALSE); // DoPaint suppresses flicker under GTK
+ DoPaint(); // DoPaint suppresses flicker under GTK
#endif // wxGTK
}
- if(!m_doSendEvents) // nothing to do
+ // notify about mouse events?
+ if( m_doSendEvents )
{
- if(u) u->DecRef();
- return;
- }
+ // only do the menu if activated, editable and not on a clickable object
+ if(eventId == WXLOWIN_MENU_RCLICK
+ && IsEditable()
+ && (! obj || u == NULL))
+ {
+ PopupMenu(m_PopupMenu, m_ClickPosition.x, m_ClickPosition.y);
+ if(u) u->DecRef();
+ return;
+ }
- // only do the menu if activated, editable and not on a clickable object
- if(eventId == WXLOWIN_MENU_RCLICK
- && IsEditable()
- && (! obj || u == NULL))
- {
- PopupMenu(m_PopupMenu, m_ClickPosition.x, m_ClickPosition.y);
- if(u) u->DecRef();
- return;
+ // find the object at this position
+ if(obj)
+ {
+ wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, eventId);
+ commandEvent.SetEventObject( this );
+ commandEvent.SetClientData((char *)obj);
+ GetEventHandler()->ProcessEvent(commandEvent);
+ }
}
- if(u) u->DecRef();
- // find the object at this position
- if(obj)
- {
- wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, eventId);
- commandEvent.SetEventObject( this );
- commandEvent.SetClientData((char *)obj);
- GetEventHandler()->ProcessEvent(commandEvent);
- }
+ if( u )
+ u->DecRef();
}
/*
// Make sure that the scrollbars are at a position so that the cursor is
// visible if we are editing
WXLO_DEBUG(("m_ScrollToCursor = %d", (int) m_ScrollToCursor));
- wxPoint cc = m_llist->GetCursorScreenPos(*m_memDC);
+ wxPoint cc = m_llist->GetCursorScreenPos(dc);
// the cursor should be completely visible in both directions
wxPoint cs(m_llist->GetCursorSize());
}
m_memDC->SetDeviceOrigin(0,0);
- m_memDC->SetBrush(wxBrush(m_llist->GetDefaults()->GetBGColour(),wxSOLID));
- m_memDC->SetPen(wxPen(m_llist->GetDefaults()->GetBGColour(),
+ m_memDC->SetBrush(wxBrush(m_llist->GetDefaultStyleInfo().GetBGColour(),wxSOLID));
+ m_memDC->SetPen(wxPen(m_llist->GetDefaultStyleInfo().GetBGColour(),
0,wxTRANSPARENT));
m_memDC->SetLogicalFunction(wxCOPY);
+ m_memDC->Clear();
- /* Either fill the background with the background bitmap, or clear
- it. */
+ // fill the background with the background bitmap
if(m_BGbitmap)
{
CoordType
m_memDC->DrawBitmap(*m_BGbitmap, x, y);
m_memDC->SetBackgroundMode(wxTRANSPARENT);
}
- else
- {
- // clear the background: (must not be done if we use the update rectangle!)
- m_memDC->SetBackgroundMode(wxSOLID);
- m_memDC->DrawRectangle(0,0,x1, y1);
- }
-
- /* This is the important bit: we tell the list to draw itself: */
+ // This is the important bit: we tell the list to draw itself
#if WXLO_DEBUG_URECT
if(updateRect)
{