#
-# This file was automatically generated by tmake at 20:51, 1999/10/26
+# This file was automatically generated by tmake at 18:44, 1999/10/27
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE UNX.T!
#
mstream.o \
object.o \
objstrm.o \
- odbc.o \
paper.o \
prntbase.o \
process.o \
mstream.d \
object.d \
objstrm.d \
- odbc.d \
paper.d \
prntbase.d \
process.d \
mstream.cpp C
object.cpp C B
objstrm.cpp C
-odbc.cpp C R
+odbc.cpp C R,X
paper.cpp C
prntbase.cpp C
process.cpp C 32,B
///////////////////////////////////////////////////////////////////////////////
// Name: motif/dataform.h
// Purpose: declaration of the wxDataFormat class
-// Author: Vadim Zeitlin
+// Author: Robert Roebling
// Modified by:
// Created: 19.10.99 (extracted from motif/dataobj.h)
// RCS-ID: $Id$
-// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Copyright: (c) 1999 Robert Roebling
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
class wxDataFormat
{
public:
- typedef unsigned long /* Atom */ NativeFormat;
+ // the clipboard formats under Xt are Atoms
+ typedef Atom NativeFormat;
wxDataFormat();
wxDataFormat( wxDataFormatId type );
wxDataFormat( const wxString &id );
wxDataFormat( const wxChar *id );
- wxDataFormat( const wxDataFormat &format );
- wxDataFormat( const Atom atom );
+ wxDataFormat( NativeFormat format );
- void SetType( wxDataFormatId type );
- NativeFormat GetType() const { return m_type; }
+ wxDataFormat& operator=(NativeFormat format)
+ { SetId(format); return *this; }
- /* the string Id identifies the format of clipboard or DnD data. a word
- * processor would e.g. add a wxTextDataObject and a wxPrivateDataObject
- * to the clipboard - the latter with the Id "application/wxword", an
- * image manipulation program would put a wxBitmapDataObject and a
- * wxPrivateDataObject to the clipboard - the latter with "image/png". */
+ // comparison (must have both versions)
+ bool operator==(NativeFormat format) const
+ { return m_format == (NativeFormat)format; }
+ bool operator!=(NativeFormat format) const
+ { return m_format != (NativeFormat)format; }
+ bool operator==(wxDataFormatId format) const
+ { return m_type == (wxDataFormatId)format; }
+ bool operator!=(wxDataFormatId format) const
+ { return m_type != (wxDataFormatId)format; }
- wxString GetId() const { return m_id; }
- void SetId( const wxChar *id );
+ // explicit and implicit conversions to NativeFormat which is one of
+ // standard data types (implicit conversion is useful for preserving the
+ // compatibility with old code)
+ NativeFormat GetFormatId() const { return m_format; }
+ operator NativeFormat() const { return m_format; }
- Atom GetAtom();
- void SetAtom(Atom atom) { m_hasAtom = TRUE; m_atom = atom; }
+ void SetId( NativeFormat format );
- // implicit conversion to wxDataFormatId
- operator NativeFormat() const { return m_type; }
+ // string ids are used for custom types - this SetId() must be used for
+ // application-specific formats
+ wxString GetId() const;
+ void SetId( const wxChar *id );
- bool operator==(NativeFormat type) const { return m_type == type; }
- bool operator!=(NativeFormat type) const { return m_type != type; }
+ // implementation
+ wxDataFormatId GetType() const;
private:
- NativeFormat m_type;
- wxString m_id;
- bool m_hasAtom;
- Atom m_atom;
+ wxDataFormatId m_type;
+ NativeFormat m_format;
+
+ void PrepareFormats();
+ void SetType( wxDataFormatId type );
};
+
#endif // _WX_MOTIF_DATAFORM_H
return (wxCoord)((double)(y) * m_scaleY - 0.5);
}
- void SetInternalDeviceOrigin( wxCoord x, wxCoord y );
- void GetInternalDeviceOrigin( wxCoord *x, wxCoord *y );
-
public:
// not sure what for, but what is a mm on a screen you don't know the size of?
double m_mm_to_pix_x,m_mm_to_pix_y;
- // If un-scrolled is non-zero or d.o. changes with scrolling. Set using
- // SetInternalDeviceOrigin().
- wxCoord m_internalDeviceOriginX,m_internalDeviceOriginY;
-
- // To be set by external classes such as wxScrolledWindow using
- // SetDeviceOrigin()
- wxCoord m_externalDeviceOriginX,m_externalDeviceOriginY;
-
// recompute scale?
bool m_needComputeScaleX, m_needComputeScaleY;
wxPaintDC dc( this );
m_owner->PrepareDC( dc );
+ dc.SetPen( *wxBLACK_PEN );
+
dc.DrawText( "Some text", 140, 140 );
-
+
dc.DrawRectangle( 100, 160, 200, 200 );
dc.SetBrush( *wxTRANSPARENT_BRUSH );
// global data
//-------------------------------------------------------------------------
-Atom g_textAtom = 0;
+Atom g_textAtom = 0;
+Atom g_pngAtom = 0;
+Atom g_fileAtom = 0;
//-------------------------------------------------------------------------
// wxDataFormat
wxDataFormat::wxDataFormat()
{
+ // do *not* call PrepareFormats() from here for 2 reasons:
+ //
+ // 1. we will have time to do it later because some other Set function
+ // must be called before we really need them
+ //
+ // 2. doing so prevents us from declaring global wxDataFormats because
+ // calling PrepareFormats (and thus gdk_atom_intern) before GDK is
+ // initialised will result in a crash
m_type = wxDF_INVALID;
- m_hasAtom = FALSE;
- m_atom = (Atom) 0;
+ m_format = (Atom) 0;
}
wxDataFormat::wxDataFormat( wxDataFormatId type )
{
- if (!g_textAtom) g_textAtom = XInternAtom( (Display*) wxGetDisplay(), "STRING", FALSE );
+ PrepareFormats();
SetType( type );
}
wxDataFormat::wxDataFormat( const wxChar *id )
{
- if (!g_textAtom) g_textAtom = XInternAtom( (Display*) wxGetDisplay(), "STRING", FALSE );
+ PrepareFormats();
SetId( id );
}
wxDataFormat::wxDataFormat( const wxString &id )
{
- if (!g_textAtom) g_textAtom = XInternAtom( (Display*) wxGetDisplay(), "STRING", FALSE );
+ PrepareFormats();
SetId( id );
}
-wxDataFormat::wxDataFormat( const wxDataFormat &format )
+wxDataFormat::wxDataFormat( NativeFormat format )
{
- if (!g_textAtom) g_textAtom = XInternAtom( (Display*) wxGetDisplay(), "STRING", FALSE );
- m_type = format.GetType();
- m_id = format.GetId();
- m_hasAtom = TRUE;
- m_atom = ((wxDataFormat &)format).GetAtom(); // const_cast
-}
-
-wxDataFormat::wxDataFormat( const Atom atom )
-{
- if (!g_textAtom) g_textAtom = XInternAtom( (Display*) wxGetDisplay(), "STRING", FALSE );
- m_hasAtom = TRUE;
-
- m_atom = atom;
-
- if (m_atom == g_textAtom)
- {
- m_type = wxDF_TEXT;
- } else
-/*
- if (m_atom == GDK_TARGET_BITMAP)
- {
- m_type = wxDF_BITMAP;
- } else
-*/
- {
- m_type = wxDF_PRIVATE;
- m_id = XGetAtomName( (Display*) wxGetDisplay(), m_atom );
-
- if (m_id == wxT("file:ALL"))
- {
- m_type = wxDF_FILENAME;
- }
- }
+ PrepareFormats();
+ SetId( format );
}
void wxDataFormat::SetType( wxDataFormatId type )
{
+ PrepareFormats();
m_type = type;
if (m_type == wxDF_TEXT)
- {
- m_id = wxT("STRING");
- }
+ m_format = g_textAtom;
else
if (m_type == wxDF_BITMAP)
- {
- m_id = wxT("BITMAP");
- }
+ m_format = g_pngAtom;
else
if (m_type == wxDF_FILENAME)
- {
- m_id = wxT("file:ALL");
- }
+ m_format = g_fileAtom;
else
{
wxFAIL_MSG( wxT("invalid dataformat") );
}
+}
+
+wxDataFormatId wxDataFormat::GetType() const
+{
+ return m_type;
+}
+
+wxString wxDataFormat::GetId() const
+{
+ char *t = XGetAtomName ((Display*) wxGetDisplay(), m_format);
+ wxString ret( t ); // this will convert from ascii to Unicode
+ if (t)
+ XFree( t );
+ return ret;
+}
+
+void wxDataFormat::SetId( NativeFormat format )
+{
+ PrepareFormats();
+ m_format = format;
- m_hasAtom = FALSE;
+ if (m_format == g_textAtom)
+ m_type = wxDF_TEXT;
+ else
+ if (m_format == g_pngAtom)
+ m_type = wxDF_BITMAP;
+ else
+ if (m_format == g_fileAtom)
+ m_type = wxDF_FILENAME;
+ else
+ m_type = wxDF_PRIVATE;
}
void wxDataFormat::SetId( const wxChar *id )
{
+ PrepareFormats();
m_type = wxDF_PRIVATE;
- m_id = id;
- m_hasAtom = FALSE;
+ wxString tmp( id );
+ m_format = XInternAtom( (Display*) wxGetDisplay(), wxMBSTRINGCAST tmp.mbc_str(), FALSE ); // what is the string cast for?
}
-Atom wxDataFormat::GetAtom()
+void wxDataFormat::PrepareFormats()
{
- if (!m_hasAtom)
- {
- m_hasAtom = TRUE;
-
- if (m_type == wxDF_TEXT)
- {
- m_atom = g_textAtom;
- }
- else
-/*
- if (m_type == wxDF_BITMAP)
- {
- m_atom = GDK_TARGET_BITMAP;
- }
- else
-*/
- if (m_type == wxDF_PRIVATE)
- {
- m_atom = XInternAtom( (Display*) wxGetDisplay(), wxMBSTRINGCAST m_id.mbc_str(), FALSE );
- }
- else
- if (m_type == wxDF_FILENAME)
- {
- m_atom = XInternAtom( (Display*) wxGetDisplay(), "file:ALL", FALSE );
- }
- else
- {
- m_hasAtom = FALSE;
- m_atom = (Atom) 0;
- }
- }
-
- return m_atom;
+ if (!g_textAtom)
+ g_textAtom = XInternAtom( (Display*) wxGetDisplay(), "STRING", FALSE );
+ if (!g_pngAtom)
+ g_pngAtom = XInternAtom( (Display*) wxGetDisplay(), "image/png", FALSE );
+ if (!g_fileAtom)
+ g_fileAtom = XInternAtom( (Display*) wxGetDisplay(), "file:ALL", FALSE );
}
#if 0
m_backgroundMode = wxTRANSPARENT;
m_isInteractive = FALSE;
-
- m_internalDeviceOriginX = 0;
- m_internalDeviceOriginY = 0;
- m_externalDeviceOriginX = 0;
- m_externalDeviceOriginY = 0;
}
void wxDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y)
void wxDC::SetDeviceOrigin( wxCoord x, wxCoord y )
{
- m_externalDeviceOriginX = x;
- m_externalDeviceOriginY = y;
+ // only wxPostScripDC has m_signX = -1, we override SetDeviceOrigin there
+ m_deviceOriginX = x;
+ m_deviceOriginY = y;
ComputeScaleAndOrigin();
}
-void wxDC::SetInternalDeviceOrigin( wxCoord x, wxCoord y )
-{
- m_internalDeviceOriginX = x;
- m_internalDeviceOriginY = y;
- ComputeScaleAndOrigin();
-}
-
-void wxDC::GetInternalDeviceOrigin( wxCoord *x, wxCoord *y )
-{
- if (x) *x = m_internalDeviceOriginX;
- if (y) *y = m_internalDeviceOriginY;
-}
-
void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
{
m_signX = xLeftRight ? 1 : -1;
void wxDC::ComputeScaleAndOrigin()
{
- // CMB: copy scale to see if it changes
- double origScaleX = m_scaleX;
- double origScaleY = m_scaleY;
-
m_scaleX = m_logicalScaleX * m_userScaleX;
m_scaleY = m_logicalScaleY * m_userScaleY;
-
- m_deviceOriginX = m_internalDeviceOriginX + m_externalDeviceOriginX;
- m_deviceOriginY = m_internalDeviceOriginY + m_externalDeviceOriginY;
-
- // CMB: if scale has changed call SetPen to recalulate the line width
- if (m_scaleX != origScaleX || m_scaleY != origScaleY)
- {
- // this is a bit artificial, but we need to force wxDC to think
- // the pen has changed
- wxPen* pen = & GetPen();
- wxPen tempPen;
- m_pen = tempPen;
- SetPen(* pen);
- }
}
XtAppAddActions ((XtAppContext) wxTheApp->GetAppContext(), actions, 1);
Widget parentWidget = (Widget) parent->GetClientWidget();
- if (style & wxBORDER)
+
+ if (style & wxSIMPLE_BORDER)
+ {
+ m_borderWidget = (WXWidget)XtVaCreateManagedWidget
+ (
+ "canvasBorder",
+ xmFrameWidgetClass, parentWidget,
+ XmNshadowType, XmSHADOW_IN,
+ XmNshadowThickness, 1,
+ NULL
+ );
+ } else if (style & wxSUNKEN_BORDER)
{
m_borderWidget = (WXWidget)XtVaCreateManagedWidget
(
XmNshadowType, XmSHADOW_IN,
NULL
);
+ } else if (style & wxRAISED_BORDER)
+ {
+ m_borderWidget = (WXWidget)XtVaCreateManagedWidget
+ (
+ "canvasBorder",
+ xmFrameWidgetClass, parentWidget,
+ XmNshadowType, XmSHADOW_OUT,
+ NULL
+ );
}
m_scrolledWindow = (WXWidget)XtVaCreateManagedWidget
GetClientSize(& w, & h);
}
+ wxNode *cnode = m_children.First();
+ while (cnode)
+ {
+ wxWindow *child = (wxWindow*) cnode->Data();
+ int sx = 0;
+ int sy = 0;
+ child->GetSize( &sx, &sy );
+ wxPoint pos( child->GetPosition() );
+ child->SetSize( pos.x + dx, pos.y + dy, sx, sy, wxSIZE_ALLOW_MINUS_ONE );
+ cnode = cnode->Next();
+ }
+
int x1 = (dx >= 0) ? x : x - dx;
int y1 = (dy >= 0) ? y : y - dy;
int w1 = w - abs(dx);