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::
@echo "entering directory src for installing"
@cd src; ${MAKE} install
@echo "entering directory utils for installing"
@cd utils; ${MAKE} install
# @echo "entering directory utils for installing"
# @cd utils; ${MAKE} install
# 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_INSERT_ITEM = wxEVT_FIRST + 711;
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 */
const wxEventType wxEVT_COMMAND_TAB_SEL_CHANGED = wxEVT_FIRST + 800;
@@ -362,7 +364,7 @@ public:
private:
bool m_bAllow;
DECLARE_DYNAMIC_CLASS(wxCommandEvent)
DECLARE_DYNAMIC_CLASS(wxNotifyEvent)
};
// Scroll event class

View File

@@ -190,7 +190,7 @@ class wxListItem: public wxObject
// wxListEvent
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxListEvent: public wxCommandEvent
class WXDLLEXPORT wxListEvent: public wxNotifyEvent
{
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_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_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)
@@ -461,7 +462,6 @@ class wxListMainWindow: public wxScrolledWindow
void RefreshLine( wxListLineData *line );
void OnPaint( wxPaintEvent &event );
void HilightAll( bool on );
void ActivateLine( wxListLineData *line );
void SendNotify( wxListLineData *line, wxEventType command );
void FocusLine( wxListLineData *line );
void UnfocusLine( wxListLineData *line );
@@ -519,7 +519,6 @@ class wxListMainWindow: public wxScrolledWindow
void InsertColumn( long col, wxListItem &item );
// void AddColumn( wxListItem &item );
void SortItems( wxListCtrlCompare fn, long data );
virtual bool OnListNotify( wxListEvent &event );
DECLARE_EVENT_TABLE()
};
@@ -568,6 +567,7 @@ class wxListCtrl: public wxControl
bool GetItemPosition( long item, wxPoint& pos ) const;
bool SetItemPosition( long item, const wxPoint& pos ); // not supported in wxGLC
int GetItemCount(void) const;
int GetColumnCount(void) const;
void SetItemSpacing( int spacing, bool isSmall = FALSE );
int GetItemSpacing( bool isSmall ) const;
int GetSelectedItemCount(void) const;
@@ -601,7 +601,6 @@ class wxListCtrl: public wxControl
bool ScrollList(int dx, int dy);
bool SortItems(wxListCtrlCompare fn, long data);
bool Update(long item);
virtual bool OnListNotify(wxListEvent& WXUNUSED(event)) { return FALSE; }
void OnIdle( wxIdleEvent &event );
// We have to hand down a few functions

View File

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

View File

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

View File

@@ -32,12 +32,12 @@ class wxNotebookPage;
// notebook events
// ----------------------------------------------------------------------------
class wxNotebookEvent : public wxCommandEvent
class wxNotebookEvent : public wxNotifyEvent
{
public:
wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
int nSel = -1, int nOldSel = -1)
: wxCommandEvent(commandType, id)
: wxNotifyEvent(commandType, id)
{
m_bAllow = TRUE;
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->SetBackgroundColour("cadet 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 = 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");
(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) );

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -199,6 +199,11 @@ void wxStatusBar::DrawFieldText(wxDC& dc, int i)
int xpos = rect.x + leftMargin;
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);

View File

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

View File

@@ -785,7 +785,7 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
shape_motion( drag_icon, (GdkEventMotion *)NULL );
shape_motion( drop_icon, (GdkEventMotion *)NULL );
*/
while (gdk_dnd.drag_really || gdk_dnd.drag_perhaps) wxYield();
UnregisterWindow();

View File

@@ -527,5 +527,5 @@ void wxNotebook::ApplyWidgetStyle()
// 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;
if (m_windowStyle & wxRA_VERTICAL)
if (m_windowStyle & wxRA_HORIZONTAL)
{
GSList *radio_button_group = (GSList *) NULL;
for (int i = 0; i < n; i++)
@@ -194,7 +194,7 @@ void wxRadioBox::OnSize( wxSizeEvent &event )
int x = m_x+5;
int y = m_y+15;
if (m_windowStyle & wxRA_VERTICAL)
if (m_windowStyle & wxRA_HORIZONTAL)
{
wxNode *node = m_boxes.First();
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;
if (x > newSize.x) newSize.x = x;
*nl++ = '\n';
if ((nl = strchr(s = nl, '\n')))
{
++y;
}
else
{
++y;
if (! (nl = strchr(s = nl, '\n')))
{
int x = gdk_string_measure( m_widget->style->font, s ) + 4;
if (x > newSize.x) newSize.x = x;
}
@@ -87,7 +85,7 @@ bool wxStaticText::Create( wxWindow *parent, wxWindowID id, const wxString &labe
if (y == 1)
newSize.y = 26;
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 );

View File

@@ -2428,6 +2428,8 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
float fpos = (float)pos;
float frange = (float)range;
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) &&
(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 frange = (float)range;
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) &&
(fabs(fthumb-m_vAdjust->page_size) < 0.2))
@@ -2486,10 +2490,12 @@ void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
wxASSERT_MSG( (m_wxwindow != NULL), "window needs client area" );
if (!m_wxwindow) return;
if (orient == wxHORIZONTAL)
{
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;
if (fabs(fpos-m_hAdjust->value) < 0.2) return;
@@ -2498,7 +2504,10 @@ void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
else
{
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;
if (fabs(fpos-m_vAdjust->value) < 0.2) return;
m_vAdjust->value = fpos;
}

View File

@@ -785,7 +785,7 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
shape_motion( drag_icon, (GdkEventMotion *)NULL );
shape_motion( drop_icon, (GdkEventMotion *)NULL );
*/
while (gdk_dnd.drag_really || gdk_dnd.drag_perhaps) wxYield();
UnregisterWindow();

View File

@@ -527,5 +527,5 @@ void wxNotebook::ApplyWidgetStyle()
// 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;
if (m_windowStyle & wxRA_VERTICAL)
if (m_windowStyle & wxRA_HORIZONTAL)
{
GSList *radio_button_group = (GSList *) NULL;
for (int i = 0; i < n; i++)
@@ -194,7 +194,7 @@ void wxRadioBox::OnSize( wxSizeEvent &event )
int x = m_x+5;
int y = m_y+15;
if (m_windowStyle & wxRA_VERTICAL)
if (m_windowStyle & wxRA_HORIZONTAL)
{
wxNode *node = m_boxes.First();
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;
if (x > newSize.x) newSize.x = x;
*nl++ = '\n';
if ((nl = strchr(s = nl, '\n')))
{
++y;
}
else
{
++y;
if (! (nl = strchr(s = nl, '\n')))
{
int x = gdk_string_measure( m_widget->style->font, s ) + 4;
if (x > newSize.x) newSize.x = x;
}
@@ -87,7 +85,7 @@ bool wxStaticText::Create( wxWindow *parent, wxWindowID id, const wxString &labe
if (y == 1)
newSize.y = 26;
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 );

View File

@@ -2428,6 +2428,8 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
float fpos = (float)pos;
float frange = (float)range;
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) &&
(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 frange = (float)range;
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) &&
(fabs(fthumb-m_vAdjust->page_size) < 0.2))
@@ -2486,10 +2490,12 @@ void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
wxASSERT_MSG( (m_wxwindow != NULL), "window needs client area" );
if (!m_wxwindow) return;
if (orient == wxHORIZONTAL)
{
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;
if (fabs(fpos-m_hAdjust->value) < 0.2) return;
@@ -2498,7 +2504,10 @@ void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) )
else
{
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;
if (fabs(fpos-m_vAdjust->value) < 0.2) return;
m_vAdjust->value = fpos;
}

View File

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

View File

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

View File

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

View File

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

View File

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