ADDED wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK

Corrected inheritence of wxTreeEvent, wxNotebookEvent, wxListEvent on
    wxMSW and wxGTK
  Corrected scrolling step etc. in wxListCtrl
  Built-in correction of out-of-bounds values for position of scrollbar thumb
  Reverted interpretation of wxVERTICAL for radiobox
  Applied Phls patch for wxStaticText


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1172 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1998-12-11 15:41:28 +00:00
parent 16553659df
commit 92976ab62b
26 changed files with 656 additions and 635 deletions

View File

@@ -56,8 +56,8 @@ user::
install:: install::
@echo "entering directory src for installing" @echo "entering directory src for installing"
@cd src; ${MAKE} install @cd src; ${MAKE} install
@echo "entering directory utils for installing" # @echo "entering directory utils for installing"
@cd utils; ${MAKE} install # @cd utils; ${MAKE} install
# the following ones recreate all Makefiles. # the following ones recreate all Makefiles.

View File

@@ -179,6 +179,8 @@ const wxEventType wxEVT_COMMAND_LIST_ITEM_DESELECTED = wxEVT_FIRST + 709;
const wxEventType wxEVT_COMMAND_LIST_KEY_DOWN = wxEVT_FIRST + 710; const wxEventType wxEVT_COMMAND_LIST_KEY_DOWN = wxEVT_FIRST + 710;
const wxEventType wxEVT_COMMAND_LIST_INSERT_ITEM = wxEVT_FIRST + 711; const wxEventType wxEVT_COMMAND_LIST_INSERT_ITEM = wxEVT_FIRST + 711;
const wxEventType wxEVT_COMMAND_LIST_COL_CLICK = wxEVT_FIRST + 712; const wxEventType wxEVT_COMMAND_LIST_COL_CLICK = wxEVT_FIRST + 712;
const wxEventType wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK = wxEVT_FIRST + 713;
const wxEventType wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK = wxEVT_FIRST + 714;
/* Tab and notebook control event types */ /* Tab and notebook control event types */
const wxEventType wxEVT_COMMAND_TAB_SEL_CHANGED = wxEVT_FIRST + 800; const wxEventType wxEVT_COMMAND_TAB_SEL_CHANGED = wxEVT_FIRST + 800;
@@ -362,7 +364,7 @@ public:
private: private:
bool m_bAllow; bool m_bAllow;
DECLARE_DYNAMIC_CLASS(wxCommandEvent) DECLARE_DYNAMIC_CLASS(wxNotifyEvent)
}; };
// Scroll event class // Scroll event class

View File

@@ -190,7 +190,7 @@ class wxListItem: public wxObject
// wxListEvent // wxListEvent
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class WXDLLEXPORT wxListEvent: public wxCommandEvent class WXDLLEXPORT wxListEvent: public wxNotifyEvent
{ {
DECLARE_DYNAMIC_CLASS(wxListEvent) DECLARE_DYNAMIC_CLASS(wxListEvent)
@@ -222,7 +222,8 @@ typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&);
#define EVT_LIST_KEY_DOWN(id, fn) { wxEVT_COMMAND_LIST_KEY_DOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL }, #define EVT_LIST_KEY_DOWN(id, fn) { wxEVT_COMMAND_LIST_KEY_DOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
#define EVT_LIST_INSERT_ITEM(id, fn) { wxEVT_COMMAND_LIST_INSERT_ITEM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL }, #define EVT_LIST_INSERT_ITEM(id, fn) { wxEVT_COMMAND_LIST_INSERT_ITEM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
#define EVT_LIST_COL_CLICK(id, fn) { wxEVT_COMMAND_LIST_COL_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL }, #define EVT_LIST_COL_CLICK(id, fn) { wxEVT_COMMAND_LIST_COL_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
#define EVT_LIST_ITEM_RIGHT_CLICK(id, fn) { wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
#define EVT_LIST_ITEM_MIDDLE_CLICK(id, fn) { wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxListItemData (internal) // wxListItemData (internal)
@@ -461,7 +462,6 @@ class wxListMainWindow: public wxScrolledWindow
void RefreshLine( wxListLineData *line ); void RefreshLine( wxListLineData *line );
void OnPaint( wxPaintEvent &event ); void OnPaint( wxPaintEvent &event );
void HilightAll( bool on ); void HilightAll( bool on );
void ActivateLine( wxListLineData *line );
void SendNotify( wxListLineData *line, wxEventType command ); void SendNotify( wxListLineData *line, wxEventType command );
void FocusLine( wxListLineData *line ); void FocusLine( wxListLineData *line );
void UnfocusLine( wxListLineData *line ); void UnfocusLine( wxListLineData *line );
@@ -519,7 +519,6 @@ class wxListMainWindow: public wxScrolledWindow
void InsertColumn( long col, wxListItem &item ); void InsertColumn( long col, wxListItem &item );
// void AddColumn( wxListItem &item ); // void AddColumn( wxListItem &item );
void SortItems( wxListCtrlCompare fn, long data ); void SortItems( wxListCtrlCompare fn, long data );
virtual bool OnListNotify( wxListEvent &event );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
@@ -568,6 +567,7 @@ class wxListCtrl: public wxControl
bool GetItemPosition( long item, wxPoint& pos ) const; bool GetItemPosition( long item, wxPoint& pos ) const;
bool SetItemPosition( long item, const wxPoint& pos ); // not supported in wxGLC bool SetItemPosition( long item, const wxPoint& pos ); // not supported in wxGLC
int GetItemCount(void) const; int GetItemCount(void) const;
int GetColumnCount(void) const;
void SetItemSpacing( int spacing, bool isSmall = FALSE ); void SetItemSpacing( int spacing, bool isSmall = FALSE );
int GetItemSpacing( bool isSmall ) const; int GetItemSpacing( bool isSmall ) const;
int GetSelectedItemCount(void) const; int GetSelectedItemCount(void) const;
@@ -601,7 +601,6 @@ class wxListCtrl: public wxControl
bool ScrollList(int dx, int dy); bool ScrollList(int dx, int dy);
bool SortItems(wxListCtrlCompare fn, long data); bool SortItems(wxListCtrlCompare fn, long data);
bool Update(long item); bool Update(long item);
virtual bool OnListNotify(wxListEvent& WXUNUSED(event)) { return FALSE; }
void OnIdle( wxIdleEvent &event ); void OnIdle( wxIdleEvent &event );
// We have to hand down a few functions // We have to hand down a few functions

View File

@@ -91,7 +91,7 @@ protected:
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// wxTreeEvent - the event generated by the tree control // wxTreeEvent - the event generated by the tree control
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
class WXDLLEXPORT wxTreeEvent : public wxCommandEvent class WXDLLEXPORT wxTreeEvent : public wxNotifyEvent
{ {
friend class wxTreeCtrl; friend class wxTreeCtrl;
public: public:

View File

@@ -32,12 +32,12 @@ class wxNotebookPage;
// notebook events // notebook events
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
class wxNotebookEvent : public wxCommandEvent class wxNotebookEvent : public wxNotifyEvent
{ {
public: public:
wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
int nSel = -1, int nOldSel = -1) int nSel = -1, int nOldSel = -1)
: wxCommandEvent(commandType, id) : wxNotifyEvent(commandType, id)
{ {
m_bAllow = TRUE; m_bAllow = TRUE;
m_nSel = nSel; m_nSel = nSel;

View File

@@ -32,12 +32,12 @@ class wxNotebookPage;
// notebook events // notebook events
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
class wxNotebookEvent : public wxCommandEvent class wxNotebookEvent : public wxNotifyEvent
{ {
public: public:
wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
int nSel = -1, int nOldSel = -1) int nSel = -1, int nOldSel = -1)
: wxCommandEvent(commandType, id) : wxNotifyEvent(commandType, id)
{ {
m_bAllow = TRUE; m_bAllow = TRUE;
m_nSel = nSel; m_nSel = nSel;

View File

@@ -365,9 +365,9 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
panel = new wxPanel(m_notebook); panel = new wxPanel(m_notebook);
// panel->SetBackgroundColour("cadet blue"); // panel->SetBackgroundColour("cadet blue");
// panel->SetForegroundColour("blue"); // panel->SetForegroundColour("blue");
m_radio = new wxRadioBox( panel, ID_RADIOBOX, "That", wxPoint(10,160), wxSize(-1,-1), 2, choices2, 1, wxRA_HORIZONTAL ); m_radio = new wxRadioBox( panel, ID_RADIOBOX, "That", wxPoint(10,160), wxSize(-1,-1), 2, choices2, 1, wxRA_VERTICAL );
// m_radio->SetBackgroundColour("wheat"); // m_radio->SetBackgroundColour("wheat");
m_radio = new wxRadioBox( panel, ID_RADIOBOX, "This", wxPoint(10,10), wxSize(-1,-1), 5, choices, 1, wxRA_VERTICAL ); m_radio = new wxRadioBox( panel, ID_RADIOBOX, "This", wxPoint(10,10), wxSize(-1,-1), 5, choices, 1, wxRA_HORIZONTAL );
// m_radio->SetBackgroundColour("wheat"); // m_radio->SetBackgroundColour("wheat");
(void)new wxButton( panel, ID_RADIOBOX_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) ); (void)new wxButton( panel, ID_RADIOBOX_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) );
(void)new wxButton( panel, ID_RADIOBOX_SEL_STR, "Select 'This'", wxPoint(180,80), wxSize(140,30) ); (void)new wxButton( panel, ID_RADIOBOX_SEL_STR, "Select 'This'", wxPoint(180,80), wxSize(140,30) );

View File

@@ -35,6 +35,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxEvtHandler, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxEvtHandler, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxEvent, wxObject) IMPLEMENT_ABSTRACT_CLASS(wxEvent, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxCommandEvent, wxEvent) IMPLEMENT_DYNAMIC_CLASS(wxCommandEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxNotifyEvent, wxCommandEvent)
IMPLEMENT_DYNAMIC_CLASS(wxScrollEvent, wxCommandEvent) IMPLEMENT_DYNAMIC_CLASS(wxScrollEvent, wxCommandEvent)
IMPLEMENT_DYNAMIC_CLASS(wxMouseEvent, wxEvent) IMPLEMENT_DYNAMIC_CLASS(wxMouseEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxKeyEvent, wxEvent) IMPLEMENT_DYNAMIC_CLASS(wxKeyEvent, wxEvent)

View File

@@ -381,7 +381,7 @@ void wxListLineData::SetPosition( wxPaintDC *dc, int x, int y, int window_width
m_bound_all.x -= 2; m_bound_all.x -= 2;
m_bound_all.y -= 2; m_bound_all.y -= 2;
m_bound_all.width += 4; m_bound_all.width += 4;
m_bound_all.height += 4; m_bound_all.height += 3;
AssignRect( m_bound_hilight, m_bound_all ); AssignRect( m_bound_hilight, m_bound_all );
AssignRect( m_bound_icon, 0, 0, 0, 0 ); AssignRect( m_bound_icon, 0, 0, 0, 0 );
break; break;
@@ -1064,28 +1064,13 @@ void wxListMainWindow::HilightAll( bool on )
} }
} }
void wxListMainWindow::ActivateLine( wxListLineData *line )
{
if (!GetParent()) return;
wxListEvent le( wxEVT_COMMAND_LIST_KEY_DOWN, GetParent()->GetId() );
le.SetEventObject( GetParent() );
le.m_code = 0;
le.m_itemIndex = GetIndexOfLine( line );
le.m_col = 0;
line->GetItem( 0, le.m_item );
OnListNotify( le );
}
void wxListMainWindow::SendNotify( wxListLineData *line, wxEventType command ) void wxListMainWindow::SendNotify( wxListLineData *line, wxEventType command )
{ {
if (!GetParent()) return;
wxListEvent le( command, GetParent()->GetId() ); wxListEvent le( command, GetParent()->GetId() );
le.SetEventObject( GetParent() ); le.SetEventObject( GetParent() );
le.m_code = 0;
le.m_itemIndex = GetIndexOfLine( line ); le.m_itemIndex = GetIndexOfLine( line );
le.m_col = 0;
line->GetItem( 0, le.m_item ); line->GetItem( 0, le.m_item );
OnListNotify( le ); GetParent()->GetEventHandler()->ProcessEvent( le );
} }
void wxListMainWindow::FocusLine( wxListLineData *WXUNUSED(line) ) void wxListMainWindow::FocusLine( wxListLineData *WXUNUSED(line) )
@@ -1120,16 +1105,12 @@ void wxListMainWindow::StartLabelEdit( wxListLineData *line )
void wxListMainWindow::RenameLine( wxListLineData *line, const wxString &newName ) void wxListMainWindow::RenameLine( wxListLineData *line, const wxString &newName )
{ {
if (!GetParent()) return;
wxListEvent le( wxEVT_COMMAND_LIST_END_LABEL_EDIT, GetParent()->GetId() ); wxListEvent le( wxEVT_COMMAND_LIST_END_LABEL_EDIT, GetParent()->GetId() );
le.SetEventObject( GetParent() ); le.SetEventObject( GetParent() );
le.m_code = 0;
le.m_itemIndex = GetIndexOfLine( line ); le.m_itemIndex = GetIndexOfLine( line );
le.m_col = 0;
line->GetItem( 0, le.m_item ); line->GetItem( 0, le.m_item );
le.m_item.m_text = newName; le.m_item.m_text = newName;
OnListNotify( le ); GetParent()->GetEventHandler()->ProcessEvent( le );
} }
void wxListMainWindow::OnRenameTimer() void wxListMainWindow::OnRenameTimer()
@@ -1151,21 +1132,6 @@ void wxListMainWindow::OnRenameTimer()
wxListTextCtrl *text = new wxListTextCtrl( wxListTextCtrl *text = new wxListTextCtrl(
this, -1, &m_renameAccept, &m_renameRes, this, s, wxPoint(x-4,y-4), wxSize(w+11,h+8) ); this, -1, &m_renameAccept, &m_renameRes, this, s, wxPoint(x-4,y-4), wxSize(w+11,h+8) );
text->SetFocus(); text->SetFocus();
/*
m_text->SetSize( x+3, y+3, w+6, h+6 );
m_text->SetValue( s );
m_text->Show( TRUE );
m_text->SetFocus();
*/
/*
char *res = wxGetTextFromUser( _("Enter new name:"), "", s );
if (res)
{
m_dirty = TRUE;
s = res;
RenameLine( m_current, s );
}
*/
} }
void wxListMainWindow::OnRenameAccept() void wxListMainWindow::OnRenameAccept()
@@ -1185,6 +1151,7 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
long x = dc.DeviceToLogicalX( (long)event.GetX() ); long x = dc.DeviceToLogicalX( (long)event.GetX() );
long y = dc.DeviceToLogicalY( (long)event.GetY() ); long y = dc.DeviceToLogicalY( (long)event.GetY() );
// Did we actually hit an item ?
long hitResult = 0; long hitResult = 0;
wxNode *node = m_lines.First(); wxNode *node = m_lines.First();
wxListLineData *line = (wxListLineData *) NULL; wxListLineData *line = (wxListLineData *) NULL;
@@ -1205,12 +1172,14 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
if (event.Dragging() && (m_dragCount > 3)) if (event.Dragging() && (m_dragCount > 3))
{ {
m_dragCount = 0; m_dragCount = 0;
wxListEvent le( wxEVT_COMMAND_LIST_BEGIN_DRAG, GetParent()->GetId() ); wxListEvent le( wxEVT_COMMAND_LIST_BEGIN_DRAG, GetParent()->GetId() );
le.SetEventObject( this ); le.SetEventObject( GetParent() );
le.m_code = 0; le.m_pointDrag.x = x;
le.m_itemIndex = 0; le.m_pointDrag.y = y;
le.m_col = 0; GetParent()->GetEventHandler()->ProcessEvent( le );
OnListNotify( le );
return;
} }
if (!line) return; if (!line) return;
@@ -1220,7 +1189,9 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
m_usedKeys = FALSE; m_usedKeys = FALSE;
m_lastOnSame = FALSE; m_lastOnSame = FALSE;
m_renameTimer->Stop(); m_renameTimer->Stop();
ActivateLine( line );
SendNotify( line, wxEVT_COMMAND_LIST_KEY_DOWN );
return; return;
} }
@@ -1229,7 +1200,6 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
m_usedKeys = FALSE; m_usedKeys = FALSE;
if ((line == m_current) && if ((line == m_current) &&
(hitResult == wxLIST_HITTEST_ONITEMLABEL) && (hitResult == wxLIST_HITTEST_ONITEMLABEL) &&
// (m_mode & wxLC_ICON) &&
(m_mode & wxLC_EDIT_LABELS) ) (m_mode & wxLC_EDIT_LABELS) )
{ {
m_renameTimer->Start( 100, TRUE ); m_renameTimer->Start( 100, TRUE );
@@ -1238,6 +1208,18 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
return; return;
} }
if (event.RightDown())
{
SendNotify( line, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK );
return;
}
if (event.MiddleDown())
{
SendNotify( line, wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK );
return;
}
if (event.LeftDown()) if (event.LeftDown())
{ {
m_usedKeys = FALSE; m_usedKeys = FALSE;
@@ -1260,6 +1242,7 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
else if (event.ControlDown()) else if (event.ControlDown())
{ {
m_current = line; m_current = line;
int numOfCurrent = -1; int numOfCurrent = -1;
node = m_lines.First(); node = m_lines.First();
while (node) while (node)
@@ -1269,6 +1252,7 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
if (test_line == oldCurrent) break; if (test_line == oldCurrent) break;
node = node->Next(); node = node->Next();
} }
int numOfLine = -1; int numOfLine = -1;
node = m_lines.First(); node = m_lines.First();
while (node) while (node)
@@ -1280,7 +1264,12 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
} }
if (numOfLine < numOfCurrent) if (numOfLine < numOfCurrent)
{ int i = numOfLine; numOfLine = numOfCurrent; numOfCurrent = i; } {
int i = numOfLine;
numOfLine = numOfCurrent;
numOfCurrent = i;
}
wxNode *node = m_lines.Nth( numOfCurrent ); wxNode *node = m_lines.Nth( numOfCurrent );
for (int i = 0; i <= numOfLine-numOfCurrent; i++) for (int i = 0; i <= numOfLine-numOfCurrent; i++)
{ {
@@ -1307,7 +1296,6 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
m_lastOnSame = (m_current == oldCurrent); m_lastOnSame = (m_current == oldCurrent);
return; return;
} }
} }
void wxListMainWindow::MoveToFocus( void ) void wxListMainWindow::MoveToFocus( void )
@@ -1327,8 +1315,8 @@ void wxListMainWindow::MoveToFocus( void )
if (GetScrollPos( wxHORIZONTAL ) != 0) SetScrollPos( wxHORIZONTAL, 0); if (GetScrollPos( wxHORIZONTAL ) != 0) SetScrollPos( wxHORIZONTAL, 0);
int y_s = m_yScroll*GetScrollPos( wxVERTICAL ); int y_s = m_yScroll*GetScrollPos( wxVERTICAL );
if ((y > y_s) && (y+h < y_s+h_p)) return; if ((y > y_s) && (y+h < y_s+h_p)) return;
if (y-y_s < 5) SetScrollPos( wxVERTICAL, (y-5)/m_yScroll ); if (y-y_s < 5) SetScrollPos( wxVERTICAL, (y-5-h_p/2)/m_yScroll );
if (y+h+5 > y_s+h_p) SetScrollPos( wxVERTICAL, (y+h-h_p+h+15)/m_yScroll ); if (y+h+5 > y_s+h_p) SetScrollPos( wxVERTICAL, (y+h-h_p/2+h+15)/m_yScroll );
m_dirty = TRUE; m_dirty = TRUE;
} }
else else
@@ -1470,7 +1458,11 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
case WXK_RETURN: case WXK_RETURN:
case WXK_EXECUTE: case WXK_EXECUTE:
{ {
ActivateLine( m_current ); wxListEvent le( wxEVT_COMMAND_LIST_KEY_DOWN, GetParent()->GetId() );
le.SetEventObject( GetParent() );
le.m_itemIndex = GetIndexOfLine( m_current );
m_current->GetItem( 0, le.m_item );
GetParent()->GetEventHandler()->ProcessEvent( le );
} }
break; break;
default: default:
@@ -1669,8 +1661,10 @@ int wxListMainWindow::GetColumnWidth( int col )
return column->GetWidth(); return column->GetWidth();
} }
else else
{
return 0; return 0;
} }
}
int wxListMainWindow::GetColumnCount( void ) int wxListMainWindow::GetColumnCount( void )
{ {
@@ -1890,9 +1884,9 @@ void wxListMainWindow::CalculatePositions( void )
{ {
int x = 4; int x = 4;
int y = 1; int y = 1;
int entireHeight = m_lines.Number() * lineSpacing + 10; int entireHeight = m_lines.Number() * lineSpacing + 2;
int scroll_pos = GetScrollPos( wxVERTICAL ); int scroll_pos = GetScrollPos( wxVERTICAL );
SetScrollbars( m_xScroll, m_yScroll, 0, (entireHeight+10) / m_yScroll, 0, scroll_pos, TRUE ); SetScrollbars( m_xScroll, m_yScroll, 0, (entireHeight+15-6) / m_yScroll, 0, scroll_pos, TRUE );
GetClientSize( &clientWidth, &clientHeight ); GetClientSize( &clientWidth, &clientHeight );
wxNode* node = m_lines.First(); wxNode* node = m_lines.First();
@@ -1907,9 +1901,10 @@ void wxListMainWindow::CalculatePositions( void )
line->SetColumnPosition( i, col_x ); line->SetColumnPosition( i, col_x );
col_x += GetColumnWidth( i ); col_x += GetColumnWidth( i );
} }
y += lineSpacing; y += lineSpacing; // one pixel blank line between items
node = node->Next(); node = node->Next();
} }
m_visibleLines = m_lines.GetCount();
} }
else else
{ {
@@ -1918,14 +1913,15 @@ void wxListMainWindow::CalculatePositions( void )
// approximated 15 pt for the horizontal scrollbar // approximated 15 pt for the horizontal scrollbar
GetSize( &clientWidth, &clientHeight ); GetSize( &clientWidth, &clientHeight );
clientHeight -= 4; // sunken frame
int entireWidth = 0; int entireWidth = 0;
for (int tries = 0; tries < 2; tries++) for (int tries = 0; tries < 2; tries++)
{ {
entireWidth = 0; entireWidth = 0;
int x = 5; int x = 5; // painting is done at x-2
int y = 3; int y = 5; // painting is done at y-2
int maxWidth = 0; int maxWidth = 0;
wxNode *node = m_lines.First(); wxNode *node = m_lines.First();
while (node) while (node)
@@ -1936,11 +1932,11 @@ void wxListMainWindow::CalculatePositions( void )
line->GetSize( lineWidth, lineHeight ); line->GetSize( lineWidth, lineHeight );
if (lineWidth > maxWidth) maxWidth = lineWidth; if (lineWidth > maxWidth) maxWidth = lineWidth;
y += lineSpacing; y += lineSpacing;
if (y+lineSpacing-8 > clientHeight-6) if (y+lineSpacing-7 >= clientHeight) // -7 for earlier "line breaking"
{ {
y = 3; y = 5;
x += maxWidth+13; x += maxWidth+5;
entireWidth += maxWidth+13; entireWidth += maxWidth+5;
maxWidth = 0; maxWidth = 0;
} }
node = node->Next(); node = node->Next();
@@ -1953,10 +1949,11 @@ void wxListMainWindow::CalculatePositions( void )
if (!node) tries = 1; // everything fits, no second try required if (!node) tries = 1; // everything fits, no second try required
} }
} }
m_visibleLines = (clientHeight+7) / (lineSpacing); // +7 for earlier "line breaking"
int scroll_pos = GetScrollPos( wxHORIZONTAL ); int scroll_pos = GetScrollPos( wxHORIZONTAL );
SetScrollbars( m_xScroll, m_yScroll, (entireWidth+15) / m_xScroll, 0, scroll_pos, 0, TRUE ); SetScrollbars( m_xScroll, m_yScroll, (entireWidth+15) / m_xScroll, 0, scroll_pos, 0, TRUE );
} }
m_visibleLines = (clientHeight-4) / (lineSpacing);
} }
void wxListMainWindow::RealizeChanges( void ) void wxListMainWindow::RealizeChanges( void )
@@ -2178,12 +2175,6 @@ void wxListMainWindow::SortItems( wxListCtrlCompare fn, long data )
m_lines.Sort( list_ctrl_compare_func_1 ); m_lines.Sort( list_ctrl_compare_func_1 );
} }
bool wxListMainWindow::OnListNotify( wxListEvent &event )
{
if (GetParent()) GetParent()->GetEventHandler()->ProcessEvent( event );
return FALSE;
}
// ------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------
// wxListItem // wxListItem
// ------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------
@@ -2208,15 +2199,18 @@ wxListItem::wxListItem(void)
// wxListEvent // wxListEvent
// ------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxListEvent, wxCommandEvent) IMPLEMENT_DYNAMIC_CLASS(wxListEvent, wxNotifyEvent)
wxListEvent::wxListEvent( wxEventType commandType, int id ): wxListEvent::wxListEvent( wxEventType commandType, int id ):
wxCommandEvent( commandType, id ) wxNotifyEvent( commandType, id )
{ {
m_code = 0; m_code = 0;
m_itemIndex = 0; m_itemIndex = 0;
m_oldItemIndex = 0;
m_col = 0; m_col = 0;
m_cancelled = FALSE; m_cancelled = FALSE;
m_pointDrag.x = 0;
m_pointDrag.y = 0;
} }
// ------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------
@@ -2486,6 +2480,11 @@ int wxListCtrl::GetItemCount(void) const
return m_mainWin->GetItemCount(); return m_mainWin->GetItemCount();
} }
int wxListCtrl::GetColumnCount(void) const
{
return m_mainWin->GetColumnCount();
}
void wxListCtrl::SetItemSpacing( int spacing, bool isSmall ) void wxListCtrl::SetItemSpacing( int spacing, bool isSmall )
{ {
m_mainWin->SetItemSpacing( spacing, isSmall ); m_mainWin->SetItemSpacing( spacing, isSmall );

View File

@@ -200,6 +200,11 @@ void wxStatusBar::DrawFieldText(wxDC& dc, int i)
int xpos = rect.x + leftMargin; int xpos = rect.x + leftMargin;
int ypos = (int) (((rect.height - y) / 2 ) + rect.y + 0.5) ; int ypos = (int) (((rect.height - y) / 2 ) + rect.y + 0.5) ;
#ifdef __WXGTK__
xpos++;
ypos++;
#endif
dc.SetClippingRegion(rect.x, rect.y, rect.width, rect.height); dc.SetClippingRegion(rect.x, rect.y, rect.width, rect.height);
dc.DrawText(text, xpos, ypos); dc.DrawText(text, xpos, ypos);

View File

@@ -140,10 +140,10 @@ private:
// wxTreeEvent // wxTreeEvent
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxTreeEvent, wxCommandEvent) IMPLEMENT_DYNAMIC_CLASS(wxTreeEvent, wxNotifyEvent)
wxTreeEvent::wxTreeEvent( wxEventType commandType, int id ) wxTreeEvent::wxTreeEvent( wxEventType commandType, int id )
: wxCommandEvent( commandType, id ) : wxNotifyEvent( commandType, id )
{ {
m_code = 0; m_code = 0;
m_itemOld = (wxGenericTreeItem *)NULL; m_itemOld = (wxGenericTreeItem *)NULL;

View File

@@ -527,5 +527,5 @@ void wxNotebook::ApplyWidgetStyle()
// wxNotebookEvent // wxNotebookEvent
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent) IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)

View File

@@ -86,7 +86,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
GtkRadioButton *m_radio = (GtkRadioButton*) NULL; GtkRadioButton *m_radio = (GtkRadioButton*) NULL;
if (m_windowStyle & wxRA_VERTICAL) if (m_windowStyle & wxRA_HORIZONTAL)
{ {
GSList *radio_button_group = (GSList *) NULL; GSList *radio_button_group = (GSList *) NULL;
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
@@ -194,7 +194,7 @@ void wxRadioBox::OnSize( wxSizeEvent &event )
int x = m_x+5; int x = m_x+5;
int y = m_y+15; int y = m_y+15;
if (m_windowStyle & wxRA_VERTICAL) if (m_windowStyle & wxRA_HORIZONTAL)
{ {
wxNode *node = m_boxes.First(); wxNode *node = m_boxes.First();
while (node) while (node)

View File

@@ -66,12 +66,10 @@ bool wxStaticText::Create( wxWindow *parent, wxWindowID id, const wxString &labe
int x = gdk_string_measure( m_widget->style->font, s ) + 4; int x = gdk_string_measure( m_widget->style->font, s ) + 4;
if (x > newSize.x) newSize.x = x; if (x > newSize.x) newSize.x = x;
*nl++ = '\n'; *nl++ = '\n';
if ((nl = strchr(s = nl, '\n')))
{
++y; ++y;
} if (! (nl = strchr(s = nl, '\n')))
else
{ {
int x = gdk_string_measure( m_widget->style->font, s ) + 4; int x = gdk_string_measure( m_widget->style->font, s ) + 4;
if (x > newSize.x) newSize.x = x; if (x > newSize.x) newSize.x = x;
} }
@@ -87,7 +85,7 @@ bool wxStaticText::Create( wxWindow *parent, wxWindowID id, const wxString &labe
if (y == 1) if (y == 1)
newSize.y = 26; newSize.y = 26;
else else
newSize.y = 4 + y * (m_widget->style->font->ascent + 2*m_widget->style->font->descent); newSize.y = 4 + y * (m_widget->style->font->ascent + m_widget->style->font->descent + 2);
} }
SetSize( newSize.x, newSize.y ); SetSize( newSize.x, newSize.y );

View File

@@ -2428,6 +2428,8 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
float fpos = (float)pos; float fpos = (float)pos;
float frange = (float)range; float frange = (float)range;
float fthumb = (float)thumbVisible; float fthumb = (float)thumbVisible;
if (fpos > frange-fthumb) fpos = frange-fthumb;
if (fpos < 0.0) fpos = 0.0;
if ((fabs(frange-m_hAdjust->upper) < 0.2) && if ((fabs(frange-m_hAdjust->upper) < 0.2) &&
(fabs(fthumb-m_hAdjust->page_size) < 0.2)) (fabs(fthumb-m_hAdjust->page_size) < 0.2))
@@ -2450,6 +2452,8 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
float fpos = (float)pos; float fpos = (float)pos;
float frange = (float)range; float frange = (float)range;
float fthumb = (float)thumbVisible; float fthumb = (float)thumbVisible;
if (fpos > frange-fthumb) fpos = frange-fthumb;
if (fpos < 0.0) fpos = 0.0;
if ((fabs(frange-m_vAdjust->upper) < 0.2) && if ((fabs(frange-m_vAdjust->upper) < 0.2) &&
(fabs(fthumb-m_vAdjust->page_size) < 0.2)) (fabs(fthumb-m_vAdjust->page_size) < 0.2))
@@ -2490,6 +2494,8 @@ void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
{ {
float fpos = (float)pos; float fpos = (float)pos;
if (fpos > m_hAdjust->upper - m_hAdjust->page_size) fpos = m_hAdjust->upper - m_hAdjust->page_size;
if (fpos < 0.0) fpos = 0.0;
m_oldHorizontalPos = fpos; m_oldHorizontalPos = fpos;
if (fabs(fpos-m_hAdjust->value) < 0.2) return; if (fabs(fpos-m_hAdjust->value) < 0.2) return;
@@ -2498,7 +2504,10 @@ void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
else else
{ {
float fpos = (float)pos; float fpos = (float)pos;
if (fpos > m_vAdjust->upper - m_vAdjust->page_size) fpos = m_vAdjust->upper - m_vAdjust->page_size;
if (fpos < 0.0) fpos = 0.0;
m_oldVerticalPos = fpos; m_oldVerticalPos = fpos;
if (fabs(fpos-m_vAdjust->value) < 0.2) return; if (fabs(fpos-m_vAdjust->value) < 0.2) return;
m_vAdjust->value = fpos; m_vAdjust->value = fpos;
} }

View File

@@ -527,5 +527,5 @@ void wxNotebook::ApplyWidgetStyle()
// wxNotebookEvent // wxNotebookEvent
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent) IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)

View File

@@ -86,7 +86,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
GtkRadioButton *m_radio = (GtkRadioButton*) NULL; GtkRadioButton *m_radio = (GtkRadioButton*) NULL;
if (m_windowStyle & wxRA_VERTICAL) if (m_windowStyle & wxRA_HORIZONTAL)
{ {
GSList *radio_button_group = (GSList *) NULL; GSList *radio_button_group = (GSList *) NULL;
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
@@ -194,7 +194,7 @@ void wxRadioBox::OnSize( wxSizeEvent &event )
int x = m_x+5; int x = m_x+5;
int y = m_y+15; int y = m_y+15;
if (m_windowStyle & wxRA_VERTICAL) if (m_windowStyle & wxRA_HORIZONTAL)
{ {
wxNode *node = m_boxes.First(); wxNode *node = m_boxes.First();
while (node) while (node)

View File

@@ -66,12 +66,10 @@ bool wxStaticText::Create( wxWindow *parent, wxWindowID id, const wxString &labe
int x = gdk_string_measure( m_widget->style->font, s ) + 4; int x = gdk_string_measure( m_widget->style->font, s ) + 4;
if (x > newSize.x) newSize.x = x; if (x > newSize.x) newSize.x = x;
*nl++ = '\n'; *nl++ = '\n';
if ((nl = strchr(s = nl, '\n')))
{
++y; ++y;
} if (! (nl = strchr(s = nl, '\n')))
else
{ {
int x = gdk_string_measure( m_widget->style->font, s ) + 4; int x = gdk_string_measure( m_widget->style->font, s ) + 4;
if (x > newSize.x) newSize.x = x; if (x > newSize.x) newSize.x = x;
} }
@@ -87,7 +85,7 @@ bool wxStaticText::Create( wxWindow *parent, wxWindowID id, const wxString &labe
if (y == 1) if (y == 1)
newSize.y = 26; newSize.y = 26;
else else
newSize.y = 4 + y * (m_widget->style->font->ascent + 2*m_widget->style->font->descent); newSize.y = 4 + y * (m_widget->style->font->ascent + m_widget->style->font->descent + 2);
} }
SetSize( newSize.x, newSize.y ); SetSize( newSize.x, newSize.y );

View File

@@ -2428,6 +2428,8 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
float fpos = (float)pos; float fpos = (float)pos;
float frange = (float)range; float frange = (float)range;
float fthumb = (float)thumbVisible; float fthumb = (float)thumbVisible;
if (fpos > frange-fthumb) fpos = frange-fthumb;
if (fpos < 0.0) fpos = 0.0;
if ((fabs(frange-m_hAdjust->upper) < 0.2) && if ((fabs(frange-m_hAdjust->upper) < 0.2) &&
(fabs(fthumb-m_hAdjust->page_size) < 0.2)) (fabs(fthumb-m_hAdjust->page_size) < 0.2))
@@ -2450,6 +2452,8 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
float fpos = (float)pos; float fpos = (float)pos;
float frange = (float)range; float frange = (float)range;
float fthumb = (float)thumbVisible; float fthumb = (float)thumbVisible;
if (fpos > frange-fthumb) fpos = frange-fthumb;
if (fpos < 0.0) fpos = 0.0;
if ((fabs(frange-m_vAdjust->upper) < 0.2) && if ((fabs(frange-m_vAdjust->upper) < 0.2) &&
(fabs(fthumb-m_vAdjust->page_size) < 0.2)) (fabs(fthumb-m_vAdjust->page_size) < 0.2))
@@ -2490,6 +2494,8 @@ void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
{ {
float fpos = (float)pos; float fpos = (float)pos;
if (fpos > m_hAdjust->upper - m_hAdjust->page_size) fpos = m_hAdjust->upper - m_hAdjust->page_size;
if (fpos < 0.0) fpos = 0.0;
m_oldHorizontalPos = fpos; m_oldHorizontalPos = fpos;
if (fabs(fpos-m_hAdjust->value) < 0.2) return; if (fabs(fpos-m_hAdjust->value) < 0.2) return;
@@ -2498,7 +2504,10 @@ void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
else else
{ {
float fpos = (float)pos; float fpos = (float)pos;
if (fpos > m_vAdjust->upper - m_vAdjust->page_size) fpos = m_vAdjust->upper - m_vAdjust->page_size;
if (fpos < 0.0) fpos = 0.0;
m_oldVerticalPos = fpos; m_oldVerticalPos = fpos;
if (fabs(fpos-m_vAdjust->value) < 0.2) return; if (fabs(fpos-m_vAdjust->value) < 0.2) return;
m_vAdjust->value = fpos; m_vAdjust->value = fpos;
} }

View File

@@ -332,6 +332,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxResourceTable, wxHashTable)
IMPLEMENT_DYNAMIC_CLASS(wxEvtHandler, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxEvtHandler, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxEvent, wxObject) IMPLEMENT_ABSTRACT_CLASS(wxEvent, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxCommandEvent, wxEvent) IMPLEMENT_DYNAMIC_CLASS(wxCommandEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxNotifyEvent, wxCommandEvent)
IMPLEMENT_DYNAMIC_CLASS(wxScrollEvent, wxCommandEvent) IMPLEMENT_DYNAMIC_CLASS(wxScrollEvent, wxCommandEvent)
IMPLEMENT_DYNAMIC_CLASS(wxMouseEvent, wxEvent) IMPLEMENT_DYNAMIC_CLASS(wxMouseEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxKeyEvent, wxEvent) IMPLEMENT_DYNAMIC_CLASS(wxKeyEvent, wxEvent)

View File

@@ -86,7 +86,7 @@ bool wxGauge95::Create(wxWindow *parent, wxWindowID id,
if (width == -1) if (width == -1)
width = 50; width = 50;
if (height == -1) if (height == -1)
height = 50; height = 28;
SetSize(x, y, width, height); SetSize(x, y, width, height);
ShowWindow((HWND) GetHWND(), SW_SHOW); ShowWindow((HWND) GetHWND(), SW_SHOW);

View File

@@ -1430,7 +1430,7 @@ static void wxConvertToMSWListItem(const wxListCtrl *ctrl, wxListItem& info, LV_
} }
// List event // List event
IMPLEMENT_DYNAMIC_CLASS(wxListEvent, wxCommandEvent) IMPLEMENT_DYNAMIC_CLASS(wxListEvent, wxNotifyEvent)
wxListEvent::wxListEvent(wxEventType commandType, int id) wxListEvent::wxListEvent(wxEventType commandType, int id)
: wxNotifyEvent(commandType, id) : wxNotifyEvent(commandType, id)

View File

@@ -69,7 +69,7 @@
END_EVENT_TABLE() END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl) IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent) IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
#endif #endif
// ============================================================================ // ============================================================================

View File

@@ -939,7 +939,7 @@ bool wxTreeCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
// Tree event // Tree event
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxTreeEvent, wxCommandEvent) IMPLEMENT_DYNAMIC_CLASS(wxTreeEvent, wxNotifyEvent)
wxTreeEvent::wxTreeEvent(wxEventType commandType, int id) wxTreeEvent::wxTreeEvent(wxEventType commandType, int id)
: wxNotifyEvent(commandType, id) : wxNotifyEvent(commandType, id)