Dnd constant name changes because names like Copy can be #defined by other

apps. Various other changes to stubs.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@745 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1998-09-17 16:57:01 +00:00
parent 9fdf3c3877
commit 46ccb5107f
26 changed files with 142 additions and 120 deletions

View File

@@ -29,6 +29,7 @@
#include "wx/cursor.h"
#include "wx/font.h"
#include "wx/palette.h"
#include "wx/app.h"
#include "wx/log.h"
#include <string.h>
@@ -37,6 +38,10 @@
#include <windows.h>
#endif
#ifdef __WXMOTIF__
#include <Xm/Xm.h>
#endif
#if !USE_SHARED_LIBRARY
IMPLEMENT_CLASS(wxColourDatabase, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList)
@@ -283,16 +288,11 @@ wxColour *wxColourDatabase::FindColour(const wxString& colour)
XColor xcolour;
#ifdef __WXMOTIF__
Display *display = XtDisplay(wxTheApp->topLevel) ;
#endif
#ifdef __XVIEW__
Xv_Screen screen = xv_get(xview_server, SERVER_NTH_SCREEN, 0);
Xv_opaque root_window = xv_get(screen, XV_ROOT);
Display *display = (Display *)xv_get(root_window, XV_DISPLAY);
Display *display = XtDisplay((Widget) wxTheApp->GetTopLevelWidget()) ;
#endif
/* MATTHEW: [4] Use wxGetMainColormap */
if (!XParseColor(display, wxGetMainColormap(display), colour,&xcolour))
if (!XParseColor(display, (Colormap) wxTheApp->GetMainColormap((WXDisplay*) display), colour,&xcolour))
return NULL;
unsigned char r = (unsigned char)(xcolour.red >> 8);
@@ -340,7 +340,8 @@ void wxInitializeStockObjects ()
#ifdef __WXMOTIF__
#endif
#ifdef __X__
wxFontPool = new XFontPool;
// TODO
// wxFontPool = new XFontPool;
#endif
wxNORMAL_FONT = new wxFont (12, wxMODERN, wxNORMAL, wxNORMAL);
@@ -604,12 +605,12 @@ wxFont *wxFontList::
each_font->GetStyle () == Style &&
each_font->GetWeight () == Weight &&
each_font->GetUnderlined () == underline &&
#if defined(__X__) || (defined(__WXMSW__) && USE_PORTABLE_FONTS_IN_MSW)
each_font->GetFontId () == FamilyOrFontId) /* New font system */
#else
//#if defined(__X__)
// each_font->GetFontId () == FamilyOrFontId) /* New font system */
//#else
each_font->GetFamily () == FamilyOrFontId &&
(!each_font->GetFaceName() || each_font->GetFaceName() == Face))
#endif
//#endif
return each_font;
}
wxFont *font = new wxFont (PointSize, FamilyOrFontId, Style, Weight, underline, Face);

View File

@@ -71,6 +71,11 @@
#endif
#ifdef __WXMOTIF__
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#endif
#ifdef __WXMSW__
#ifdef DrawText
@@ -1447,13 +1452,16 @@ Blit (long xdest, long ydest, long fwidth, long fheight,
#else
#ifdef __WXMOTIF__
d = source->display;
// TODO. for now, use global display
// d = source->display;
d = (Display*) wxGetDisplay();
#else
d = wxGetDisplay();
d = (Display*) wxGetDisplay();
#endif
cm = wxGetMainColormap(d);
image = XGetImage(d, source->pixmap, x, y, width, height, AllPlanes, ZPixmap);
cm = (Colormap) wxTheApp->GetMainColormap((WXDisplay*) d);
// TODO - implement GetPixmap() and uncomment this line
// image = XGetImage(d, source->GetPixmap(), x, y, width, height, AllPlanes, ZPixmap);
#endif
@@ -2144,8 +2152,8 @@ int wxPostScriptPrintDialog::ShowModal (void)
StringToLong (WXSTRINGCAST text4->GetValue (), &wxThePrintSetupData->printerTranslateY);
#ifdef __X__
wxThePrintSetupData->SetPrinterOptions(WXSTRINGCAST text0->GetValue ());
wxThePrintSetupData->SetPrinterCommand(WXSTRINGCAST text_prt->GetValue ());
// wxThePrintSetupData->SetPrinterOptions(WXSTRINGCAST text0->GetValue ());
// wxThePrintSetupData->SetPrinterCommand(WXSTRINGCAST text_prt->GetValue ());
#endif
wxThePrintSetupData->SetPrinterOrientation((radio0->GetSelection() == 1 ? PS_LANDSCAPE : PS_PORTRAIT));

View File

@@ -117,7 +117,7 @@
#endif
#ifdef __WXMOTIF__
#define wxAPP_CONTEXT wxTheApp->appContext
#define wxAPP_CONTEXT ((XtAppContext)wxTheApp->GetAppContext())
#endif
#ifdef __WINDOWS__

View File

@@ -158,7 +158,7 @@ void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDropSource *source
delete ptr;
source->m_retValue = wxDropSource::Copy;
source->m_retValue = wxDragCopy;
}
wxDropSource::wxDropSource( wxWindow *win )
@@ -170,7 +170,7 @@ wxDropSource::wxDropSource( wxWindow *win )
if (win->m_wxwindow) m_widget = win->m_wxwindow;
m_data = (wxDataObject *) NULL;
m_retValue = Cancel;
m_retValue = wxDragCancel;
m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
m_goaheadCursor = wxCursor( wxCURSOR_HAND );
@@ -183,7 +183,7 @@ wxDropSource::wxDropSource( wxDataObject &data, wxWindow *win )
m_window = win;
m_widget = win->m_widget;
if (win->m_wxwindow) m_widget = win->m_wxwindow;
m_retValue = Cancel;
m_retValue = wxDragCancel;
m_data = &data;
@@ -203,15 +203,15 @@ wxDropSource::~wxDropSource(void)
g_blockEventsOnDrag = FALSE;
}
wxDropSource::DragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
{
if (gdk_dnd.dnd_grabbed) return (wxDropSource::DragResult) None;
if (gdk_dnd.drag_really) return (wxDropSource::DragResult) None;
if (gdk_dnd.dnd_grabbed) return (wxDragResult) wxDragNone;
if (gdk_dnd.drag_really) return (wxDragResult) wxDragNone;
wxASSERT_MSG( m_data, "wxDragSource: no data" );
if (!m_data) return (wxDropSource::DragResult) None;
if (m_data->GetDataSize() == 0) return (wxDropSource::DragResult) None;
if (!m_data) return (wxDragResult) wxDragNone;
if (m_data->GetDataSize() == 0) return (wxDragResult) wxDragNone;
GdkWindowPrivate *wp = (GdkWindowPrivate*) m_widget->window;

View File

@@ -158,7 +158,7 @@ void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDropSource *source
delete ptr;
source->m_retValue = wxDropSource::Copy;
source->m_retValue = wxDragCopy;
}
wxDropSource::wxDropSource( wxWindow *win )
@@ -170,7 +170,7 @@ wxDropSource::wxDropSource( wxWindow *win )
if (win->m_wxwindow) m_widget = win->m_wxwindow;
m_data = (wxDataObject *) NULL;
m_retValue = Cancel;
m_retValue = wxDragCancel;
m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
m_goaheadCursor = wxCursor( wxCURSOR_HAND );
@@ -183,7 +183,7 @@ wxDropSource::wxDropSource( wxDataObject &data, wxWindow *win )
m_window = win;
m_widget = win->m_widget;
if (win->m_wxwindow) m_widget = win->m_wxwindow;
m_retValue = Cancel;
m_retValue = wxDragCancel;
m_data = &data;
@@ -203,15 +203,15 @@ wxDropSource::~wxDropSource(void)
g_blockEventsOnDrag = FALSE;
}
wxDropSource::DragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
{
if (gdk_dnd.dnd_grabbed) return (wxDropSource::DragResult) None;
if (gdk_dnd.drag_really) return (wxDropSource::DragResult) None;
if (gdk_dnd.dnd_grabbed) return (wxDragResult) wxDragNone;
if (gdk_dnd.drag_really) return (wxDragResult) wxDragNone;
wxASSERT_MSG( m_data, "wxDragSource: no data" );
if (!m_data) return (wxDropSource::DragResult) None;
if (m_data->GetDataSize() == 0) return (wxDropSource::DragResult) None;
if (!m_data) return (wxDragResult) wxDragNone;
if (m_data->GetDataSize() == 0) return (wxDragResult) wxDragNone;
GdkWindowPrivate *wp = (GdkWindowPrivate*) m_widget->window;

View File

@@ -121,13 +121,13 @@ STDMETHODIMP wxIDropSource::QueryContinueDrag(BOOL fEscapePressed,
// Notes : default implementation is ok in more than 99% of cases
STDMETHODIMP wxIDropSource::GiveFeedback(DWORD dwEffect)
{
wxDropSource::DragResult effect;
wxDragResult effect;
if ( dwEffect & DROPEFFECT_COPY )
effect = wxDropSource::Copy;
effect = wxDragCopy;
else if ( dwEffect & DROPEFFECT_MOVE )
effect = wxDropSource::Move;
effect = wxDragMove;
else
effect = wxDropSource::None;
effect = wxDragNone;
if ( m_pDropSource->GiveFeedback(effect,
(dwEffect & DROPEFFECT_SCROLL) != 0 ) )
@@ -173,12 +173,12 @@ wxDropSource::~wxDropSource()
// Name : DoDragDrop
// Purpose : start drag and drop operation
// Returns : DragResult - the code of performed operation
// Returns : wxDragResult - the code of performed operation
// Params : [in] bool bAllowMove: if false, only copy is allowed
// Notes : you must call SetData() before if you had used def ctor
wxDropSource::DragResult wxDropSource::DoDragDrop(bool bAllowMove)
wxDragResult wxDropSource::DoDragDrop(bool bAllowMove)
{
wxCHECK_MSG( m_pData != NULL, None, "No data in wxDropSource!" );
wxCHECK_MSG( m_pData != NULL, wxDragNone, "No data in wxDropSource!" );
DWORD dwEffect;
HRESULT hr = ::DoDragDrop(m_pData->GetInterface(),
@@ -188,23 +188,23 @@ wxDropSource::DragResult wxDropSource::DoDragDrop(bool bAllowMove)
&dwEffect);
if ( hr == DRAGDROP_S_CANCEL ) {
return Cancel;
return wxDragCancel;
}
else if ( hr == DRAGDROP_S_DROP ) {
if ( dwEffect & DROPEFFECT_COPY ) {
return Copy;
return wxDragCopy;
}
else if ( dwEffect & DROPEFFECT_MOVE ) {
// consistency check: normally, we shouldn't get "move" at all
// here if !bAllowMove, but in practice it does happen quite often
if ( bAllowMove )
return Move;
return wxDragMove;
else
return Copy;
return wxDragCopy;
}
else {
// not copy or move
return None;
return wxDragNone;
}
}
else {
@@ -216,7 +216,7 @@ wxDropSource::DragResult wxDropSource::DoDragDrop(bool bAllowMove)
wxLogDebug("Unexpected success return code %08lx from DoDragDrop.", hr);
}
return Error;
return wxDragError;
}
}
@@ -226,9 +226,9 @@ wxDropSource::DragResult wxDropSource::DoDragDrop(bool bAllowMove)
// Params : [in] DragResult effect - what would happen if we dropped now
// [in] bool bScrolling - true if target is scrolling
// Notes : here we just leave this stuff for default implementation
bool wxDropSource::GiveFeedback(DragResult effect, bool bScrolling)
bool wxDropSource::GiveFeedback(wxDragResult effect, bool bScrolling)
{
return FALSE;
}
#endif //USE_DRAG_AND_DROP
#endif //USE_DRAG_AND_DROP

View File

@@ -125,9 +125,9 @@ wxDropSource::~wxDropSource(void)
{
};
wxDropSource::DragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
{
// TODO
return Error;
return wxDragError;
};

View File

@@ -180,11 +180,6 @@ void wxFrame::SetIcon(const wxIcon& icon)
// TODO
}
void wxFrame::SetAcceleratorTable(const wxAcceleratorTable& accel)
{
m_acceleratorTable = accel;
}
wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
const wxString& name)
{

View File

@@ -1172,6 +1172,11 @@ void wxWindow::SetValidator(const wxValidator& validator)
m_windowValidator->SetWindow(this) ;
}
void wxWindow::SetAcceleratorTable(const wxAcceleratorTable& accel)
{
m_acceleratorTable = accel;
}
// Find a window by id or name
wxWindow *wxWindow::FindWindow(long id)
{