1. wxDropTarget::OnData() returns wxDragResult now, not bool

2. fixed assert failure in wxMSW::wxListBox
3. wxFileHistory automatically deletes non existinf files from menu
4. wxDropTarget coordinates are client (and not screen) under MSW too
5. wxConvertBitmapToDib and vice versa seem to work!
6. client data field if filled by wxListBox and wxChoice and it's also deleted
   (this just wasn't done before!)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4153 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-10-23 23:40:55 +00:00
parent 4d85bcd1f5
commit 8ee9d6182c
22 changed files with 473 additions and 472 deletions

View File

@@ -32,6 +32,11 @@ enum wxDragResult
wxDragCancel // the operation was cancelled by user (not an error)
};
inline WXDLLEXPORT bool wxIsDragResultOk(wxDragResult res)
{
return res == wxDragCopy || res == wxDragMove;
}
// ----------------------------------------------------------------------------
// wxDropSource is the object you need to create (and call DoDragDrop on it)
// to initiate a drag-and-drop operation
@@ -127,8 +132,10 @@ public:
// called after OnDrop() returns TRUE: you will usually just call
// GetData() from here and, probably, also refresh something to update the
// new data
virtual bool OnData(wxCoord x, wxCoord y) = 0;
// new data and, finally, return the code indicating how did the operation
// complete (returning default value in case of success and wxDragError on
// failure is usually ok)
virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def) = 0;
// may be called *only* from inside OnData() and will fill m_dataObject
// with the data from the drop source if it returns TRUE
@@ -138,11 +145,6 @@ protected:
wxDataObject *m_dataObject;
};
// ----------------------------------------------------------------------------
// the platform-specific headers also define standard wxDropTarget
// implementations wxTextDropTarget and wxFileDropTarget
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// include platform dependent class declarations
// ----------------------------------------------------------------------------
@@ -164,6 +166,35 @@ protected:
#include "wx/stubs/dnd.h"
#endif
// ----------------------------------------------------------------------------
// standard wxDropTarget implementations (implemented in common/dobjcmn.cpp)
// ----------------------------------------------------------------------------
// A simple wxDropTarget derived class for text data: you only need to
// override OnDropText() to get something working
class WXDLLEXPORT wxTextDropTarget : public wxDropTarget
{
public:
wxTextDropTarget();
virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& text) = 0;
virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);
};
// A drop target which accepts files (dragged from File Manager or Explorer)
class WXDLLEXPORT wxFileDropTarget : public wxDropTarget
{
public:
wxFileDropTarget();
// parameters are the number of files and the array of file names
virtual bool OnDropFiles(wxCoord x, wxCoord y,
const wxArrayString& filenames) = 0;
virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);
};
#endif // wxUSE_DRAG_AND_DROP
#endif // _WX_DND_H_BASE_

View File

@@ -16,9 +16,9 @@
#pragma interface "choicdgg.h"
#endif
#include "wx/setup.h"
#include "wx/dialog.h"
#include "wx/listbox.h"
class WXDLLEXPORT wxListBox;
#define wxCHOICE_HEIGHT 150
#define wxCHOICE_WIDTH 200

View File

@@ -44,10 +44,10 @@ class wxDropTarget: public wxDropTargetBase
{
public:
wxDropTarget(wxDataObject *dataObject = (wxDataObject*) NULL );
virtual wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
virtual bool OnDrop(wxCoord x, wxCoord y);
virtual bool OnData(wxCoord x, wxCoord y);
virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);
virtual bool GetData();
// implementation
@@ -69,37 +69,6 @@ public:
void SetDragTime( guint time ) { m_dragTime = time; }
};
// ----------------------------------------------------------------------------
// A simple wxDropTarget derived class for text data: you only need to
// override OnDropText() to get something working
// ----------------------------------------------------------------------------
class wxTextDropTarget : public wxDropTarget
{
public:
wxTextDropTarget();
virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& text) = 0;
virtual bool OnData(wxCoord x, wxCoord y);
};
// ----------------------------------------------------------------------------
// A drop target which accepts files (dragged from File Manager or Explorer)
// ----------------------------------------------------------------------------
class wxFileDropTarget : public wxDropTarget
{
public:
wxFileDropTarget();
// parameters are the number of files and the array of file names
virtual bool OnDropFiles(wxCoord x, wxCoord y,
const wxArrayString& filenames) = 0;
virtual bool OnData(wxCoord x, wxCoord y);
};
//-------------------------------------------------------------------------
// wxDropSource
//-------------------------------------------------------------------------
@@ -126,15 +95,15 @@ public:
void UnregisterWindow();
void PrepareIcon( int hot_x, int hot_y, GdkDragContext *context );
GtkWidget *m_widget;
GtkWidget *m_iconWindow;
GdkDragContext *m_dragContext;
wxWindow *m_window;
wxDragResult m_retValue;
wxIcon m_icon;
bool m_waiting;
};

View File

@@ -44,10 +44,10 @@ class wxDropTarget: public wxDropTargetBase
{
public:
wxDropTarget(wxDataObject *dataObject = (wxDataObject*) NULL );
virtual wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
virtual bool OnDrop(wxCoord x, wxCoord y);
virtual bool OnData(wxCoord x, wxCoord y);
virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);
virtual bool GetData();
// implementation
@@ -69,37 +69,6 @@ public:
void SetDragTime( guint time ) { m_dragTime = time; }
};
// ----------------------------------------------------------------------------
// A simple wxDropTarget derived class for text data: you only need to
// override OnDropText() to get something working
// ----------------------------------------------------------------------------
class wxTextDropTarget : public wxDropTarget
{
public:
wxTextDropTarget();
virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& text) = 0;
virtual bool OnData(wxCoord x, wxCoord y);
};
// ----------------------------------------------------------------------------
// A drop target which accepts files (dragged from File Manager or Explorer)
// ----------------------------------------------------------------------------
class wxFileDropTarget : public wxDropTarget
{
public:
wxFileDropTarget();
// parameters are the number of files and the array of file names
virtual bool OnDropFiles(wxCoord x, wxCoord y,
const wxArrayString& filenames) = 0;
virtual bool OnData(wxCoord x, wxCoord y);
};
//-------------------------------------------------------------------------
// wxDropSource
//-------------------------------------------------------------------------
@@ -126,15 +95,15 @@ public:
void UnregisterWindow();
void PrepareIcon( int hot_x, int hot_y, GdkDragContext *context );
GtkWidget *m_widget;
GtkWidget *m_iconWindow;
GdkDragContext *m_dragContext;
wxWindow *m_window;
wxDragResult m_retValue;
wxIcon m_icon;
bool m_waiting;
};

View File

@@ -16,17 +16,15 @@
#pragma interface "checklst.h"
#endif
// No!
// typedef unsigned int size_t;
#include <stddef.h>
#include "wx/setup.h"
#if !wxUSE_OWNER_DRAWN
#error "wxCheckListBox class requires owner-drawn functionality."
#endif
class wxCheckListBoxItem; // fwd decl, define in checklst.cpp
#include "wx/listbox.h"
class wxCheckListBoxItem; // fwd decl, defined in checklst.cpp
class WXDLLEXPORT wxCheckListBox : public wxListBox
{

View File

@@ -27,6 +27,7 @@ class WXDLLEXPORT wxChoice : public wxChoiceBase
public:
// ctors
wxChoice() { }
virtual ~wxChoice();
wxChoice(wxWindow *parent,
wxWindowID id,
@@ -77,6 +78,9 @@ protected:
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO);
// free all memory we have (used by Clear() and dtor)
void Free();
};
#endif // _WX_CHOICE_H_

View File

@@ -6,14 +6,14 @@
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_LISTBOX_H_
#define _WX_LISTBOX_H_
#ifdef __GNUG__
#pragma interface "listbox.h"
#pragma interface "listbox.h"
#endif
// ----------------------------------------------------------------------------
@@ -120,6 +120,9 @@ protected:
// do we have multiple selections?
bool HasMultipleSelection() const;
// free memory (common part of Clear() and dtor)
void Free();
int m_noItems;
int m_selected;

View File

@@ -71,35 +71,4 @@ private:
IDataObject *m_pIDataSource; // the pointer to the source data object
};
// ----------------------------------------------------------------------------
// A simple wxDropTarget derived class for text data: you only need to
// override OnDropText() to get something working
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxTextDropTarget : public wxDropTarget
{
public:
wxTextDropTarget();
virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& text) = 0;
virtual bool OnData(wxCoord x, wxCoord y);
};
// ----------------------------------------------------------------------------
// A drop target which accepts files (dragged from File Manager or Explorer)
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxFileDropTarget : public wxDropTarget
{
public:
wxFileDropTarget();
// parameters are the number of files and the array of file names
virtual bool OnDropFiles(wxCoord x, wxCoord y,
const wxArrayString& filenames) = 0;
virtual bool OnData(wxCoord x, wxCoord y);
};
#endif //_WX_OLEDROPTGT_H