CW5.2 Pro Adaptions, wxMac starting to move in

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4366 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
1999-11-05 09:16:09 +00:00
parent 20f2deb3cf
commit 519cb848a8
176 changed files with 19303 additions and 9141 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -1534,6 +1534,44 @@ typedef enum {
// platform specific (implementation) parts of the headers
// ---------------------------------------------------------------------------
#ifdef __WXMAC__
typedef WindowPtr WXHWND;
typedef Handle WXHANDLE;
typedef CIconHandle WXHICON;
//typedef unsigned long WXHFONT;
typedef MenuHandle WXHMENU;
//typedef unsigned long WXHPEN;
//typedef unsigned long WXHBRUSH;
//typedef unsigned long WXHPALETTE;
typedef CursHandle WXHCURSOR;
typedef RgnHandle WXHRGN;
//typedef unsigned long WXHACCEL;
//typedef unsigned long WXHINSTANCE;
typedef GWorldPtr WXHBITMAP;
//typedef unsigned long WXHIMAGELIST;
//typedef unsigned long WXHGLOBAL;
typedef GrafPtr WXHDC;
typedef unsigned int WXUINT;
typedef unsigned long WXDWORD;
typedef unsigned short WXWORD;
//typedef unsigned int WXWPARAM;
//typedef long WXLPARAM;
typedef RGBColor WXCOLORREF;
//typedef void * WXRGNDATA;
//typedef void * WXMSG;
//typedef unsigned long WXHCONV;
//typedef unsigned long WXHKEY;
//typedef void * WXDRAWITEMSTRUCT;
//typedef void * WXMEASUREITEMSTRUCT;
//typedef void * WXLPCREATESTRUCT;
typedef int (*WXFARPROC)();
typedef WindowPtr WXWindow;
typedef ControlHandle WXWidget;
#endif
#if defined(__WXMSW__) || defined(__WXPM__)
// Stand-ins for Windows types or OS/2, to avoid #including all of windows.h or os2.h
typedef unsigned long WXHWND;

View File

@@ -72,6 +72,12 @@ enum
wxBITMAP_TYPE_PNM_RESOURCE,
wxBITMAP_TYPE_PCX,
wxBITMAP_TYPE_PCX_RESOURCE,
wxBITMAP_TYPE_PICT,
wxBITMAP_TYPE_PICT_RESOURCE,
wxBITMAP_TYPE_ICON,
wxBITMAP_TYPE_ICON_RESOURCE,
wxBITMAP_TYPE_MACCURSOR ,
wxBITMAP_TYPE_MACCURSOR_RESOURCE,
wxBITMAP_TYPE_ANY = 50
};

View File

@@ -67,11 +67,6 @@ class WXDLLEXPORT wxApp: public wxEvtHandler
virtual int OnRun() { return MainLoop(); };
virtual int OnExit() { return 0; }
/** Returns the standard icons for the msg dialogs, implemented in
src/generic/msgdlgg.cpp and src/gtk/app.cpp. */
virtual wxIcon GetStdIcon(int which) const;
inline void SetPrintMode(int mode) { m_printMode = mode; }
inline int GetPrintMode() const { return m_printMode; }
@@ -141,6 +136,11 @@ public:
public:
static long sm_lastMessageTime;
static wxWindow* s_captureWindow ;
static int s_lastMouseDown ; // 0 = none , 1 = left , 2 = right
static RgnHandle s_macCursorRgn ;
EventRecord* m_macCurrentEvent ;
int m_nCmdShow;
protected:
@@ -149,23 +149,54 @@ protected:
// mac specifics
public :
static bool s_macDefaultEncodingIsPC ;
static bool s_macSupportPCMenuShortcuts ;
static long s_macAboutMenuItemId ;
static wxString s_macHelpMenuTitleName ;
void MacDoOneEvent() ;
static bool s_macHasAppearance ;
static long s_macAppearanceVersion ;
static bool s_macHasNavigation ;
static bool s_macNavigationVersion ;
static bool s_macHasWindowManager ;
static long s_macWindowManagerVersion ;
static bool s_macHasMenuManager ;
static long s_macMenuManagerVersion ;
static bool s_macHasDialogManager ;
static long s_macDialogManagerVersion ;
RgnHandle m_macCursorRgn ;
RgnHandle m_macSleepRgn ;
RgnHandle m_macHelpRgn ;
virtual void MacSuspend( bool convertClipboard ) ;
virtual void MacResume( bool convertClipboard ) ;
virtual void MacConvertPrivateToPublicScrap() ;
virtual void MacConvertPublicToPrivateScrap() ;
// event main methods
void MacDoOneEvent() ;
void MacHandleOneEvent( EventRecord *ev ) ;
void MacHandleNullEvent( EventRecord *ev ) ;
void MacHandleHighLevelEvent( EventRecord *ev ) ;
void MacHandleMouseDownEvent( EventRecord *ev ) ;
void MacHandleMouseUpEvent( EventRecord *ev ) ;
void MacHandleKeyDownEvent( EventRecord *ev ) ;
void MacHandleKeyUpEvent( EventRecord *ev ) ;
void MacHandleAutoKeyEvent( EventRecord *ev ) ;
void MacHandleActivateEvent( EventRecord *ev ) ;
void MacHandleUpdateEvent( EventRecord *ev ) ;
void MacHandleDiskEvent( EventRecord *ev ) ;
void MacHandleOSEvent( EventRecord *ev ) ;
EventRecord* MacGetCurrentEvent() { return m_macCurrentEvent ; }
// primary events
virtual void MacHandleMouseDownEvent( EventRecord *ev ) ;
virtual void MacHandleMouseUpEvent( EventRecord *ev ) ;
virtual void MacHandleActivateEvent( EventRecord *ev ) ;
virtual void MacHandleUpdateEvent( EventRecord *ev ) ;
virtual void MacHandleKeyDownEvent( EventRecord *ev ) ;
virtual void MacHandleKeyUpEvent( EventRecord *ev ) ;
virtual void MacHandleDiskEvent( EventRecord *ev ) ;
virtual void MacHandleOSEvent( EventRecord *ev ) ;
virtual void MacHandleHighLevelEvent( EventRecord *ev ) ;
virtual void MacHandleMenuSelect( int menuid , int menuitem ) ;
virtual OSErr MacHandleAEODoc(AppleEvent *event , AppleEvent *reply) ;
virtual OSErr MacHandleAEPDoc(AppleEvent *event , AppleEvent *reply) ;
virtual OSErr MacHandleAEOApp(AppleEvent *event , AppleEvent *reply) ;
virtual OSErr MacHandleAEQuit(AppleEvent *event , AppleEvent *reply) ;
DECLARE_EVENT_TABLE()
};
@@ -173,6 +204,18 @@ DECLARE_EVENT_TABLE()
// TODO: add platform-specific arguments
int WXDLLEXPORT wxEntry( int argc, char *argv[] );
void wxMacConvertFromPCForControls( char * p ) ;
void wxMacConvertToPC( const char *from , char *to , int len ) ;
void wxMacConvertFromPC( const char *from , char *to , int len ) ;
void wxMacConvertToPC( const char *from , char *to , int len ) ;
void wxMacConvertFromPC( char * p ) ;
void wxMacConvertFromPC( unsigned char *p ) ;
wxString wxMacMakeMacStringFromPC( const char * p ) ;
void wxMacConvertToPC( char * p ) ;
void wxMacConvertToPC( unsigned char *p ) ;
wxString wxMacMakePCStringFromMac( const char * p ) ;
#endif
// _WX_APP_H_

View File

@@ -28,6 +28,12 @@ class WXDLLEXPORT wxBitmapHandler;
class WXDLLEXPORT wxIcon;
class WXDLLEXPORT wxCursor;
GWorldPtr wxMacCreateGWorld( int height , int widtdh , int depth ) ;
void wxMacDestroyGWorld( GWorldPtr gw ) ;
PicHandle wxMacCreatePict( GWorldPtr gw , GWorldPtr mask = NULL ) ;
void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) ;
CTabHandle wxMacCreateColorTable( int numColors ) ;
// A mask is a mono bitmap used for drawing bitmaps
// transparently.
class WXDLLEXPORT wxMask: public wxObject
@@ -54,15 +60,15 @@ public:
bool Create(const wxBitmap& bitmap, int paletteIndex);
bool Create(const wxBitmap& bitmap);
/* TODO: platform-specific data access
// Implementation
inline WXHBITMAP GetMaskBitmap() const { return m_maskBitmap; }
inline void SetMaskBitmap(WXHBITMAP bmp) { m_maskBitmap = bmp; }
protected:
WXHBITMAP m_maskBitmap;
*/
};
enum { kMacBitmapTypeUnknownType , kMacBitmapTypeGrafWorld, kMacBitmapTypePict } ;
class WXDLLEXPORT wxBitmapRefData: public wxGDIRefData
{
friend class WXDLLEXPORT wxBitmap;
@@ -81,7 +87,9 @@ public:
wxPalette m_bitmapPalette;
int m_quality;
/* WXHBITMAP m_hBitmap; TODO: platform-specific handle */
int m_bitmapType ;
PicHandle m_hPict ;
WXHBITMAP m_hBitmap;
wxMask * m_bitmapMask; // Optional mask
};
@@ -128,14 +136,11 @@ public:
// Initialize with raw data.
wxBitmap(const char bits[], int width, int height, int depth = 1);
/* TODO: maybe implement XPM reading
// Initialize with XPM data
wxBitmap(const char **data);
*/
// Load a file or resource
// TODO: make default type whatever's appropriate for the platform.
wxBitmap(const wxString& name, long type = wxBITMAP_TYPE_BMP_RESOURCE);
wxBitmap(const wxString& name, long type = wxBITMAP_TYPE_PICT_RESOURCE);
// Constructor for generalised creation from data
wxBitmap(void *data, long type, int width, int height, int depth = 1);
@@ -184,14 +189,11 @@ public:
protected:
static wxList sm_handlers;
/*
// TODO: Implementation
public:
void SetHBITMAP(WXHBITMAP bmp);
inline WXHBITMAP GetHBITMAP() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_hBitmap : 0); }
bool FreeResource(bool force = FALSE);
*/
};
#endif
// _WX_BITMAP_H_

View File

@@ -47,6 +47,8 @@ class WXDLLEXPORT wxBitmapButton: public wxButton
SetBitmapLabel(bitmap);
}
virtual void SetLabel( const wxString &name ) {}
virtual void SetBitmapLabel(const wxBitmap& bitmap);
inline wxBitmap& GetBitmapLabel() const { return (wxBitmap&) m_buttonBitmap; }

View File

@@ -42,10 +42,8 @@ class WXDLLEXPORT wxButton: public wxControl
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
virtual void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
virtual void SetDefault();
virtual void SetLabel(const wxString& label);
virtual wxString GetLabel() const ;
virtual void Command(wxCommandEvent& event);
};

View File

@@ -44,8 +44,7 @@ class WXDLLEXPORT wxCheckBox: public wxControl
const wxString& name = wxCheckBoxNameStr);
virtual void SetValue(bool);
virtual bool GetValue() const ;
virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
virtual void SetLabel(const wxString& label);
virtual void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
virtual void Command(wxCommandEvent& event);
};
@@ -76,6 +75,7 @@ class WXDLLEXPORT wxBitmapCheckBox: public wxCheckBox
virtual bool GetValue() const ;
virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
virtual void SetLabel(const wxBitmap *bitmap);
virtual void SetLabel( const wxString &name ) {}
};
#endif
// _WX_CHECKBOX_H_

View File

@@ -63,9 +63,11 @@ class WXDLLEXPORT wxChoice: public wxControl
virtual inline void SetColumns(int WXUNUSED(n) = 1 ) { /* No effect */ } ;
virtual inline int GetColumns() const { return 1 ; };
void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
protected:
int m_noStrings;
MenuHandle m_macPopUpMenuHandle ;
};
#endif

View File

@@ -24,17 +24,6 @@
#include "wx/list.h"
bool WXDLLEXPORT wxOpenClipboard();
bool WXDLLEXPORT wxClipboardOpen();
bool WXDLLEXPORT wxCloseClipboard();
bool WXDLLEXPORT wxEmptyClipboard();
bool WXDLLEXPORT wxIsClipboardFormatAvailable(int dataFormat);
bool WXDLLEXPORT wxSetClipboardData(int dataFormat, wxObject *obj, int width = 0, int height = 0);
wxObject* WXDLLEXPORT wxGetClipboardData(int dataFormat, long *len = NULL);
int WXDLLEXPORT wxEnumClipboardFormats(int dataFormat);
int WXDLLEXPORT wxRegisterClipboardFormat(char *formatName);
bool WXDLLEXPORT wxGetClipboardFormatName(int dataFormat, char *formatName, int maxCount);
/* A clipboard client holds data belonging to the clipboard.
For plain text, a client is not necessary. */
class WXDLLEXPORT wxClipboardClient : public wxObject

View File

@@ -74,9 +74,7 @@ public:
void InitFromName(const wxString& col);
/* TODO
WXCOLORREF GetPixel() const { return m_pixel; };
*/
const WXCOLORREF GetPixel() const { return m_pixel; };
private:
bool m_isInit;
@@ -85,9 +83,8 @@ private:
unsigned char m_green;
public:
/* TODO: implementation
WXCOLORREF m_pixel ;
*/
WXCOLORREF m_pixel ;
void Set( WXCOLORREF color ) { m_pixel = color ; m_red = m_pixel.red>>8 ;m_blue = m_pixel.blue>>8 ;m_green = m_pixel.green>>8 ;}
private:
DECLARE_DYNAMIC_CLASS(wxColour)

View File

@@ -78,6 +78,10 @@ class WXDLLEXPORT wxComboBox: public wxChoice
virtual void Remove(long from, long to);
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
protected:
int m_noStrings;
MenuHandle m_macPopUpMenuHandle ;
};
#endif

View File

@@ -16,35 +16,77 @@
#pragma interface "control.h"
#endif
#include "wx/window.h"
#include "wx/list.h"
#include "wx/validate.h"
// General item class
class WXDLLEXPORT wxControl: public wxWindow
class WXDLLEXPORT wxControl : public wxControlBase
{
DECLARE_ABSTRACT_CLASS(wxControl)
DECLARE_ABSTRACT_CLASS(wxControl)
public:
wxControl();
~wxControl();
virtual ~wxControl();
virtual void Command(wxCommandEvent& WXUNUSED(event)) {}; // Simulates an event
virtual void ProcessCommand(wxCommandEvent& event); // Calls the callback and
// appropriate event handlers
virtual void SetLabel(const wxString& label);
virtual wxString GetLabel() const ;
// Simulates an event
virtual void Command(wxCommandEvent& event) { ProcessCommand(event); }
// Places item in centre of panel - so can't be used BEFORE panel->Fit()
void Centre(int direction = wxHORIZONTAL);
inline void Callback(const wxFunction function) { m_callback = function; }; // Adds callback
// implementation from now on
// --------------------------
inline wxFunction GetCallback() { return m_callback; }
// Calls the callback and appropriate event handlers
bool ProcessCommand(wxCommandEvent& event);
wxList& GetSubcontrols() { return m_subControls; }
void OnEraseBackground(wxEraseEvent& event);
#if WXWIN_COMPATIBILITY
virtual void SetButtonColour(const wxColour& WXUNUSED(col)) { }
wxColour* GetButtonColour() const { return NULL; }
inline virtual void SetLabelFont(const wxFont& font);
inline virtual void SetButtonFont(const wxFont& font);
inline wxFont& GetLabelFont() const;
inline wxFont& GetButtonFont() const;
// Adds callback
inline void Callback(const wxFunction function);
wxFunction GetCallback() { return m_callback; }
protected:
wxFunction m_callback; // Callback associated with the window
#endif // WXWIN_COMPATIBILITY
DECLARE_EVENT_TABLE()
protected:
// For controls like radiobuttons which are really composite
wxList m_subControls;
virtual wxSize DoGetBestSize();
// create the control of the given class with the given style, returns FALSE
// if creation failed
bool MSWCreateControl(const wxChar *classname, WXDWORD style);
// determine the extended styles combination for this window (may slightly
// modify styl parameter)
WXDWORD GetExStyle(WXDWORD& style) const;
private:
DECLARE_EVENT_TABLE()
};
#if WXWIN_COMPATIBILITY
inline void wxControl::Callback(const wxFunction f) { m_callback = f; };
inline wxFont& wxControl::GetLabelFont() const { return GetFont(); }
inline wxFont& wxControl::GetButtonFont() const { return GetFont(); }
inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); }
inline void wxControl::SetButtonFont(const wxFont& font) { SetFont(font); }
#endif // WXWIN_COMPATIBILITY
wxControl *wxFindControlFromMacControl(ControlHandle inControl ) ;
void wxAssociateControlWithMacControl(ControlHandle inControl, wxControl *control) ;
void wxRemoveMacControlAssociation(wxControl *control) ;
#endif
// _WX_CONTROL_H_

View File

@@ -27,9 +27,7 @@ public:
~wxCursorRefData();
protected:
/* TODO: implementation
WXHCURSOR m_hCursor;
*/
};
#define M_CURSORDATA ((wxCursorRefData *)m_refData)
@@ -49,24 +47,22 @@ public:
wxCursor(const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1,
const char maskBits[] = NULL);
/* TODO: make default type suit platform */
wxCursor(const wxString& name, long flags = wxBITMAP_TYPE_CUR_RESOURCE,
wxCursor(const wxString& name, long flags = wxBITMAP_TYPE_MACCURSOR_RESOURCE,
int hotSpotX = 0, int hotSpotY = 0);
wxCursor(int cursor_type);
~wxCursor();
// TODO: also verify the internal cursor handle
virtual bool Ok() const { return (m_refData != NULL) ; }
virtual bool Ok() const { return (m_refData != NULL && M_CURSORDATA->m_hCursor != NULL ) ; }
inline wxCursor& operator = (const wxCursor& cursor) { if (*this == cursor) return (*this); Ref(cursor); return *this; }
inline bool operator == (const wxCursor& cursor) { return m_refData == cursor.m_refData; }
inline bool operator != (const wxCursor& cursor) { return m_refData != cursor.m_refData; }
/* TODO: implementation
void MacInstall() const ;
void SetHCURSOR(WXHCURSOR cursor);
inline WXHCURSOR GetHCURSOR() const { return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0); }
*/
};
extern WXDLLEXPORT void wxSetCursor(const wxCursor& cursor);

View File

@@ -61,53 +61,53 @@ class WXDLLEXPORT wxDC: public wxObject
virtual bool Ok(void) const { return m_ok; };
virtual void FloodFill( long x1, long y1, const wxColour& col, int style=wxFLOOD_SURFACE ) = 0;
virtual void FloodFill( long x1, long y1, const wxColour& col, int style=wxFLOOD_SURFACE );
inline void FloodFill(const wxPoint& pt, const wxColour& col, int style=wxFLOOD_SURFACE)
{
FloodFill(pt.x, pt.y, col, style);
}
virtual bool GetPixel( long x1, long y1, wxColour *col ) const = 0;
virtual bool GetPixel( long x1, long y1, wxColour *col ) const ;
inline bool GetPixel(const wxPoint& pt, wxColour *col) const
{
return GetPixel(pt.x, pt.y, col);
}
virtual void DrawLine( long x1, long y1, long x2, long y2 ) = 0;
virtual void DrawLine( long x1, long y1, long x2, long y2 );
inline void DrawLine(const wxPoint& pt1, const wxPoint& pt2)
{
DrawLine(pt1.x, pt1.y, pt2.x, pt2.y);
}
virtual void CrossHair( long x, long y ) = 0;
virtual void CrossHair( long x, long y );
inline void CrossHair(const wxPoint& pt)
{
CrossHair(pt.x, pt.y);
}
virtual void DrawArc( long x1, long y1, long x2, long y2, long xc, long yc ) = 0;
virtual void DrawArc( long x1, long y1, long x2, long y2, long xc, long yc );
inline void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre)
{
DrawArc(pt1.x, pt1.y, pt2.x, pt2.y, centre.x, centre.y);
}
virtual void DrawEllipticArc( long x, long y, long width, long height, double sa, double ea ) = 0;
virtual void DrawEllipticArc( long x, long y, long width, long height, double sa, double ea );
virtual void DrawEllipticArc (const wxPoint& pt, const wxSize& sz, double sa, double ea)
{
DrawEllipticArc(pt.x, pt.y, sz.x, sz.y, sa, ea);
}
virtual void DrawPoint( long x, long y ) = 0;
virtual void DrawPoint( long x, long y );
virtual void DrawPoint( wxPoint& point );
virtual void DrawLines( int n, wxPoint points[], long xoffset = 0, long yoffset = 0 ) = 0;
virtual void DrawLines( int n, wxPoint points[], long xoffset = 0, long yoffset = 0 );
virtual void DrawLines( wxList *points, long xoffset = 0, long yoffset = 0 );
virtual void DrawPolygon( int n, wxPoint points[], long xoffset = 0, long yoffset = 0,
int fillStyle=wxODDEVEN_RULE ) = 0;
int fillStyle=wxODDEVEN_RULE );
virtual void DrawPolygon( wxList *lines, long xoffset = 0, long yoffset = 0,
int fillStyle=wxODDEVEN_RULE );
virtual void DrawRectangle( long x, long y, long width, long height ) = 0;
virtual void DrawRectangle( long x, long y, long width, long height );
inline void DrawRectangle(const wxPoint& pt, const wxSize& sz)
{
DrawRectangle(pt.x, pt.y, sz.x, sz.y);
@@ -116,7 +116,7 @@ class WXDLLEXPORT wxDC: public wxObject
{
DrawRectangle(rect.x, rect.y, rect.width, rect.height);
}
virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 ) = 0;
virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 );
inline void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, double radius = 20.0)
{
DrawRoundedRectangle(pt.x, pt.y, sz.x, sz.y, radius);
@@ -126,7 +126,7 @@ class WXDLLEXPORT wxDC: public wxObject
DrawRoundedRectangle(rect.x, rect.y, rect.width, rect.height, radius);
}
virtual void DrawEllipse( long x, long y, long width, long height ) = 0;
virtual void DrawEllipse( long x, long y, long width, long height );
inline void DrawEllipse(const wxPoint& pt, const wxSize& sz)
{
DrawEllipse(pt.x, pt.y, sz.x, sz.y);
@@ -137,10 +137,10 @@ class WXDLLEXPORT wxDC: public wxObject
}
virtual void DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 );
virtual void DrawSpline( wxList *points ) = 0;
virtual void DrawSpline( wxList *points );
virtual void DrawSpline( int n, wxPoint points[] );
virtual bool CanDrawBitmap(void) const = 0;
virtual bool CanDrawBitmap(void) const ;
virtual void DrawIcon( const wxIcon &icon, long x, long y, bool useMask=FALSE );
inline void DrawIcon(const wxIcon& icon, const wxPoint& pt)
@@ -148,47 +148,44 @@ class WXDLLEXPORT wxDC: public wxObject
DrawIcon(icon, pt.x, pt.y);
}
// TODO DrawBitmap is not always the same as DrawIcon, especially if bitmaps and
// icons are implemented differently.
void DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask=FALSE )
{ DrawIcon( *((wxIcon*)(&bmp)), x, y, useMask ); }
void DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask=FALSE ) ;
virtual bool Blit( long xdest, long ydest, long width, long height,
wxDC *source, long xsrc, long ysrc, int logical_func = wxCOPY, bool useMask=FALSE ) = 0;
wxDC *source, long xsrc, long ysrc, int logical_func = wxCOPY, bool useMask=FALSE );
inline bool Blit(const wxPoint& destPt, const wxSize& sz,
wxDC *source, const wxPoint& srcPt, int rop = wxCOPY, bool useMask = FALSE)
{
return Blit(destPt.x, destPt.y, sz.x, sz.y, source, srcPt.x, srcPt.y, rop, useMask);
}
virtual void DrawText( const wxString &text, long x, long y, bool use16 = FALSE ) = 0;
virtual void DrawText( const wxString &text, long x, long y, bool use16 = FALSE );
inline void DrawText(const wxString& text, const wxPoint& pt, bool use16bit = FALSE)
{
DrawText(text, pt.x, pt.y, use16bit);
}
virtual bool CanGetTextExtent(void) const = 0;
virtual bool CanGetTextExtent(void) const ;
virtual void GetTextExtent( const wxString &string, long *width, long *height,
long *descent = NULL, long *externalLeading = NULL,
wxFont *theFont = NULL, bool use16 = FALSE ) = 0;
virtual long GetCharWidth(void) = 0;
virtual long GetCharHeight(void) = 0;
wxFont *theFont = NULL, bool use16 = FALSE ) const ;
virtual long GetCharWidth(void);
virtual long GetCharHeight(void);
virtual void Clear(void) = 0;
virtual void Clear(void);
virtual void SetFont( const wxFont &font ) = 0;
virtual void SetFont( const wxFont &font );
virtual wxFont& GetFont(void) const { return (wxFont&) m_font; };
virtual void SetPen( const wxPen &pen ) = 0;
virtual void SetPen( const wxPen &pen );
virtual wxPen& GetPen(void) const { return (wxPen&) m_pen; };
virtual void SetBrush( const wxBrush &brush ) = 0;
virtual void SetBrush( const wxBrush &brush );
virtual wxBrush& GetBrush(void) const { return (wxBrush&) m_brush; };
virtual void SetBackground( const wxBrush &brush ) = 0;
virtual void SetBackground( const wxBrush &brush );
virtual wxBrush& GetBackground(void) const { return (wxBrush&) m_backgroundBrush; };
virtual void SetLogicalFunction( int function ) = 0;
virtual void SetLogicalFunction( int function );
virtual int GetLogicalFunction(void) const { return m_logicalFunction; };
virtual void SetTextForeground( const wxColour &col );
@@ -196,10 +193,10 @@ class WXDLLEXPORT wxDC: public wxObject
virtual wxColour& GetTextBackground(void) const { return (wxColour&)m_textBackgroundColour; };
virtual wxColour& GetTextForeground(void) const { return (wxColour&)m_textForegroundColour; };
virtual void SetBackgroundMode( int mode ) = 0;
virtual void SetBackgroundMode( int mode );
virtual int GetBackgroundMode(void) const { return m_backgroundMode; };
virtual void SetPalette( const wxPalette& palette ) = 0;
virtual void SetPalette( const wxPalette& palette );
void SetColourMap( const wxPalette& palette ) { SetPalette(palette); };
// the first two must be overridden and called
@@ -368,6 +365,30 @@ class WXDLLEXPORT wxDC: public wxObject
long m_clipX1,m_clipY1,m_clipX2,m_clipY2;
long m_minX,m_maxX,m_minY,m_maxY;
//begin wxmac
GrafPtr m_macPort ;
// in order to preserve the const inheritance of the virtual functions, we have to
// use mutable variables starting from CWPro 5
void MacInstallFont() const ;
void MacInstallPen() const ;
void MacInstallBrush() const ;
mutable bool m_macFontInstalled ;
mutable bool m_macPenInstalled ;
mutable bool m_macBrushInstalled ;
mutable long m_macPortId ;
GrafPtr m_macOrigPort ;
Rect m_macClipRect ;
Point m_macLocalOrigin ;
void MacSetupPort() const ;
void MacVerifySetup() const { if ( m_macPortId != m_macCurrentPortId ) MacSetupPort() ; }
static long m_macCurrentPortId ;
};
#endif

View File

@@ -25,100 +25,44 @@
class WXDLLEXPORT wxPaintDC;
class WXDLLEXPORT wxWindow;
// Under Windows, wxClientDC, wxPaintDC and wxWindowDC are implemented differently.
// On many platforms, however, they will be the same.
class WXDLLEXPORT wxWindowDC: public wxDC
{
DECLARE_DYNAMIC_CLASS(wxWindowDC)
public:
public:
wxWindowDC(void);
wxWindowDC(void);
wxWindowDC( wxWindow *win );
// Create a DC corresponding to a canvas
wxWindowDC(wxWindow *win);
~wxWindowDC(void);
virtual void FloodFill( long x1, long y1, const wxColour& col, int style=wxFLOOD_SURFACE );
virtual bool GetPixel( long x1, long y1, wxColour *col ) const;
virtual void DrawLine( long x1, long y1, long x2, long y2 );
virtual void CrossHair( long x, long y );
virtual void DrawArc( long x1, long y1, long x2, long y2, long xc, long yc );
virtual void DrawEllipticArc( long x, long y, long width, long height, double sa, double ea );
virtual void DrawPoint( long x, long y );
virtual void DrawLines( int n, wxPoint points[], long xoffset = 0, long yoffset = 0 );
virtual void DrawLines( wxList *points, long xoffset = 0, long yoffset = 0 );
virtual void DrawPolygon( int n, wxPoint points[], long xoffset = 0, long yoffset = 0,
int fillStyle=wxODDEVEN_RULE );
virtual void DrawPolygon( wxList *lines, long xoffset = 0, long yoffset = 0,
int fillStyle=wxODDEVEN_RULE );
virtual void DrawRectangle( long x, long y, long width, long height );
virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 );
virtual void DrawEllipse( long x, long y, long width, long height );
virtual bool CanDrawBitmap(void) const;
virtual void DrawIcon( const wxIcon &icon, long x, long y, bool useMask=FALSE );
virtual bool Blit( long xdest, long ydest, long width, long height,
wxDC *source, long xsrc, long ysrc, int logical_func = wxCOPY, bool useMask=FALSE );
virtual void DrawText( const wxString &text, long x, long y, bool use16 = FALSE );
virtual bool CanGetTextExtent(void) const;
virtual void GetTextExtent( const wxString &string, long *width, long *height,
long *descent = NULL, long *externalLeading = NULL,
wxFont *theFont = NULL, bool use16 = FALSE );
virtual long GetCharWidth(void);
virtual long GetCharHeight(void);
virtual void Clear(void);
virtual void SetFont( const wxFont &font );
virtual void SetPen( const wxPen &pen );
virtual void SetBrush( const wxBrush &brush );
virtual void SetBackground( const wxBrush &brush );
virtual void SetLogicalFunction( int function );
virtual void SetTextForeground( const wxColour &col );
virtual void SetTextBackground( const wxColour &col );
virtual void SetBackgroundMode( int mode );
virtual void SetPalette( const wxPalette& palette );
virtual void SetClippingRegion( long x, long y, long width, long height );
virtual void SetClippingRegion( const wxRegion& region ) ;
virtual void DestroyClippingRegion(void);
virtual void DrawSpline( wxList *points );
~wxWindowDC(void);
};
//-----------------------------------------------------------------------------
// wxPaintDC
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxPaintDC: public wxWindowDC
{
DECLARE_DYNAMIC_CLASS(wxPaintDC)
public:
wxPaintDC(void):wxWindowDC() {};
wxPaintDC( wxWindow *win ): wxWindowDC(win) {};
};
//-----------------------------------------------------------------------------
// wxClientDC
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxClientDC: public wxWindowDC
{
DECLARE_DYNAMIC_CLASS(wxClientDC)
public:
public:
wxClientDC(void);
wxClientDC(void):wxWindowDC() {};
wxClientDC( wxWindow *win ): wxWindowDC(win) {};
// Create a DC corresponding to a canvas
wxClientDC(wxWindow *win);
~wxClientDC(void);
};
class WXDLLEXPORT wxPaintDC: public wxWindowDC
{
DECLARE_DYNAMIC_CLASS(wxPaintDC)
public:
wxPaintDC(void);
// Create a DC corresponding to a canvas
wxPaintDC(wxWindow *win);
~wxPaintDC(void);
};
#endif

View File

@@ -28,9 +28,8 @@ class WXDLLEXPORT wxMemoryDC: public wxPaintDC
~wxMemoryDC(void);
virtual void SelectObject( const wxBitmap& bitmap );
void GetSize( int *width, int *height ) const;
wxBitmap GetSelectedObject() { return m_selected ; }
private:
friend wxPaintDC;
wxBitmap m_selected;
};

View File

@@ -17,6 +17,7 @@
#endif
#include "wx/dc.h"
#include "wx/cmndata.h"
class WXDLLEXPORT wxPrinterDC: public wxDC
{
@@ -24,9 +25,16 @@ class WXDLLEXPORT wxPrinterDC: public wxDC
DECLARE_CLASS(wxPrinterDC)
// Create a printer DC
wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output, bool interactive = TRUE, int orientation = wxPORTRAIT);
wxPrinterDC(const wxPrintData& printdata );
~wxPrinterDC();
virtual bool StartDoc( const wxString& WXUNUSED(message) ) ;
virtual void EndDoc(void) ;
virtual void StartPage(void) ;
virtual void EndPage(void) ;
protected :
TPPrPort m_macPrintPort ;
wxPrintData m_printData ;
};
#endif

View File

@@ -60,23 +60,17 @@ public:
~wxDialog();
virtual bool Destroy();
void SetClientSize(int width, int height);
void GetPosition(int *x, int *y) const;
bool Show(bool show);
void Fit();
void Iconize(bool iconize);
virtual bool IsIconized() const;
void Fit();
void SetTitle(const wxString& title);
wxString GetTitle() const ;
void OnCharHook(wxKeyEvent& event);
void OnCloseWindow(wxCloseEvent& event);
void SetModal(bool flag);
virtual void Centre(int direction = wxBOTH);
virtual bool IsModal() const { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); }
virtual int ShowModal();
@@ -87,9 +81,17 @@ public:
void OnApply(wxCommandEvent& event);
void OnCancel(wxCommandEvent& event);
void OnSize(wxSizeEvent& event) ;
// Responds to colour changes
void OnSysColourChanged(wxSysColourChangedEvent& event);
// splits text up at newlines and places the
// lines into a vertical wxBoxSizer
wxSizer *CreateTextSizer( const wxString &message );
// places buttons into a horizontal wxBoxSizer
wxSizer *CreateButtonSizer( long flags );
DECLARE_EVENT_TABLE()
};

View File

@@ -155,7 +155,7 @@ class WXDLLEXPORT wxDropTarget: public wxObject
// protected:
friend wxWindow;
friend class wxWindow;
// Override these to indicate what kind of data you support:

View File

@@ -1,88 +1,105 @@
/////////////////////////////////////////////////////////////////////////////
// Name: font.h
// Purpose: wxFont class
// Author: AUTHOR
// Author: Julian Smart
// Modified by:
// Created: ??/??/98
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) AUTHOR
// Licence: wxWindows licence
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FONT_H_
#define _WX_FONT_H_
#ifdef __GNUG__
#pragma interface "font.h"
#pragma interface "font.h"
#endif
#include "wx/gdiobj.h"
// ----------------------------------------------------------------------------
// public functions
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxFont;
// convert wxFontEncoding into one of Windows XXX_CHARSET constants (fill exact
// parameter if it's not NULL with TRUE if encoding is realyl supported under
// Windows and FALSE if not and we just chose something close to it)
extern int wxCharsetFromEncoding(wxFontEncoding encoding, bool *exact = NULL);
class WXDLLEXPORT wxFontRefData: public wxGDIRefData
// ----------------------------------------------------------------------------
// wxFont
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxFont : public wxFontBase
{
friend class WXDLLEXPORT wxFont;
public:
wxFontRefData();
wxFontRefData(const wxFontRefData& data);
~wxFontRefData();
// ctors and such
wxFont() { Init(); }
wxFont(const wxFont& font) { Init(); Ref(font); }
wxFont(int size,
int family,
int style,
int weight,
bool underlined = FALSE,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
Init();
(void)Create(size, family, style, weight, underlined, face, encoding);
}
bool Create(int size,
int family,
int style,
int weight,
bool underlined = FALSE,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
virtual ~wxFont();
// assignment
wxFont& operator=(const wxFont& font);
// implement base class pure virtuals
virtual int GetPointSize() const;
virtual int GetFamily() const;
virtual int GetStyle() const;
virtual int GetWeight() const;
virtual bool GetUnderlined() const;
virtual wxString GetFaceName() const;
virtual wxFontEncoding GetEncoding() const;
virtual void SetPointSize(int pointSize);
virtual void SetFamily(int family);
virtual void SetStyle(int style);
virtual void SetWeight(int weight);
virtual void SetFaceName(const wxString& faceName);
virtual void SetUnderlined(bool underlined);
virtual void SetEncoding(wxFontEncoding encoding);
// implementation only from now on
// -------------------------------
int GetFontId() const;
virtual bool IsFree() const;
virtual bool RealizeResource();
virtual WXHANDLE GetResourceHandle();
virtual bool FreeResource(bool force = FALSE);
/*
virtual bool UseResource();
virtual bool ReleaseResource();
*/
protected:
int m_pointSize;
int m_family;
int m_style;
int m_weight;
bool m_underlined;
wxString m_faceName;
/* TODO: implementation
WXHFONT m_hFont;
*/
};
// common part of all ctors
void Init();
#define M_FONTDATA ((wxFontRefData *)m_refData)
void Unshare();
WXDLLEXPORT_DATA(extern const char*) wxEmptyString;
// Font
class WXDLLEXPORT wxFont: public wxGDIObject
{
DECLARE_DYNAMIC_CLASS(wxFont)
public:
wxFont();
wxFont(int pointSize, int family, int style, int weight, bool underlined = FALSE, const wxString& faceName = wxEmptyString);
inline wxFont(const wxFont& font) { Ref(font); }
~wxFont();
bool Create(int pointSize, int family, int style, int weight, bool underlined = FALSE, const wxString& faceName = wxEmptyString);
virtual bool Ok() const { return (m_refData != NULL) ; }
inline int GetPointSize() const { return M_FONTDATA->m_pointSize; }
inline int GetFamily() const { return M_FONTDATA->m_family; }
inline int GetStyle() const { return M_FONTDATA->m_style; }
inline int GetWeight() const { return M_FONTDATA->m_weight; }
wxString GetFamilyString() const ;
wxString GetFaceName() const ;
wxString GetStyleString() const ;
wxString GetWeightString() const ;
inline bool GetUnderlined() const { return M_FONTDATA->m_underlined; }
void SetPointSize(int pointSize);
void SetFamily(int family);
void SetStyle(int style);
void SetWeight(int weight);
void SetFaceName(const wxString& faceName);
void SetUnderlined(bool underlined);
inline wxFont& operator = (const wxFont& font) { if (*this == font) return (*this); Ref(font); return *this; }
inline bool operator == (const wxFont& font) { return m_refData == font.m_refData; }
inline bool operator != (const wxFont& font) { return m_refData != font.m_refData; }
// Implementation
protected:
bool RealizeResource();
void Unshare();
private:
DECLARE_DYNAMIC_CLASS(wxFont)
};
#endif

View File

@@ -19,12 +19,14 @@
#include "wx/window.h"
#include "wx/toolbar.h"
#include "wx/accel.h"
#include "wx/icon.h"
WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr;
WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr;
class WXDLLEXPORT wxMenuBar;
class WXDLLEXPORT wxStatusBar;
class WXDLLEXPORT wxMacToolTip ;
class WXDLLEXPORT wxFrame: public wxWindow {
@@ -54,14 +56,6 @@ public:
const wxString& name = wxFrameNameStr);
virtual bool Destroy();
void SetClientSize(int width, int height);
void GetClientSize(int *width, int *height) const;
void GetSize(int *width, int *height) const ;
void GetPosition(int *x, int *y) const ;
void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
void ClientToScreen(int *x, int *y) const;
void ScreenToClient(int *x, int *y) const;
void OnSize(wxSizeEvent& event);
void OnMenuHighlight(wxMenuEvent& event);
@@ -69,18 +63,10 @@ public:
void OnIdle(wxIdleEvent& event);
void OnCloseWindow(wxCloseEvent& event);
bool Show(bool show);
// Set menu bar
void SetMenuBar(wxMenuBar *menu_bar);
virtual wxMenuBar *GetMenuBar() const ;
// Set title
void SetTitle(const wxString& title);
wxString GetTitle() const ;
void Centre(int direction = wxBOTH);
// Call this to simulate a menu command
virtual void Command(int id);
virtual void ProcessCommand(int id);
@@ -96,6 +82,8 @@ public:
virtual wxStatusBar *OnCreateStatusBar(int number, long style, wxWindowID id,
const wxString& name);
#if wxUSE_TOOLBAR
// Create toolbar
virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1, const wxString& name = wxToolBarNameStr);
virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name);
@@ -104,6 +92,8 @@ public:
virtual inline wxToolBar *GetToolBar() const { return m_frameToolBar; }
virtual void PositionToolBar();
#endif
// Set status line text
virtual void SetStatusText(const wxString& text, int number = 0);
@@ -136,10 +126,18 @@ public:
// Query app for menu item updates (called from OnIdle)
void DoMenuUpdates();
void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin);
void DoMenuUpdates(wxMenu* menu);
// Checks if there is a toolbar, and returns the first free client position
virtual wxPoint GetClientAreaOrigin() const;
virtual void GetClientSize(int *x, int *y) const ;
virtual void DoSetClientSize(int clientwidth, int clientheight) ;
// tooltip management
#if wxUSE_TOOLTIPS
wxMacToolTip* GetToolTipCtrl() const { return m_hwndToolTip; }
void SetToolTipCtrl(wxMacToolTip *tt) { m_hwndToolTip = wxMacToolTip; }
#endif // tooltips
protected:
wxMenuBar * m_frameMenuBar;
@@ -147,7 +145,9 @@ protected:
wxIcon m_icon;
bool m_iconized;
static bool m_useNativeStatusBar;
#if wxUSE_TOOLBAR
wxToolBar * m_frameToolBar ;
#endif
DECLARE_EVENT_TABLE()
};

View File

@@ -56,8 +56,6 @@ class WXDLLEXPORT wxGauge: public wxControl
int GetRange() const ;
int GetValue() const ;
void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
virtual void Command(wxCommandEvent& WXUNUSED(event)) {} ;
protected:

View File

@@ -27,9 +27,7 @@ public:
~wxIconRefData();
public:
/* TODO: whatever your actual icon handle is
WXHICON m_hIcon;
*/
};
#define M_ICONDATA ((wxIconRefData *)m_refData)
@@ -47,33 +45,31 @@ public:
inline wxIcon(const wxIcon& icon) { Ref(icon); }
wxIcon(const char bits[], int width, int height);
wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE,
wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_ICON_RESOURCE,
int desiredWidth = -1, int desiredHeight = -1);
~wxIcon();
bool LoadFile(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE,
int desiredWidth = -1, int desiredHeight = -1);
bool LoadFile(const wxString& name, long flags /* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
int desiredWidth /* = -1 */ , int desiredHeight = -1);
bool LoadFile(const wxString& name ,long flags = wxBITMAP_TYPE_ICON_RESOURCE )
{ return LoadFile( name , flags , -1 , -1 ) ; }
inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; }
inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; }
inline bool operator != (const wxIcon& icon) { return m_refData != icon.m_refData; }
/* TODO: implementation
void SetHICON(WXHICON ico);
inline WXHICON GetHICON() const { return (M_ICONDATA ? M_ICONDATA->m_hIcon : 0); }
*/
/* TODO */
virtual bool Ok() const { return (m_refData != NULL) ; }
};
/* Example handlers. TODO: write your own handlers for relevant types.
class WXDLLEXPORT wxICOFileHandler: public wxBitmapHandler
/*
class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler
{
DECLARE_DYNAMIC_CLASS(wxICOFileHandler)
DECLARE_DYNAMIC_CLASS(wxICONFileHandler)
public:
inline wxICOFileHandler()
inline wxICONFileHandler()
{
m_name = "ICO icon file";
m_extension = "ico";
@@ -83,16 +79,17 @@ public:
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth = -1, int desiredHeight = -1);
};
*/
class WXDLLEXPORT wxICOResourceHandler: public wxBitmapHandler
class WXDLLEXPORT wxICONResourceHandler: public wxBitmapHandler
{
DECLARE_DYNAMIC_CLASS(wxICOResourceHandler)
DECLARE_DYNAMIC_CLASS(wxICONResourceHandler)
public:
inline wxICOResourceHandler()
inline wxICONResourceHandler()
{
m_name = "ICO resource";
m_extension = "ico";
m_type = wxBITMAP_TYPE_ICO_RESOURCE;
m_name = "ICON resource";
m_extension = "";
m_type = wxBITMAP_TYPE_ICON_RESOURCE;
};
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
@@ -100,7 +97,5 @@ public:
};
*/
#endif
// _WX_ICON_H_

View File

@@ -17,6 +17,7 @@
#endif
#include "wx/control.h"
#include "wx/dynarray.h"
WXDLLEXPORT_DATA(extern const char*) wxListBoxNameStr;
@@ -26,6 +27,9 @@ class WXDLLEXPORT wxArrayInt;
WXDLLEXPORT_DATA(extern const char*) wxEmptyString;
// List box item
WX_DEFINE_ARRAY( char * , wxListDataArray ) ;
class WXDLLEXPORT wxListBox: public wxControl
{
DECLARE_DYNAMIC_CLASS(wxListBox)
@@ -73,7 +77,6 @@ class WXDLLEXPORT wxListBox: public wxControl
virtual int GetSelections(wxArrayInt& aSelections) const;
virtual bool Selected(int n) const ;
virtual wxString GetString(int n) const ;
virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
// Set the specified item at the first visible item
// or scroll to max range.
@@ -88,9 +91,33 @@ class WXDLLEXPORT wxListBox: public wxControl
void Command(wxCommandEvent& event);
void MacSetRedraw( bool doDraw ) ;
protected:
int m_noItems;
int m_selected;
void MacDestroy() ;
void MacDelete( int n ) ;
void MacInsert( int n , const char * text) ;
void MacAppend( const char * text) ;
void MacSet( int n , const char *text ) ;
void MacClear() ;
void MacSetSelection( int n , bool select ) ;
int MacGetSelection() const ;
int MacGetSelections(wxArrayInt& aSelections) const ;
bool MacIsSelected( int n ) const ;
void MacScrollTo( int n ) ;
void OnSize( const wxSizeEvent &size ) ;
void MacDoClick() ;
void MacDoDoubleClick() ;
public :
ListHandle m_macList ;
wxArrayString m_stringArray ;
wxListDataArray m_dataArray ;
virtual void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
DECLARE_EVENT_TABLE()
};
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -125,6 +125,7 @@ public:
// MDI operations
virtual void Maximize();
virtual void Maximize( bool ){ Maximize() ; } // this one is inherited from wxFrame
virtual void Restore();
virtual void Activate();
};

View File

@@ -92,6 +92,10 @@ public:
inline wxList& GetItems() const { return (wxList&) m_menuItems; }
void SetInvokingWindow(wxWindow *pWin) { m_pInvokingWindow = pWin; }
wxWindow * GetInvokingWindow() const { return m_pInvokingWindow; }
bool MacMenuSelect(wxEvtHandler* handler, long when , int macMenuId, int macMenuItemNum) ;
public:
wxFunction m_callback;
@@ -101,7 +105,21 @@ public:
wxList m_menuItems;
wxEvtHandler * m_parent;
wxEvtHandler * m_eventHandler;
wxWindow* m_pInvokingWindow;
void* m_clientData;
MenuHandle m_macMenuHandle;
short m_macMenuId;
bool m_macMenuEnabled ;
// void MacSetTitle(const wxString& title);
int MacGetIndexFromId( int id ) ;
int MacGetIndexFromItem( wxMenuItem *pItem ) ;
void MacEnableMenu( bool bDoEnable ) ;
static short s_macNextMenuId ;
protected:
};
// ----------------------------------------------------------------------------
@@ -149,14 +167,17 @@ class WXDLLEXPORT wxMenuBar: public wxEvtHandler
inline int GetMenuCount() const { return m_menuCount; }
inline wxMenu* GetMenu(int i) const { return m_menus[i]; }
void MacInstallMenuBar() ;
void MacMenuSelect(wxEvtHandler* handler, long when , int macMenuId, int macMenuItemNum) ;
public:
wxEvtHandler * m_eventHandler;
int m_menuCount;
wxMenu ** m_menus;
wxString * m_titles;
wxFrame * m_menuBarFrame;
/* TODO: data that represents the actual menubar when created.
*/
static wxMenuBar* s_macInstalledMenuBar ;
};
#endif // _WX_MENU_H_

View File

@@ -29,67 +29,48 @@
#include "wx/ownerdrw.h"
#endif
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// id for a separator line in the menu (invalid for normal item)
#define ID_SEPARATOR (-1)
// ----------------------------------------------------------------------------
// wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxMenuItem: public wxObject
class WXDLLEXPORT wxMenuItem: public wxMenuItemBase
#if wxUSE_OWNER_DRAWN
, public wxOwnerDrawn
#endif
{
DECLARE_DYNAMIC_CLASS(wxMenuItem)
public:
// ctor & dtor
wxMenuItem(wxMenu *pParentMenu = NULL, int id = ID_SEPARATOR,
const wxString& strName = "", const wxString& wxHelp = "",
bool bCheckable = FALSE, wxMenu *pSubMenu = NULL);
virtual ~wxMenuItem();
// ctor & dtor
wxMenuItem(wxMenu *parentMenu = (wxMenu *)NULL,
int id = wxID_SEPARATOR,
const wxString& name = wxEmptyString,
const wxString& help = wxEmptyString,
bool isCheckable = FALSE,
wxMenu *subMenu = (wxMenu *)NULL);
virtual ~wxMenuItem();
// accessors (some more are inherited from wxOwnerDrawn or are below)
bool IsSeparator() const { return m_idItem == ID_SEPARATOR; }
bool IsEnabled() const { return m_bEnabled; }
bool IsChecked() const { return m_bChecked; }
// override base class virtuals
virtual void SetText(const wxString& strName);
virtual wxString GetLabel() const;
virtual void SetCheckable(bool checkable);
int GetId() const { return m_idItem; }
const wxString& GetHelp() const { return m_strHelp; }
wxMenu *GetSubMenu() const { return m_pSubMenu; }
virtual void Enable(bool bDoEnable = TRUE);
virtual void Check(bool bDoCheck = TRUE);
virtual bool IsChecked() const;
// operations
void SetName(const wxString& strName) { m_strName = strName; }
void SetHelp(const wxString& strHelp) { m_strHelp = strHelp; }
#if wxUSE_ACCEL
virtual wxAcceleratorEntry *GetAccel() const;
#endif // wxUSE_ACCEL
void Enable(bool bDoEnable = TRUE);
void Check(bool bDoCheck = TRUE);
// unfortunately needed to resolve ambiguity between
// wxMenuItemBase::IsCheckable() and wxOwnerDrawn::IsCheckable()
bool IsCheckable() const { return wxMenuItemBase::IsCheckable(); }
void DeleteSubMenu();
// the id for a popup menu is really its menu handle (as required by
// ::AppendMenu() API), so this function will return either the id or the
// menu handle depending on what we're
int GetRealId() const;
private:
int m_idItem; // numeric id of the item
wxString m_strHelp; // associated help string
wxMenu *m_pSubMenu, // may be NULL
*m_pParentMenu; // menu this item is contained in
bool m_bEnabled, // enabled or greyed?
m_bChecked; // checked? (only if checkable)
#if wxUSE_OWNER_DRAWN
// wxOwnerDrawn base class already has these variables - nothing to do
#else //!owner drawn
bool m_bCheckable; // can be checked?
wxString m_strName; // name or label of the item
public:
const wxString& GetName() const { return m_strName; }
bool IsCheckable() const { return m_bCheckable; }
#endif //owner drawn
DECLARE_DYNAMIC_CLASS(wxMenuItem)
};
#endif //_MENUITEM_H

View File

@@ -15,73 +15,91 @@
#ifndef _WX_METAFIILE_H_
#define _WX_METAFIILE_H_
#ifdef __GNUG__
#pragma interface "metafile.h"
#if wxUSE_METAFILE
#include "wx/dc.h"
#include "wx/gdiobj.h"
#if wxUSE_DRAG_AND_DROP
#include "wx/dataobj.h" wx/defs.h
#endif
#include "wx/setup.h"
/*
* Metafile and metafile device context classes - work in Windows 3.1 only
* Metafile and metafile device context classes
*
*/
class WXDLLEXPORT wxDC;
class WXDLLEXPORT wxMetaFile: public wxObject
#define wxMetaFile wxMetafile
#define wxMetaFileDC wxMetafileDC
class WXDLLEXPORT wxMetafile;
class WXDLLEXPORT wxMetafileRefData: public wxGDIRefData
{
DECLARE_DYNAMIC_CLASS(wxMetaFile)
friend class WXDLLEXPORT wxMetafile;
public:
wxMetafileRefData(void);
~wxMetafileRefData(void);
public:
PicHandle m_metafile;
};
#define M_METAFILEDATA ((wxMetafileRefData *)m_refData)
class WXDLLEXPORT wxMetafile: public wxGDIObject
{
DECLARE_DYNAMIC_CLASS(wxMetafile)
public:
wxMetaFile(const wxString& file = "");
~wxMetaFile();
// Copy constructor
inline wxMetafile(const wxMetafile& metafile)
{ Ref(metafile); }
wxMetafile(const wxString& file = "");
~wxMetafile(void);
// After this is called, the metafile cannot be used for anything
// since it is now owned by the clipboard.
virtual bool SetClipboard(int width = 0, int height = 0);
virtual bool Play(wxDC *dc);
// TODO
inline bool Ok() { return FALSE; };
inline bool Ok(void) const { return (M_METAFILEDATA && (M_METAFILEDATA->m_metafile != 0)); };
/* TODO: Implementation
inline WXHANDLE GetHMETAFILE() { return m_metaFile; }
inline void SetHMETAFILE(WXHANDLE mf) { m_metaFile = mf; }
// Implementation
inline PicHandle GetHMETAFILE(void) { return M_METAFILEDATA->m_metafile; }
void SetHMETAFILE(PicHandle mf) ;
// Operators
inline wxMetafile& operator = (const wxMetafile& metafile) { if (*this == metafile) return (*this); Ref(metafile); return *this; }
inline bool operator == (const wxMetafile& metafile) { return m_refData == metafile.m_refData; }
inline bool operator != (const wxMetafile& metafile) { return m_refData != metafile.m_refData; }
protected:
WXHANDLE m_metaFile;
*/
};
class WXDLLEXPORT wxMetaFileDC: public wxDC
class WXDLLEXPORT wxMetafileDC: public wxDC
{
DECLARE_DYNAMIC_CLASS(wxMetaFileDC)
DECLARE_DYNAMIC_CLASS(wxMetafileDC)
public:
// Don't supply origin and extent
// Supply them to wxMakeMetaFilePlaceable instead.
wxMetaFileDC(const wxString& file = "");
wxMetafileDC(const wxString& file = "");
// Supply origin and extent (recommended).
// Then don't need to supply them to wxMakeMetaFilePlaceable.
wxMetaFileDC(const wxString& file, int xext, int yext, int xorg, int yorg);
wxMetafileDC(const wxString& file, int xext, int yext, int xorg, int yorg);
~wxMetaFileDC();
~wxMetafileDC(void);
// Should be called at end of drawing
virtual wxMetaFile *Close();
virtual void SetMapMode(int mode);
virtual void GetTextExtent(const wxString& string, float *x, float *y,
float *descent = NULL, float *externalLeading = NULL,
wxFont *theFont = NULL, bool use16bit = FALSE);
virtual wxMetafile *Close(void);
// Implementation
inline wxMetaFile *GetMetaFile() { return m_metaFile; }
inline void SetMetaFile(wxMetaFile *mf) { m_metaFile = mf; }
inline int GetWindowsMappingMode() { return m_windowsMappingMode; }
inline void SetWindowsMappingMode(int mm) { m_windowsMappingMode = mm; }
inline wxMetafile *GetMetaFile(void) const { return m_metaFile; }
inline void SetMetaFile(wxMetafile *mf) { m_metaFile = mf; }
protected:
int m_windowsMappingMode;
wxMetaFile *m_metaFile;
wxMetafile* m_metaFile;
};
/*
@@ -92,10 +110,57 @@ protected:
*/
// No origin or extent
bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, float scale = 1.0);
#define wxMakeMetaFilePlaceable wxMakeMetafilePlaceable
bool WXDLLEXPORT wxMakeMetafilePlaceable(const wxString& filename, float scale = 1.0);
// Optional origin and extent
bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale = 1.0, bool useOriginAndExtent = TRUE);
// ----------------------------------------------------------------------------
// wxMetafileDataObject is a specialization of wxDataObject for metafile data
// ----------------------------------------------------------------------------
// TODO: implement OLE side of things. At present, it's just for clipboard
// use.
#if wxUSE_DRAG_AND_DROP
class WXDLLEXPORT wxMetafileDataObject : public wxDataObject
{
public:
// ctors
wxMetafileDataObject() { m_width = 0; m_height = 0; };
wxMetafileDataObject(const wxMetafile& metafile, int width = 0, int height = 0):
m_metafile(metafile), m_width(width), m_height(height) { }
void SetMetafile(const wxMetafile& metafile, int w = 0, int h = 0)
{ m_metafile = metafile; m_width = w; m_height = h; }
wxMetafile GetMetafile() const { return m_metafile; }
int GetWidth() const { return m_width; }
int GetHeight() const { return m_height; }
virtual wxDataFormat GetFormat() const { return wxDF_METAFILE; }
/* ??
// implement base class pure virtuals
virtual wxDataFormat GetPreferredFormat() const
{ return (wxDataFormat) wxDataObject::Text; }
virtual bool IsSupportedFormat(wxDataFormat format) const
{ return format == wxDataObject::Text || format == wxDataObject::Locale; }
virtual size_t GetDataSize() const
{ return m_strText.Len() + 1; } // +1 for trailing '\0'of course
virtual void GetDataHere(void *pBuf) const
{ memcpy(pBuf, m_strText.c_str(), GetDataSize()); }
*/
private:
wxMetafile m_metafile;
int m_width;
int m_height;
};
#endif
#endif // wxUSE_METAFILE
#endif
// _WX_METAFIILE_H_

View File

@@ -165,6 +165,7 @@ public:
virtual bool DoPhase(int nPhase);
protected:
virtual void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
// common part of all ctors
void Init();

View File

@@ -26,10 +26,9 @@ class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData
public:
wxPaletteRefData();
~wxPaletteRefData();
/* TODO: implementation
protected:
WXHPALETTE m_hPalette;
*/
wxColour* m_palette;
wxInt32 m_count ;
};
#define M_PALETTEDATA ((wxPaletteRefData *)m_refData)

View File

@@ -25,63 +25,88 @@ class WXDLLEXPORT wxBitmap ;
class WXDLLEXPORT wxRadioBox: public wxControl
{
DECLARE_DYNAMIC_CLASS(wxRadioBox)
DECLARE_DYNAMIC_CLASS(wxRadioBox)
public:
wxRadioBox();
wxRadioBox();
inline wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL,
int majorDim = 0, long style = wxRA_HORIZONTAL,
const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr)
{
Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name);
}
wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL,
int majorDim = 0, long style = wxRA_HORIZONTAL,
const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr)
{
Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name);
}
~wxRadioBox();
~wxRadioBox();
bool Create(wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL,
int majorDim = 0, long style = wxRA_HORIZONTAL,
const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr);
bool Create(wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL,
int majorDim = 0, long style = wxRA_HORIZONTAL,
const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr);
int FindString(const wxString& s) const;
void SetSelection(int N);
int GetSelection() const;
wxString GetString(int N) const;
void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
void GetSize(int *x, int *y) const;
void GetPosition(int *x, int *y) const;
wxString GetLabel() const;
void SetLabel(const wxString& label);
void SetLabel(int item, const wxString& label) ;
wxString GetLabel(int item) const;
bool Show(bool show);
void SetFocus();
void Enable(bool enable);
void Enable(int item, bool enable);
void Show(int item, bool show) ;
inline void SetLabelFont(const wxFont& WXUNUSED(font)) {};
inline void SetButtonFont(const wxFont& font) { SetFont(font); }
int FindString(const wxString& s) const;
void SetSelection(int N);
int GetSelection() const;
wxString GetString(int N) const;
virtual wxString GetStringSelection() const;
virtual bool SetStringSelection(const wxString& s);
inline virtual int Number() const { return m_noItems; } ;
void Command(wxCommandEvent& event);
inline int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
void GetSize(int *x, int *y) const;
void GetPosition(int *x, int *y) const;
void SetLabel(int item, const wxString& label);
void SetLabel(int item, wxBitmap *bitmap);
wxString GetLabel(int item) const;
bool Show(bool show);
void SetFocus();
bool Enable(bool enable);
void Enable(int item, bool enable);
void Show(int item, bool show);
void SetLabelFont(const wxFont& WXUNUSED(font)) {};
void SetButtonFont(const wxFont& font) { SetFont(font); }
virtual wxString GetStringSelection() const;
virtual bool SetStringSelection(const wxString& s);
virtual int Number() const { return m_noItems; };
void Command(wxCommandEvent& event);
int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
// implementation only from now on
// -------------------------------
WXHWND *GetRadioButtons() const { return m_radioButtons; }
bool ContainsHWND(WXHWND hWnd) const;
void SendNotificationEvent();
// get the number of buttons per column/row
int GetNumVer() const;
int GetNumHor() const;
#if WXWIN_COMPATIBILITY
wxRadioBox(wxWindow *parent, wxFunction func, const char *title,
int x = -1, int y = -1, int width = -1, int height = -1,
int n = 0, char **choices = NULL,
int majorDim = 0, long style = wxRA_HORIZONTAL, const char *name = wxRadioBoxNameStr);
#endif // WXWIN_COMPATIBILITY
protected:
/* TODO: implementation
WXHWND * m_radioButtons;
*/
int m_majorDim ;
int m_noItems;
int m_noRowsOrCols;
int m_selectedButton;
void SubclassRadioButton(WXHWND hWndBtn);
WXHWND * m_radioButtons;
int m_majorDim;
int * m_radioWidth; // for bitmaps
int * m_radioHeight;
int m_noItems;
int m_noRowsOrCols;
int m_selectedButton;
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO);
};
#endif

View File

@@ -43,6 +43,7 @@ public:
wxRegion(long x, long y, long w, long h);
wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
wxRegion(const wxRect& rect);
wxRegion( WXHRGN hRegion );
wxRegion();
~wxRegion();
@@ -100,6 +101,7 @@ public:
bool Combine(long x, long y, long width, long height, wxRegionOp op);
bool Combine(const wxRegion& region, wxRegionOp op);
bool Combine(const wxRect& rect, wxRegionOp op);
const WXHRGN GetWXHRGN() const ;
};
class WXDLLEXPORT wxRegionIterator : public wxObject {
@@ -125,7 +127,6 @@ public:
long GetH() const;
long GetHeight() const { return GetH(); }
wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); }
private:
long m_current;
long m_numRects;

View File

@@ -55,6 +55,7 @@ public:
bool refresh = TRUE);
void Command(wxCommandEvent& event);
virtual void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
protected:
int m_pageSize;

View File

@@ -16,6 +16,19 @@
* General features
*
*/
#define wxUSE_BUSYINFO 1
#define WORDS_BIGENDIAN 1
#define wxUSE_LIBPNG 1
// Use PNG bitmap code
#define wxUSE_LIBJPEG 1
// Use JPEG bitmap code
#define wxUSE_STREAMS 1
#define wxUSE_ZLIB 1
#define wxUSE_ZIPSTREAM 1
#define wxUSE_SOCKETS 1
#define wxUSE_CONSTRAINTS 1
// Use constraints mechanism
@@ -24,7 +37,7 @@
#define _WX_GOODCOMPILER__
// gcc can have problems, but Windows compilers
// are generally OK.
#define WXWIN_COMPATIBILITY 1
#define WXWIN_COMPATIBILITY 0
// Compatibility with 1.66 API.
// Level 0: no backward compatibility, all new features
// Level 1: wxDC, OnSize (etc.) compatibility, but
@@ -36,7 +49,7 @@
// 0 for no PostScript device context
#define wxUSE_AFM_FOR_POSTSCRIPT 0
// 1 to use font metric files in GetTextExtent
#define wxUSE_METAFILE 0
#define wxUSE_METAFILE 1
// 0 for no Metafile and metafile device context
#define wxUSE_FORM 0
// 0 for no wxForm
@@ -44,9 +57,9 @@
// 0 for no interprocess comms
#define wxUSE_HELP 0
// 0 for no help facility
#define wxUSE_RESOURCES 0
#define wxUSE_RESOURCES 1
// 0 for no wxGetResource/wxWriteResource
#define wxUSE_CLIPBOARD 0
#define wxUSE_CLIPBOARD 1
// 0 for no clipboard functions
#define wxUSE_SPLINES 0
// 0 for no splines
@@ -55,17 +68,17 @@
// AIAI spline code is slower, but freer of copyright issues.
// 0 for no splines
#define wxUSE_TOOLBAR 0
#define wxUSE_TOOLBAR 1
// Use toolbars
#define wxUSE_DRAG_AND_DROP 0
// 0 for no drag and drop
#define wxUSE_WX_RESOURCES 0
#define wxUSE_WX_RESOURCES 1
// Use .wxr resource mechanism (requires PrologIO library)
#define wxUSE_DOC_VIEW_ARCHITECTURE 1
// Set to 0 to disable document/view architecture
#define wxUSE_PRINTING_ARCHITECTURE 0
#define wxUSE_PRINTING_ARCHITECTURE 1
// Set to 0 to disable print/preview architecture code
#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 0
// Set to 0 to disable PostScript print/preview architecture code
@@ -111,6 +124,18 @@
// but you can't mix them. Set to 1 for <iostream.h>,
// 0 for <iostream>
#define wxUSE_ZIPSTREAM 1
#define wxUSE_FS_ZIP 1
#define wxUSE_FS_INET 1
#define wxUSE_STREAMS 1
// If enabled (1), compiles wxWindows streams classes
#define wxUSE_STD_IOSTREAM 1
// Use standard C++ streams if 1. If 0, use wxWin
// streams implementation.
#define wxUSE_WXCONFIG 0
// if enabled, compiles built-in OS independent wxConfig
// class and it's file (any platform) and registry (Win)
@@ -125,5 +150,43 @@
// will be used to write, in a portable way,
// float on the disk
// use wxFile class - required by i18n code, wxConfig and others - recommended
#define wxUSE_FILE 1
// use wxTextFile class: requires wxFile, required by wxConfig
#define wxUSE_TEXTFILE 1
// i18n support: _() macro, wxLocale class. Requires wxFile
#define wxUSE_INTL 1
// wxLogXXX functions - highly recommended
#define wxUSE_LOG 1
// wxValidator class
#define wxUSE_VALIDATORS 1
// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar)
#define wxUSE_ACCEL 1
// wxSashWindow class
#define wxUSE_SASH 1
// text entry dialog and wxGetTextFromUser function
#define wxUSE_TEXTDLG 1
#define wxUSE_STATLINE 1
// wxToolBar class
#define wxUSE_TOOLBAR 1
// wxStatusBar class
#define wxUSE_STATUSBAR 1
// progress dialog class for lengthy operations
#define wxUSE_PROGRESSDLG 1
// wxDirDlg class for getting a directory name from user
#define wxUSE_DIRDLG 1
#endif
// _WX_SETUP_H_

View File

@@ -51,9 +51,6 @@ public:
virtual int GetValue() const ;
virtual void SetValue(int);
void GetSize(int *x, int *y) const ;
void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
void GetPosition(int *x, int *y) const ;
bool Show(bool show);
void SetRange(int minValue, int maxValue);
@@ -78,7 +75,12 @@ public:
void SetTick(int tickPos) ;
void Command(wxCommandEvent& event);
void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
protected:
wxStaticText* m_macMinimumStatic ;
wxStaticText* m_macMaximumStatic ;
wxStaticText* m_macValueStatic ;
int m_rangeMin;
int m_rangeMax;
int m_pageSize;

View File

@@ -63,10 +63,12 @@ class WXDLLEXPORT wxSpinButton: public wxControl
////////////////////////////////////////////////////////////////////////////
void Command(wxCommandEvent& event) { ProcessCommand(event); };
virtual void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
protected:
int m_min;
int m_max;
int m_value ;
};
class WXDLLEXPORT wxSpinEvent: public wxScrollEvent

View File

@@ -47,7 +47,7 @@ class WXDLLEXPORT wxStaticBitmap: public wxControl
virtual void Command(wxCommandEvent& WXUNUSED(event)) {};
virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {};
virtual void OnPaint( wxPaintEvent &event ) ;
void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
inline wxBitmap& GetBitmap() const { return (wxBitmap&) m_messageBitmap; }
@@ -57,7 +57,7 @@ class WXDLLEXPORT wxStaticBitmap: public wxControl
protected:
wxBitmap m_messageBitmap;
DECLARE_EVENT_TABLE()
};
#endif

View File

@@ -47,8 +47,8 @@ class WXDLLEXPORT wxStaticBox: public wxControl
virtual void Command(wxCommandEvent& WXUNUSED(event)) {};
virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {};
void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
void SetLabel(const wxString& label);
protected:
DECLARE_EVENT_TABLE()
};

View File

@@ -44,9 +44,8 @@ class WXDLLEXPORT wxStaticText: public wxControl
const wxString& name = wxStaticTextNameStr);
// accessors
void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
void SetLabel(const wxString&);
void SetLabel(const wxString& , bool resize );
void SetLabel( const wxString &str ) { SetLabel( str , true ) ; }
// operations
virtual void Command(wxCommandEvent& WXUNUSED(event)) {};
virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {};

View File

@@ -19,7 +19,7 @@
#include "wx/generic/statusbr.h"
class WXDLLEXPORT wxStatusBarXX : public wxStatusBar
class WXDLLEXPORT wxStatusBarMac : public wxStatusBar
{
DECLARE_DYNAMIC_CLASS(wxStatusBarXX);
@@ -51,3 +51,4 @@ protected:
};
#endif
// _WX_STATBAR_H_

View File

@@ -119,11 +119,12 @@ public:
virtual void PositionToXY(long pos, long *x, long *y) const ;
virtual void ShowPosition(long pos);
virtual void Clear();
virtual bool MacCanFocus() const { return true ; }
// callbacks
// ---------
void OnDropFiles(wxDropFilesEvent& event);
// void OnChar(wxKeyEvent& event); // Process 'enter' if required
void OnChar(wxKeyEvent& event); // Process 'enter' if required
// void OnEraseBackground(wxEraseEvent& event);
// Implementation

View File

@@ -45,9 +45,5 @@ private:
DECLARE_ABSTRACT_CLASS(wxTimer)
};
/* Note: these are implemented in common/timercmn.cpp, so need to implement them separately.
* But you may need to modify timercmn.cpp.
*/
#endif
// _WX_TIMER_H_

View File

@@ -16,7 +16,10 @@
#pragma interface "toolbar.h"
#endif
#if wxUSE_TOOLBAR
#include "wx/tbarbase.h"
#include "wx/dynarray.h"
WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr;
@@ -62,16 +65,19 @@ class WXDLLEXPORT wxToolBar: public wxToolBarBase
// Add all the buttons
virtual bool CreateTools();
virtual void Layout() {}
virtual void LayoutButtons() {}
// The post-tool-addition call. TODO: do here whatever's
// necessary for completing the toolbar construction.
bool Realize() { return CreateTools(); };
virtual void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
protected:
wxArrayPtrVoid m_macToolHandles ;
DECLARE_EVENT_TABLE()
};
#endif // wxUSE_TOOLBAR
#endif
// _WX_TOOLBAR_H_

View File

@@ -16,577 +16,331 @@
#pragma interface "window.h"
#endif
#include "wx/gdicmn.h"
#include "wx/icon.h"
#include "wx/cursor.h"
#include "wx/pen.h"
#include "wx/font.h"
#include "wx/validate.h"
#include "wx/event.h"
#include "wx/string.h"
#include "wx/list.h"
#include "wx/region.h"
#include "wx/accel.h"
// ---------------------------------------------------------------------------
// forward declarations
// ---------------------------------------------------------------------------
#define wxKEY_SHIFT 1
#define wxKEY_CTRL 2
/*
* Base class for frame, panel, canvas, panel items, dialog box.
*
*/
/*
* Event handler: windows have themselves as their event handlers
* by default, but their event handlers could be set to another
* object entirely. This separation can reduce the amount of
* derivation required, and allow alteration of a window's functionality
* (e.g. by a resource editor that temporarily switches event handlers).
*/
class WXDLLEXPORT wxWindow;
class WXDLLEXPORT wxEvent;
class WXDLLEXPORT wxCommandEvent;
class WXDLLEXPORT wxKeyEvent;
class WXDLLEXPORT wxControl;
class WXDLLEXPORT wxCursor;
class WXDLLEXPORT wxColourMap;
class WXDLLEXPORT wxFont;
class WXDLLEXPORT wxMenu;
class WXDLLEXPORT wxRect;
class WXDLLEXPORT wxBitmap;
class WXDLLEXPORT wxSizer;
class WXDLLEXPORT wxList;
class WXDLLEXPORT wxLayoutConstraints;
class WXDLLEXPORT wxMouseEvent;
class WXDLLEXPORT wxButton;
class WXDLLEXPORT wxColour;
class WXDLLEXPORT wxBrush;
class WXDLLEXPORT wxPen;
class WXDLLEXPORT wxIcon;
class WXDLLEXPORT wxDC;
class WXDLLEXPORT wxValidator;
#if wxUSE_DRAG_AND_DROP
class WXDLLEXPORT wxDropTarget;
#endif
// ---------------------------------------------------------------------------
// constants
// ---------------------------------------------------------------------------
#if wxUSE_WX_RESOURCES
class WXDLLEXPORT wxResourceTable;
class WXDLLEXPORT wxItemResource;
#endif
WXDLLEXPORT_DATA(extern const char*) wxPanelNameStr;
WXDLLEXPORT_DATA(extern const wxSize) wxDefaultSize;
WXDLLEXPORT_DATA(extern const wxPoint) wxDefaultPosition;
//-----------------------------------------------------------------------------
// wxClientData
//-----------------------------------------------------------------------------
class wxClientData
// FIXME does anybody use those? they're unused by wxWindows...
enum
{
public:
wxClientData() { }
virtual ~wxClientData() { }
wxKEY_SHIFT = 1,
wxKEY_CTRL = 2
};
//-----------------------------------------------------------------------------
// wxStringClientData
//-----------------------------------------------------------------------------
class wxStringClientData: public wxClientData
class WXDLLEXPORT wxWindow: public wxWindowBase
{
public:
wxStringClientData() { }
wxStringClientData( wxString &data ) { m_data = data; }
void SetData( wxString &data ) { m_data = data; }
wxString GetData() const { return m_data; }
private:
wxString m_data;
};
class WXDLLEXPORT wxWindow: public wxEvtHandler
{
DECLARE_ABSTRACT_CLASS(wxWindow)
DECLARE_DYNAMIC_CLASS(wxWindow);
friend class wxDC;
friend class wxPaintDC;
public:
wxWindow();
inline wxWindow(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr)
{
m_children = new wxList;
Create(parent, id, pos, size, style, name);
}
typedef struct MacWindowData
{
SInt16 m_macWindowBackgroundTheme ;
WindowRef m_macWindow ;
ControlHandle m_macRootControl ;
wxWindow* m_macFocus ;
} MacWindowData ;
wxWindow() { Init(); }
virtual ~wxWindow();
wxWindow(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr)
{
Init();
Create(parent, id, pos, size, style, name);
}
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr);
virtual ~wxWindow();
// Fit the window around the items
virtual void Fit();
bool Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr);
// Show or hide the window
virtual bool Show(bool show);
// Is the window shown?
virtual bool IsShown() const;
// implement base class pure virtuals
virtual void SetTitle( const wxString& title);
virtual wxString GetTitle() const;
// Raise the window to the top of the Z order
virtual void Raise();
virtual void Raise();
virtual void Lower();
// Lower the window to the bottom of the Z order
virtual void Lower();
virtual bool Show( bool show = TRUE );
virtual bool Enable( bool enable = TRUE );
// Is the window enabled?
virtual bool IsEnabled() const;
virtual void SetFocus();
// For compatibility
inline bool Enabled() const { return IsEnabled(); }
virtual bool Reparent( wxWindow *newParent );
// Dialog support: override these and call
// base class members to add functionality
// that can't be done using validators.
virtual void WarpPointer(int x, int y);
virtual void CaptureMouse();
virtual void ReleaseMouse();
// Transfer values to controls. If returns FALSE,
// it's an application error (pops up a dialog)
virtual bool TransferDataToWindow();
virtual void Refresh( bool eraseBackground = TRUE,
const wxRect *rect = (const wxRect *) NULL );
virtual void Clear();
// Transfer values from controls. If returns FALSE,
// transfer failed: don't quit
virtual bool TransferDataFromWindow();
virtual bool SetCursor( const wxCursor &cursor );
virtual bool SetFont( const wxFont &font );
// Validate controls. If returns FALSE,
// validation failed: don't quit
virtual bool Validate();
virtual int GetCharHeight() const;
virtual int GetCharWidth() const;
virtual void GetTextExtent(const wxString& string,
int *x, int *y,
int *descent = (int *) NULL,
int *externalLeading = (int *) NULL,
const wxFont *theFont = (const wxFont *) NULL)
const;
// Return code for dialogs
inline void SetReturnCode(int retCode);
inline int GetReturnCode();
virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
// Set the cursor
virtual void SetCursor(const wxCursor& cursor);
inline virtual wxCursor *GetCursor() const { return (wxCursor *)& m_windowCursor; };
// Get the window with the focus
static wxWindow *FindFocus();
// Get character size
virtual int GetCharHeight() const;
virtual int GetCharWidth() const;
// Get overall window size
virtual void GetSize(int *width, int *height) const;
wxSize GetSize() const { int w, h; GetSize(& w, & h); return wxSize(w, h); }
// Get window position, relative to parent (or screen if no parent)
virtual void GetPosition(int *x, int *y) const;
wxPoint GetPosition() const
{ int x, y; GetPosition(&x, &y); return wxPoint(x, y); }
// Get size and position
wxRect GetRect() const
{ int x, y, w, h; GetPosition(& x, & y); GetSize(& w, & h); return wxRect(x, y, w, h); }
// Get client (application-useable) size
virtual void GetClientSize(int *width, int *height) const;
wxSize GetClientSize() const { int w, h; GetClientSize(& w, & h); return wxSize(w, h); }
// Set overall size and position
virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO)
{ SetSize(rect.x, rect.y, rect.width, rect.height, sizeFlags); }
// set size only
void SetSize(int width, int height)
{ SetSize(-1, -1, width, height, wxSIZE_USE_EXISTING); }
void SetSize(const wxSize& size)
{ SetSize(-1, -1, size.x, size.y, wxSIZE_USE_EXISTING); }
// set position only
virtual void Move(int x, int y) { SetSize(x, y, -1, -1, wxSIZE_USE_EXISTING); }
void Move(const wxPoint& pt) { SetSize(pt.x, pt.y, -1, -1, wxSIZE_USE_EXISTING); }
// Set client size
virtual void SetClientSize(int width, int height);
void SetClientSize(const wxSize& sz) { SetClientSize(sz.x, sz.y); }
// Convert client to screen coordinates
virtual void ClientToScreen(int *x, int *y) const;
wxPoint ClientToScreen(const wxPoint& pt) const
{ int x = pt.x; int y = pt.y; ClientToScreen(& x, & y); return wxPoint(x, y); }
// Convert screen to client coordinates
virtual void ScreenToClient(int *x, int *y) const;
wxPoint ScreenToClient(const wxPoint& pt) const
{ int x = pt.x; int y = pt.y; ScreenToClient(& x, & y); return wxPoint(x, y); }
// Set the focus to this window
virtual void SetFocus();
// Capture/release mouse
virtual void CaptureMouse();
virtual void ReleaseMouse();
// Enable or disable the window
virtual void Enable(bool enable);
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
int range, bool refresh = TRUE );
virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE );
virtual int GetScrollPos( int orient ) const;
virtual int GetScrollThumb( int orient ) const;
virtual int GetScrollRange( int orient ) const;
virtual void ScrollWindow( int dx, int dy,
const wxRect* rect = (wxRect *) NULL );
#if wxUSE_DRAG_AND_DROP
// Associate a drop target with this window (if the window already had a drop
// target, it's deleted!) and return the current drop target (may be NULL).
void SetDropTarget(wxDropTarget *pDropTarget);
wxDropTarget *GetDropTarget() const { return m_pDropTarget; }
#endif
virtual void SetDropTarget( wxDropTarget *dropTarget );
#endif // wxUSE_DRAG_AND_DROP
// Accept files for dragging
virtual void DragAcceptFiles(bool accept);
// Accept files for dragging
virtual void DragAcceptFiles(bool accept);
// Update region access
virtual wxRegion GetUpdateRegion() const;
virtual bool IsExposed(int x, int y, int w, int h) const;
virtual bool IsExposed(const wxPoint& pt) const;
virtual bool IsExposed(const wxRect& rect) const;
#if WXWIN_COMPATIBILITY
// Set/get scroll attributes
virtual void SetScrollRange(int orient, int range, bool refresh = TRUE);
virtual void SetScrollPage(int orient, int page, bool refresh = TRUE);
virtual int OldGetScrollRange(int orient) const;
virtual int GetScrollPage(int orient) const;
// Set/get the window title
virtual inline void SetTitle(const wxString& WXUNUSED(title)) {};
inline virtual wxString GetTitle() const { return wxString(""); };
// Most windows have the concept of a label; for frames, this is the
// title; for items, this is the label or button text.
inline virtual wxString GetLabel() const { return GetTitle(); }
// event handlers
// Handle a control command
virtual void OnCommand(wxWindow& win, wxCommandEvent& event);
// Set/get the window name (used for resource setting in X)
inline virtual wxString GetName() const;
inline virtual void SetName(const wxString& name);
// Override to define new behaviour for default action (e.g. double
// clicking on a listbox)
virtual void OnDefaultAction(wxControl * WXUNUSED(initiatingItem)) { }
#endif // WXWIN_COMPATIBILITY
// Centre the window
virtual void Centre(int direction) ;
inline void Center(int direction = wxHORIZONTAL) { Centre(direction); }
#if wxUSE_CARET && WXWIN_COMPATIBILITY
// caret manipulation (old MSW only functions, see wxCaret class for the
// new API)
void CreateCaret(int w, int h);
void CreateCaret(const wxBitmap *bitmap);
void DestroyCaret();
void ShowCaret(bool show);
void SetCaretPos(int x, int y);
void GetCaretPos(int *x, int *y) const;
#endif // wxUSE_CARET
// Popup a menu
virtual bool PopupMenu(wxMenu *menu, int x, int y);
// Native resource loading (implemented in src/msw/nativdlg.cpp)
// FIXME: should they really be all virtual?
virtual bool LoadNativeDialog(wxWindow* parent, wxWindowID& id);
virtual bool LoadNativeDialog(wxWindow* parent, const wxString& name);
wxWindow* GetWindowChild1(wxWindowID id);
wxWindow* GetWindowChild(wxWindowID id);
// Send the window a refresh event
virtual void Refresh(bool eraseBack = TRUE, const wxRect *rect = NULL);
// implementation from now on
// --------------------------
// New functions that will replace the above.
virtual void SetScrollbar(int orient, int pos, int thumbVisible,
int range, bool refresh = TRUE);
void MacClientToRootWindow( int *x , int *y ) const ;
void MacRootWindowToClient( int *x , int *y ) const ;
virtual void SetScrollPos(int orient, int pos, bool refresh = TRUE);
virtual int GetScrollPos(int orient) const;
virtual int GetScrollRange(int orient) const;
virtual int GetScrollThumb(int orient) const;
virtual void ScrollWindow(int dx, int dy, const wxRect *rect = NULL);
// simple accessors
// ----------------
// Caret manipulation
virtual void CreateCaret(int w, int h);
virtual void CreateCaret(const wxBitmap *bitmap);
virtual void DestroyCaret();
virtual void ShowCaret(bool show);
virtual void SetCaretPos(int x, int y);
virtual void GetCaretPos(int *x, int *y) const;
WXHWND GetHWND() const { return m_hWnd; }
void SetHWND(WXHWND hWnd) { m_hWnd = hWnd; }
virtual WXWidget GetHandle() const { return (WXWidget) GetHWND(); }
// Tell window how much it can be sized
virtual void SetSizeHints(int minW = -1, int minH = -1, int maxW = -1, int maxH = -1, int incW = -1, int incH = -1);
// Set/get the window's identifier
inline int GetId() const;
inline void SetId(int id);
virtual void SetAcceleratorTable(const wxAcceleratorTable& accel);
inline virtual wxAcceleratorTable& GetAcceleratorTable() const { return (wxAcceleratorTable&) m_acceleratorTable; }
// Make the window modal (all other windows unresponsive)
virtual void MakeModal(bool modal);
// Get the private handle (platform-dependent)
inline void *GetHandle() const;
// Set/get the window's relatives
inline wxWindow *GetParent() const;
inline void SetParent(wxWindow *p) ;
inline wxWindow *GetGrandParent() const;
inline wxList& GetChildren() const;
// Set/get the window's font
virtual void SetFont(const wxFont& f);
inline virtual wxFont& GetFont() const;
// Set/get the window's validator
void SetValidator(const wxValidator& validator);
inline wxValidator *GetValidator() const;
// Set/get the window's style
inline void SetWindowStyleFlag(long flag);
inline long GetWindowStyleFlag() const;
// Handle a control command
virtual void OnCommand(wxWindow& win, wxCommandEvent& event);
// Set/get event handler
inline void SetEventHandler(wxEvtHandler *handler);
inline wxEvtHandler *GetEventHandler() const;
// Push/pop event handler (i.e. allow a chain of event handlers
// be searched)
void PushEventHandler(wxEvtHandler *handler) ;
wxEvtHandler *PopEventHandler(bool deleteHandler = FALSE) ;
// Close the window by calling OnClose, posting a deletion
virtual bool Close(bool force = FALSE);
// Destroy the window (delayed, if a managed window)
virtual bool Destroy() ;
// Mode for telling default OnSize members to
// call Layout(), if not using Sizers, just top-down constraints
inline void SetAutoLayout(bool a);
inline bool GetAutoLayout() const;
// Set/get constraints
inline wxLayoutConstraints *GetConstraints() const;
void SetConstraints(wxLayoutConstraints *c);
// Set/get window background colour
inline virtual void SetBackgroundColour(const wxColour& col);
inline virtual wxColour GetBackgroundColour() const;
// Set/get window foreground colour
inline virtual void SetForegroundColour(const wxColour& col);
inline virtual wxColour GetForegroundColour() const;
// Get the default button, if there is one
inline virtual wxButton *GetDefaultItem() const;
inline virtual void SetDefaultItem(wxButton *but);
// Override to define new behaviour for default action (e.g. double clicking
// on a listbox)
virtual void OnDefaultAction(wxControl *initiatingItem);
// Resource loading
#if wxUSE_WX_RESOURCES
virtual bool LoadFromResource(wxWindow *parent, const wxString& resourceName, const wxResourceTable *table = NULL);
virtual wxControl *CreateItem(const wxItemResource* childResource, const wxItemResource* parentResource,
const wxResourceTable *table = (const wxResourceTable *) NULL);
#endif
virtual void GetTextExtent(const wxString& string, int *x, int *y,
int *descent = NULL,
int *externalLeading = NULL,
const wxFont *theFont = NULL, bool use16 = FALSE) const;
// Is the window retained?
inline bool IsRetained() const;
// Warp the pointer the given position
virtual void WarpPointer(int x_pos, int y_pos) ;
// Clear the window
virtual void Clear();
// Find a window by id or name
virtual wxWindow *FindWindow(long id);
virtual wxWindow *FindWindow(const wxString& name);
// Constraint operations
bool Layout();
void SetSizer(wxSizer *sizer); // Adds sizer child to this window
inline wxSizer *GetSizer() const ;
inline wxWindow *GetSizerParent() const ;
inline void SetSizerParent(wxWindow *win);
// Do Update UI processing for controls
void UpdateWindowUI();
void OnEraseBackground(wxEraseEvent& event);
void OnChar(wxKeyEvent& event);
void OnPaint(wxPaintEvent& event);
void OnIdle(wxIdleEvent& event);
// Does this window want to accept keyboard focus?
virtual bool AcceptsFocus() const;
virtual void PrepareDC( wxDC &dc ) {};
bool GetUseCtl3D() const { return m_useCtl3D; }
bool GetTransparentBackground() const { return m_backgroundTransparent; }
void SetTransparent(bool t = TRUE) { m_backgroundTransparent = t; }
// event handlers
// --------------
void OnEraseBackground(wxEraseEvent& event);
void OnIdle(wxIdleEvent& event);
public:
////////////////////////////////////////////////////////////////////////
//// IMPLEMENTATION
// For implementation purposes - sometimes decorations make the client area
// smaller
virtual wxPoint GetClientAreaOrigin() const;
// For implementation purposes - sometimes decorations make the client area
// smaller
virtual wxPoint GetClientAreaOrigin() const;
// Makes an adjustment to the window position (for example, a frame that has
// a toolbar that it manages itself).
virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags);
// Makes an adjustment to the window position (for example, a frame that has
// a toolbar that it manages itself).
virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags);
// Executes the default message
virtual long Default();
wxWindow *FindItem(long id) const;
wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const;
/* TODO: you may need something like this
// Determine whether 3D effects are wanted
virtual WXDWORD Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D);
*/
// Make a Windows extended style from the given wxWindows window style
static WXDWORD MakeExtendedStyle(long style,
bool eliminateBorders = TRUE);
// Determine whether 3D effects are wanted
WXDWORD Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D) const;
virtual void AddChild(wxWindow *child); // Adds reference to the child object
virtual void RemoveChild(wxWindow *child); // Removes reference to child
// (but doesn't delete the child object)
virtual void DestroyChildren(); // Removes and destroys all children
// MSW only: TRUE if this control is part of the main control
virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; };
inline bool IsBeingDeleted() const { return FALSE; } // TODO: Should probably eliminate this
#if WXWIN_COMPATIBILITY
wxObject *GetChild(int number) const;
virtual void MSWDeviceToLogical(float *x, float *y) const;
#endif // WXWIN_COMPATIBILITY
// Constraint implementation
void UnsetConstraints(wxLayoutConstraints *c);
inline wxList *GetConstraintsInvolvedIn() const ;
// Back-pointer to other windows we're involved with, so if we delete
// this window, we must delete any constraints we're involved with.
void AddConstraintReference(wxWindow *otherWin);
void RemoveConstraintReference(wxWindow *otherWin);
void DeleteRelatedConstraints();
// Create an appropriate wxWindow from a HWND
virtual wxWindow* CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd);
virtual void ResetConstraints();
virtual void SetConstraintSizes(bool recurse = TRUE);
virtual bool LayoutPhase1(int *noChanges);
virtual bool LayoutPhase2(int *noChanges);
virtual bool DoPhase(int);
// Transforms from sizer coordinate space to actual
// parent coordinate space
virtual void TransformSizerToActual(int *x, int *y) const ;
// Make sure the window style reflects the HWND style (roughly)
virtual void AdoptAttributesFromHWND();
// Set size with transformation to actual coordinates if nec.
virtual void SizerSetSize(int x, int y, int w, int h);
virtual void SizerMove(int x, int y);
// Setup background and foreground colours correctly
virtual void SetupColours();
// Only set/get the size/position of the constraint (if any)
virtual void SetSizeConstraint(int x, int y, int w, int h);
virtual void MoveConstraint(int x, int y);
virtual void GetSizeConstraint(int *w, int *h) const ;
virtual void GetClientSizeConstraint(int *w, int *h) const ;
virtual void GetPositionConstraint(int *x, int *y) const ;
// Dialog units translations. Implemented in wincmn.cpp.
wxPoint ConvertPixelsToDialog(const wxPoint& pt) ;
wxPoint ConvertDialogToPixels(const wxPoint& pt) ;
inline wxSize ConvertPixelsToDialog(const wxSize& sz)
{ wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); }
inline wxSize ConvertDialogToPixels(const wxSize& sz)
{ wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); }
#if WXWIN_COMPATIBILITY
void SetShowing(bool show) { (void)Show(show); }
bool IsUserEnabled() const { return IsEnabled(); }
#endif // WXWIN_COMPATIBILITY
wxObject *GetChild(int number) const ;
// Responds to colour changes: passes event on to children.
void OnSysColourChanged(wxSysColourChangedEvent& event);
// Generates a new id for controls
static int NewControlId();
// Responds to colour changes: passes event on to children.
void OnSysColourChanged(wxSysColourChangedEvent& event);
// Transfers data to any child controls
void OnInitDialog(wxInitDialogEvent& event);
// Sends an OnInitDialog event, which in turns transfers data to
// to the window via validators.
virtual void InitDialog();
////////////////////////////////////////////////////////////////////////
//// PROTECTED DATA
protected:
int m_windowId;
long m_windowStyle; // Store the window's style
wxEvtHandler * m_windowEventHandler; // Usually is 'this'
wxLayoutConstraints * m_constraints; // Constraints for this window
wxList * m_constraintsInvolvedIn; // List of constraints we're involved in
wxSizer * m_windowSizer; // Window's top-level sizer (if any)
wxWindow * m_sizerParent; // Window's parent sizer (if any)
bool m_autoLayout; // Whether to call Layout() in OnSize
wxWindow * m_windowParent; // Each window always knows its parent
wxValidator * m_windowValidator;
int m_minSizeX;
int m_minSizeY;
int m_maxSizeX;
int m_maxSizeY;
// the window handle
WXHWND m_hWnd;
// Caret data
int m_caretWidth;
int m_caretHeight;
bool m_caretEnabled;
bool m_caretShown;
wxFont m_windowFont; // Window's font
wxCursor m_windowCursor; // Window's cursor
wxString m_windowName; // Window name
// the old window proc (we subclass all windows)
WXFARPROC m_oldWndProc;
wxButton * m_defaultItem;
// additional (MSW specific) flags
bool m_useCtl3D:1; // Using CTL3D for this control
bool m_backgroundTransparent:1;
bool m_mouseInWindow:1;
bool m_doubleClickAllowed:1;
bool m_winCaptured:1;
wxColour m_backgroundColour ;
wxColour m_foregroundColour ;
wxAcceleratorTable m_acceleratorTable;
// the size of one page for scrolling
int m_xThumbSize;
int m_yThumbSize;
#if wxUSE_DRAG_AND_DROP
wxDropTarget *m_pDropTarget; // the current drop target or NULL
#endif //USE_DRAG_AND_DROP
WXHMENU m_hMenu; // Menu, if any
public:
wxRegion m_updateRegion;
wxList * m_children; // Window's children
int m_returnCode;
// the return value of WM_GETDLGCODE handler
long m_lDlgCode;
DECLARE_EVENT_TABLE()
// implement the base class pure virtuals
virtual void DoClientToScreen( int *x, int *y ) const;
virtual void DoScreenToClient( int *x, int *y ) const;
virtual void DoGetPosition( int *x, int *y ) const;
virtual void DoGetSize( int *width, int *height ) const;
virtual void DoGetClientSize( int *width, int *height ) const;
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO);
virtual void DoSetClientSize(int width, int height);
// get the size which best suits the window: e.g., for a static text it
// will be the width and height of the text
virtual wxSize DoGetBestSize();
// move the window to the specified location and resize it: this is called
// from both DoSetSize() and DoSetClientSize() and would usually just call
// ::MoveWindow() except for composite controls which will want to arrange
// themselves inside the given rectangle
virtual void DoMoveWindow(int x, int y, int width, int height);
#if wxUSE_TOOLTIPS
virtual void DoSetToolTip( wxToolTip *tip );
#endif // wxUSE_TOOLTIPS
private:
// common part of all ctors
void Init();
DECLARE_NO_COPY_CLASS(wxWindow);
DECLARE_EVENT_TABLE()
};
////////////////////////////////////////////////////////////////////////
//// INLINES
// associate mac windows with wx counterparts
inline void *wxWindow::GetHandle() const { return (void *)NULL; }
inline int wxWindow::GetId() const { return m_windowId; }
inline void wxWindow::SetId(int id) { m_windowId = id; }
inline wxWindow *wxWindow::GetParent() const { return m_windowParent; }
inline void wxWindow::SetParent(wxWindow *p) { m_windowParent = p; }
inline wxWindow *wxWindow::GetGrandParent() const { return (m_windowParent ? m_windowParent->m_windowParent : (wxWindow*) NULL); }
inline wxList& wxWindow::GetChildren() const { return (wxList&) * m_children; }
inline wxFont& wxWindow::GetFont() const { return (wxFont&) m_windowFont; }
inline wxString wxWindow::GetName() const { return m_windowName; }
inline void wxWindow::SetName(const wxString& name) { m_windowName = name; }
inline long wxWindow::GetWindowStyleFlag() const { return m_windowStyle; }
inline void wxWindow::SetWindowStyleFlag(long flag) { m_windowStyle = flag; }
inline void wxWindow::SetEventHandler(wxEvtHandler *handler) { m_windowEventHandler = handler; }
inline wxEvtHandler *wxWindow::GetEventHandler() const { return m_windowEventHandler; }
inline void wxWindow::SetAutoLayout(bool a) { m_autoLayout = a; }
inline bool wxWindow::GetAutoLayout() const { return m_autoLayout; }
inline wxLayoutConstraints *wxWindow::GetConstraints() const { return m_constraints; }
inline void wxWindow::SetBackgroundColour(const wxColour& col) { m_backgroundColour = col; };
inline wxColour wxWindow::GetBackgroundColour() const { return m_backgroundColour; };
inline void wxWindow::SetForegroundColour(const wxColour& col) { m_foregroundColour = col; };
inline wxColour wxWindow::GetForegroundColour() const { return m_foregroundColour; };
wxWindow* wxFindWinFromMacWindow( WindowRef inWindow ) ;
void wxAssociateWinWithMacWindow(WindowRef inWindow, wxWindow *win) ;
void wxRemoveMacWindowAssociation(wxWindow *win) ;
inline wxButton *wxWindow::GetDefaultItem() const { return m_defaultItem; }
inline void wxWindow::SetDefaultItem(wxButton *but) { m_defaultItem = but; }
inline bool wxWindow::IsRetained() const { return ((m_windowStyle & wxRETAINED) == wxRETAINED); }
class wxMacFocusHelper
{
public :
wxMacFocusHelper( wxWindow * theWindow ) ;
~wxMacFocusHelper() ;
bool Ok() { return m_ok ; }
inline wxList *wxWindow::GetConstraintsInvolvedIn() const { return m_constraintsInvolvedIn; }
inline wxSizer *wxWindow::GetSizer() const { return m_windowSizer; }
inline wxWindow *wxWindow::GetSizerParent() const { return m_sizerParent; }
inline void wxWindow::SetSizerParent(wxWindow *win) { m_sizerParent = win; }
inline wxValidator *wxWindow::GetValidator() const { return m_windowValidator; }
inline void wxWindow::SetReturnCode(int retCode) { m_returnCode = retCode; }
inline int wxWindow::GetReturnCode() { return m_returnCode; }
private :
GrafPtr m_formerPort ;
GrafPtr m_currentPort ;
bool m_ok ;
} ;
// Get the active window.
wxWindow* WXDLLEXPORT wxGetActiveWindow();
class wxMacDrawingHelper
{
public :
wxMacDrawingHelper( wxWindow * theWindow ) ;
~wxMacDrawingHelper() ;
bool Ok() { return m_ok ; }
WXDLLEXPORT_DATA(extern wxList) wxTopLevelWindows;
private :
GrafPtr m_formerPort ;
GrafPtr m_currentPort ;
PenState m_savedPenState ;
bool m_ok ;
} ;
class wxMacFocusClientHelper
{
public :
wxMacFocusClientHelper( wxWindow * theWindow ) ;
~wxMacFocusClientHelper() ;
bool Ok() { return m_ok ; }
private :
GrafPtr m_formerPort ;
GrafPtr m_currentPort ;
bool m_ok ;
} ;
class wxMacDrawingClientHelper
{
public :
wxMacDrawingClientHelper( wxWindow * theWindow ) ;
~wxMacDrawingClientHelper() ;
bool Ok() { return m_ok ; }
private :
GrafPtr m_formerPort ;
GrafPtr m_currentPort ;
PenState m_savedPenState ;
bool m_ok ;
} ;
#endif
// _WX_WINDOW_H_

View File

@@ -23,12 +23,12 @@
#include <winsock.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Definition of GSocket */
typedef
struct _GSocket
{
SOCKET m_fd;

View File

@@ -12,6 +12,29 @@
#ifndef _WX_CW__
#define _WX_CW__
#if __option(profile)
#ifdef __cplusplus
#if __POWERPC__
#include <wx_PPC++_prof.mch>
#elif __INTEL__
#include <wx_x86++_prof.mch>
#elif __CFM68K__
#include <wx_cfm++_prof.mch>
#else
#include <wx_68k++_prof.mch>
#endif
#else
#if __POWERPC__
#include <wx_PPC_prof.mch>
#elif __INTEL__
#include <wx_x86_prof.mch>
#elif __CFM68K__
#include <wx_cfm_prof.mch>
#else
#include <wx_68k_prof.mch>
#endif
#endif
#else
#ifdef __cplusplus
#if __POWERPC__
#include <wx_PPC++.mch>
@@ -33,6 +56,6 @@
#include <wx_68k.mch>
#endif
#endif
#endif
#endif
// _WX_CW__

View File

@@ -9,7 +9,16 @@
#if (__MWERKS__ < 0x0900) || macintosh
#define __MAC__
#define __WXMAC__
#define USE_PRECOMPILED_MAC_HEADERS 1 /*Set to 0 if you don't want to use precompiled MacHeaders*/
#if TARGET_CARBON
#define USE_PRECOMPILED_MAC_HEADERS 0 /*Set to 0 if you don't want to use precompiled MacHeaders*/
#ifdef __cplusplus
#include <MacHeadersPPCX++>
#else
#include <MacHeadersPPCX>
#endif
#else
#define USE_PRECOMPILED_MAC_HEADERS 1 /*Set to 0 if you don't want to use precompiled MacHeaders*/
#endif
// automatically includes MacHeaders
#elif (__MWERKS__ >= 0x0900) && __INTEL__
#define __WXMSW__
@@ -27,19 +36,23 @@
#ifdef __WXMSW__
#include <ansi_prefix.win32.h>
#include <ansi_parms.h>
#ifdef __MWERKS__
#if defined( __MSL__ ) && __MSL__ >= 0x5012
#define fileno _fileno
#define fdopen _fdopen
#define tell _tell
#endif
#endif
#elif defined( __WXMAC__)
#include <ansi_prefix.mac.h>
#endif
#define USE_DEFINE
// in order to avoid problems further down in wxWindows
#ifdef __cplusplus
extern "C"
{
#endif

View File

@@ -12,6 +12,9 @@
#ifndef _WX_CW__
#define _WX_CW__
#if __option(profile)
#error "profiling is not supported in debug versions"
#else
#ifdef __cplusplus
#if __POWERPC__
#include <wx_PPC++_d.mch>
@@ -33,6 +36,7 @@
#include <wx_68k_d.mch>
#endif
#endif
#endif
#endif
// _WX_CW__

View File

@@ -1,16 +1,26 @@
#if __option (profile)
#if __POWERPC__
#pragma precompile_target "wx_PPC.mch"
#pragma precompile_target "wx_PPC_prof.mch"
#elif __INTEL__
#pragma precompile_target "wx_x86_prof.mch"
#elif __CFM68K__
#pragma precompile_target "wx_cfm_prof.mch"
#else
#pragma precompile_target "wx_68k_prof.mch"
#endif
#else
#if __POWERPC__
#pragma precompile_target "wx_PPC.mch"
#elif __INTEL__
#pragma precompile_target "wx_x86.mch"
#elif __CFM68K__
#pragma precompile_target "wx_cfm.mch"
#else
#pragma precompile_target "wx_68k.mch"
#endif
#endif
#pragma once on
#undef WX_PRECOMP
#define wxUSE_GUI 1
#include "wx/wx_cw_cm.h"

View File

@@ -1,18 +1,27 @@
#if __option (profile)
#if __POWERPC__
#pragma precompile_target "wx_PPC++_prof.mch"
#elif __INTEL_
#pragma precompile_target "wx_x86Prof++_prof.mch"
#elif __CFM68K__
#pragma precompile_target "wx_cfmProf++_prof.mch"
#else
#pragma precompile_target "wx_68kProf++_prof.mch"
#endif
#else
#if __POWERPC__
#pragma precompile_target "wx_PPC++.mch"
#elif __INTEL__
#pragma precompile_target "wx_x86++.mch"
#elif __CFM68K__
#pragma precompile_target "wx_cfm++.mch"
#else
#pragma precompile_target "wx_68k++.mch"
#endif
#endif
#pragma once on
#define WX_PRECOMP
#define wxUSE_GUI 1
#include "wx/wx_cw_cm.h"
#include "wx/wxprec.h"

View File

@@ -1,3 +1,6 @@
#if __option (profile)
#error "profiling is not supported for debug targets"
#else
#if __POWERPC__
#pragma precompile_target "wx_PPC_d.mch"
@@ -10,8 +13,13 @@
#else
#pragma precompile_target "wx_68k_d.mch"
#endif
#endif
#pragma once on
#undef WX_PRECOMP
#define __WXDEBUG__
#define __WXDEBUG__ 1
#define wxUSE_GUI 1
#include "wx/wx_cw_cm.h"
#ifdef __WXMSW__
#include <windows.h>
#include "wx/msw/winundef.h"
#endif

View File

@@ -1,19 +1,24 @@
#if __option (profile)
#error "profiling is not supported for debug targets"
#else
#if __POWERPC__
#pragma precompile_target "wx_PPC++_d.mch"
#elif __INTEL__
#pragma precompile_target "wx_x86++_d.mch"
#elif __CFM68K__
#pragma precompile_target "wx_cfm++_d.mch"
#else
#pragma precompile_target "wx_68k++_d.mch"
#endif
#endif
#pragma once on
#define WX_PRECOMP
#define __WXDEBUG__
#define __WXDEBUG__ 1
#define wxUSE_GUI 1
#include "wx/wx_cw_cm.h"
#ifdef WX_PRECOMP
#include "wx/wxprec.h"
#endif

Binary file not shown.

Binary file not shown.

View File

@@ -96,6 +96,10 @@ DbList WXDLLEXPORT *PtrBegDbList = 0;
extern wxList TablesInUse;
#endif
#ifdef __MWERKS__
#define stricmp _stricmp
#define strnicmp _strnicmp
#endif
// SQL Log defaults to be used by GetDbConnection
enum sqlLog SQLLOGstate = sqlLogOFF;

View File

@@ -76,6 +76,11 @@
#include "wx/dbtable.h"
#endif
#ifdef __MWERKS__
#define stricmp _stricmp
#define strnicmp _strnicmp
#endif
#ifdef __UNIX__
// The HPUX preprocessor lines below were commented out on 8/20/97
// because macros.h currently redefines DEBUG and is unneeded.

View File

@@ -45,7 +45,7 @@
#include "wx/socket.h"
#if defined(__WXMSW__) || defined(__WXPM__) || defined(__WXMOTIF__)
#if defined(__WXMSW__) || defined(__WXPM__) || defined(__WXMOTIF__) || defined(__WXMAC__)
#define PROCESS_EVENTS() wxYield()
#elif defined(__WXGTK__)
#include <gtk/gtk.h>

View File

@@ -11,6 +11,16 @@
/* see jconfig.doc for explanations */
/* use wxWindows' configure */
#ifdef __MWERKS__
#if (__MWERKS__ < 0x0900) || macintosh
#define __WXMAC__
#define USE_MAC_MEMMGR
// automatically includes MacHeaders
#elif (__MWERKS__ >= 0x0900) && __INTEL__
#define __WXMSW__
#endif
#endif
#include "wx/setup.h"
#define HAVE_PROTOTYPES

File diff suppressed because it is too large Load Diff

View File

@@ -7,611 +7,12 @@ resource 'STR#' ( 128 , "Simple Alert Messages" )
"This application needs at least a MacPlus" ,
"This application needs more memory" ,
"This application is out of memory" ,
"This application needs at least System 7" ,
"This application needs at least System 7.5" ,
"About this wxWindows Application" ,
"This application needs Appearance extension (built in with System 8) - this restriction will be relieved in the final release"
}
} ;
data 'alis' (128, "Libs alias") {
$"0000 0000 00CE 0002 0001 0A58 5858 5858"
$"5858 5858 5800 0000 0000 0000 0000 0000"
$"0000 0000 0000 AB9F 536B 4244 0000 0002"
$"EE7C 044C 6962 7300 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0003 1F71 AE82 7707 006A 0016 026C"
$"01A3 0001 0001 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0009 5858 5858 5858"
$"5858 5800 0001 0004 0002 EE7C 0002 0019"
$"5858 5858 5858 5858 5858 5858 5858 5858"
$"5858 5858 5858 5858 5800 FFFF 0000"
};
data 'CSOR' (0) {
$"1441 6476 616E 6365 6420 436F 6E63 6570"
$"7473 2041 47"
};
resource 'FREF' (128) {
'APPL',
0,
""
};
resource 'FREF' (129) {
'shlb',
1,
""
};
resource 'FREF' (130) {
'PLPW',
2,
""
};
resource 'icl4' (128) {
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0666 6666 0000 0000 0000 0006 6666 6660"
$"0666 6666 0000 0000 0000 0006 6666 6660"
$"0666 6660 0000 0000 0000 0000 6666 6660"
$"0666 6660 0000 0006 6000 0000 6666 6660"
$"0666 6660 0000 0666 6600 0000 6666 6660"
$"0666 6660 0000 6606 6600 0000 6666 6660"
$"0666 6660 0000 6606 0000 0000 6666 6660"
$"0666 6600 0000 0666 6000 0000 0666 6660"
$"0666 6600 0000 0006 6600 0000 0666 6660"
$"0666 6600 0000 0006 0060 0000 0666 6660"
$"0666 6660 0000 0006 6600 0000 6666 6660"
$"0666 6660 0000 0666 6000 0000 6666 6660"
$"0666 6666 0000 6606 0000 0006 6666 6660"
$"0666 6666 6000 6606 0000 0066 6666 6660"
$"0666 6666 6000 0666 6600 0066 6666 6660"
$"0666 6666 6600 0006 0600 0666 6666 6660"
$"0666 6666 6600 0006 0000 0666 6666 6660"
$"0666 6666 6660 0006 0000 6666 6666 6660"
$"0666 6666 6666 0006 0006 6666 6666 6660"
$"0666 6666 6666 0006 0006 6666 6666 6660"
$"0666 6666 6666 6006 0066 6666 6666 6660"
$"0666 6666 6666 6006 0066 6666 6666 6660"
$"0666 6666 6666 6006 0066 6666 6666 6660"
$"0666 6666 6666 6606 0666 6666 6666 6660"
$"0666 6666 6666 6606 0666 6666 6666 6660"
$"0666 6666 6666 6606 0666 6666 6666 6660"
$"0666 6666 6666 6606 0666 6666 6666 6660"
$"0666 6666 6666 6660 6666 6666 6666 6660"
$"0666 6666 6666 6666 6666 6666 6666 6660"
$"0666 6666 6666 6666 6666 6666 6666 6660"
$"0666 6666 6666 6666 6666 6666 6666 6660"
};
resource 'icl4' (129, "Editor icon-generic ") {
$"0FFF FFFF FFFF FFFF FFFF FFFF FFFF 0000"
$"F000 0000 0000 0000 0000 0000 000C F000"
$"F0CC CCCC CCCC CCCC CCCC CCCC CCCC F000"
$"F0CC CCCC CCCC CCCC CCCC CCCC CCCC F000"
$"F0CC CCCF FFFF FFFF FFFF FFFF CCCC F000"
$"F0CC CCFD DDDD DDDD DDDD DDDD FCCC F000"
$"F0CC CCFD DDDD DDDF FDDD DDDD FCCC F000"
$"F0CC CFDD DDDD DFFF FFDD DDDD DFCC F000"
$"F0FC CFDD DDDD FFCF FFDD DDDD DFCC F000"
$"FF0F 0FDD DDDD FFCF DDDD DDDD DFCC F0F0"
$"F00F 0FFD DDDD DFFF FDDD DDDD FFCC FFCF"
$"000F 0CFD DDDD DDDF FFDD DDDD FCCC F0CF"
$"000F 0CCF DDDD DDDF DDDD DDDF CCCC CCCF"
$"000F 0CCF FDDD DDDF FFDD DDFC CCCC CCCF"
$"000F 0CCC FDDD DFFF FDDD DDFC CCCC CCCF"
$"000F 0CCC CFDD FFCF DDDD DFCC CCCC CCCF"
$"000F 0CCC CFDD FFCF DDDD DFCC CCCC CCCF"
$"000F 0CCC CCFD DFFF FFDD FCCC CCCC CCCF"
$"000F 0CCC CCFF DDDF DFDF CCCC CCCC CCCF"
$"000F 0CCC CCCF DDDF DDDF CCCC CCCC CCCF"
$"000F 0CCC CCCC FDDF DDFC CCCC CCCC FCCF"
$"F00F 0CCC CCCC FDDF DDFC CCCC CCCC FFCF"
$"FF0F 0CCC CCCC FDDF DDFC CCCC CCCC F0F0"
$"F0F0 CCCC CCCC CFDF DFCC CCCC CCCC F000"
$"F00C CCCC CCCC CFDF DFCC CCCC CCCC F000"
$"F0CC CCCC CCCC CFDF DFCC CCCC CCCC F000"
$"F0CC CCCC CCCC CCFF FCCC CCCC CCCC F000"
$"F0CC CCCC CCCC CCCC CCCC CCCC CCCC F000"
$"F0CC CCCC CCCC CCCC CCCC CCCC CCCC F000"
$"F0CC CCCC CCCC CCCC CCCC CCCC CCCC F000"
$"FCCC CCCC CCCC CCCC CCCC CCCC CCCC F000"
$"0FFF FFFF FFFF FFFF FFFF FFFF FFFF"
};
resource 'icl4' (130, "Editor icon-generic ") {
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"000F FFFF FFFF FFFF FFFF FFFF FFFF F000"
$"000F 0000 0000 0000 0000 0000 0000 F000"
$"000F 0CCC CCCC CCCC CCCC CCCC CCCC F000"
$"FFFF DDDD DDDD DDDD DDDD DDDD DDDD FFFF"
$"F00D 0000 0000 0000 0000 0000 0000 D00F"
$"F0CD 0CFD DDDD DDDD DDDD DDDD FCCC DCCF"
$"F0CD 0CFD DDDD DDDF FDDD DDDD FCCC DCCF"
$"F0CD 0FDD DDDD DFFF FFDD DDDD DFCC DCCF"
$"F0CD 0FDD DDDD FFCF FFDD DDDD DFCC DCCF"
$"F0CD 0FDD DDDD FFCF DDDD DDDD DFCC DCCF"
$"F0CD 0FFD DDDD DFFF FDDD DDDD FFCC DCCF"
$"F0CD 0CFD DDDD DDDF FFDD DDDD FCCC DCCF"
$"F0CD 0CCF DDDD DDDF DDDD DDDF CCCC DCCF"
$"F0CD 0CCF FDDD DDDF FFDD DDFC CCCC DCCF"
$"F0CD 0CCC FDDD DFFF FDDD DDFC CCCC DCCF"
$"F0CD 0CCC CFDD FFCF DDDD DFCC CCCC DCCF"
$"F0CD 0CCC CFDD FFCF DDDD DFCC CCCC DCCF"
$"F0CD 0CCC CCFD DFFF FFDD FCCC CCCC DCCF"
$"F0CD 0CCC CCFF DDDF DFDF CCCC CCCC DCCF"
$"F0CD 0CCC CCCF DDDF DDDF CCCC CCCC DCCF"
$"F0CD 0CCC CCCC FDDF DDFC CCCC CCCC DCCF"
$"F0CD 0CCC CCCC FDDF DDFC CCCC CCCC DCCF"
$"F0CD 0CCC CCCC FDDF DDFC CCCC CCCC DCCF"
$"F0CD 0CCC CCCC CFDF DFCC CCCC CCCC DCCF"
$"F0CD 0CCC CCCC CFDF DFCC CCCC CCCC DCCF"
$"F0CD 0CCC CCCC CFDF DFCC CCCC CCCC DCCF"
$"F0CD DDDD DDDD DDFF FDDD DDDD DDDD FFFF"
$"F0CC CCCC CCCC CCCC CCCC CCCC CCCC F000"
$"F0CC CCCC CCCC CCCC CCCC CCCC CCCC F000"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF F0"
};
resource 'icl8' (128) {
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"00AB ABAB ABAB ABAB 0000 0000 0000 0000"
$"0000 0000 0000 00AB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB 0000 0000 0000 0000"
$"0000 0000 0000 00AB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB AB00 0000 0000 0000 0000"
$"0000 0000 0000 0000 ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB AB00 0000 0000 0000 00AB"
$"AB00 0000 0000 0000 ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB AB00 0000 0000 00AB ABAB"
$"ABAB 0000 0000 0000 ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB AB00 0000 0000 ABAB 00AB"
$"ABAB 0000 0000 0000 ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB AB00 0000 0000 ABAB 00AB"
$"0000 0000 0000 0000 ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB 0000 0000 0000 00AB ABAB"
$"AB00 0000 0000 0000 00AB ABAB ABAB AB00"
$"00AB ABAB ABAB 0000 0000 0000 0000 00AB"
$"ABAB 0000 0000 0000 00AB ABAB ABAB AB00"
$"00AB ABAB ABAB 0000 0000 0000 0000 00AB"
$"0000 AB00 0000 0000 00AB ABAB ABAB AB00"
$"00AB ABAB ABAB AB00 0000 0000 0000 00AB"
$"ABAB 0000 0000 0000 ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB AB00 0000 0000 00AB ABAB"
$"AB00 0000 0000 0000 ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB 0000 0000 ABAB 00AB"
$"0000 0000 0000 00AB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB AB00 0000 ABAB 00AB"
$"0000 0000 0000 ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB AB00 0000 00AB ABAB"
$"ABAB 0000 0000 ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB 0000 0000 00AB"
$"00AB 0000 00AB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB 0000 0000 00AB"
$"0000 0000 00AB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB AB00 0000 00AB"
$"0000 0000 ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB 0000 00AB"
$"0000 00AB ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB 0000 00AB"
$"0000 00AB ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB AB00 00AB"
$"0000 ABAB ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB AB00 00AB"
$"0000 ABAB ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB AB00 00AB"
$"0000 ABAB ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB ABAB 00AB"
$"00AB ABAB ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB ABAB 00AB"
$"00AB ABAB ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB ABAB 00AB"
$"00AB ABAB ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB ABAB 00AB"
$"00AB ABAB ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB ABAB AB00"
$"ABAB ABAB ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB ABAB ABAB"
$"ABAB ABAB ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB ABAB ABAB"
$"ABAB ABAB ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB ABAB ABAB"
$"ABAB ABAB ABAB ABAB ABAB ABAB ABAB AB"
};
resource 'icl8' (130, "Editor icon-generic ") {
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 00FF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FF00 0000"
$"0000 00FF 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 00F5 FF00 0000"
$"0000 00FF F5F6 F6F6 F6F6 F6F6 F6F6 F6F6"
$"F6F6 F6F6 F6F6 F6F6 F6F6 F6F8 FF00 0000"
$"FFFF FFFF F9F9 F9F9 F9F9 F9F9 F9F9 F9F9"
$"F9F9 F9F9 F9F9 F9F9 F9F9 F9F9 FFFF FFFF"
$"FF00 F5F9 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 F9F5 00FF"
$"FF00 F6F9 002B FFF9 F9F9 F9F9 F9F9 F9F9"
$"F9F9 F9F9 F9F9 F9F9 FF2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B FFF9 F9F9 F9F9 F9F9 F9FF"
$"FFF9 F9F9 F9F9 F9F9 FF2B 2BF8 F92B F8FF"
$"FF00 F6F9 00FF F9F9 F9F9 F9F9 F9FF FFFF"
$"FFFF F9F9 F9F9 F9F9 F9FF 2BF8 F92B F8FF"
$"FF00 F6F9 00FF F9F9 F9F9 F9F9 FFFF 2BFF"
$"FFFF F9F9 F9F9 F9F9 F9FF 2BF8 F92B F8FF"
$"FF00 F6F9 00FF F9F9 F9F9 F9F9 FFFF 2BFF"
$"F9F9 F9F9 F9F9 F9F9 F9FF 2BF8 F92B F8FF"
$"FF00 F6F9 00FF FFF9 F9F9 F9F9 F9FF FFFF"
$"FFF9 F9F9 F9F9 F9F9 FFFF 2BF8 F92B F8FF"
$"FF00 F6F9 002B FFF9 F9F9 F9F9 F9F9 F9FF"
$"FFFF F9F9 F9F9 F9F9 FF2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2BFF F9F9 F9F9 F9F9 F9FF"
$"F9F9 F9F9 F9F9 F9FF 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2BFF FFF9 F9F9 F9F9 F9FF"
$"FFFF F9F9 F9F9 FF2B 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2B2B FFF9 F9F9 F9FF FFFF"
$"FFF9 F9F9 F9F9 FF2B 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2B2B 2BFF F9F9 FFFF 2BFF"
$"F9F9 F9F9 F9FF 2B2B 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2B2B 2BFF F9F9 FFFF 2BFF"
$"F9F9 F9F9 F9FF 2B2B 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2B2B 2B2B FFF9 F9FF FFFF"
$"FFFF F9F9 FF2B 2B2B 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2B2B 2B2B FFFF F9F9 F9FF"
$"F9FF F9FF 2B2B 2B2B 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2B2B 2B2B 2BFF F9F9 F9FF"
$"F9F9 F9FF 2B2B 2B2B 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2B2B 2B2B 2B2B FFF9 F9FF"
$"F9F9 FF2B 2B2B 2B2B 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2B2B 2B2B 2B2B FFF9 F9FF"
$"F9F9 FF2B 2B2B 2B2B 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2B2B 2B2B 2B2B FFF9 F9FF"
$"F9F9 FF2B 2B2B 2B2B 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2B2B 2B2B 2B2B 2BFF F9FF"
$"F9FF 2B2B 2B2B 2B2B 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2B2B 2B2B 2B2B 2BFF F9FF"
$"F9FF 2B2B 2B2B 2B2B 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 00F8 F82B 2B2B 2B2B 2BFF F9FF"
$"F9FF 2B2B 2B2B 2B2B F8F8 F8F8 F9F7 F8FF"
$"FF00 F6F9 F9F9 F9F9 F9F9 F9F9 F9F9 FFFF"
$"FFF9 F9F9 F9F9 F9F9 F9F9 F9F9 FFFF FFFF"
$"FF00 F62B 2B2B 2B2B 2B2B 2B2B 2B2B 2B2B"
$"2B2B 2B2B 2B2B 2B2B 2B2B 2BF8 FF00 0000"
$"FFF5 F8F8 F8F8 F8F8 F8F8 F8F8 F8F8 F8F8"
$"F8F8 F8F8 F8F8 F8F8 F8F8 F8F8 FF00 0000"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FF"
};
resource 'icl8' (129) {
$"00FF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF 0000 0000"
$"FF00 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 00F6 FF00 0000"
$"FF00 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6"
$"F6F6 F6F6 F6F6 F6F6 F6F6 F6F7 FF00 0000"
$"FF00 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6"
$"F6F6 F6F6 F6F6 F6F6 F6F6 F6F7 FF00 0000"
$"FF00 F6F6 F6F6 F6FF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF F6F6 F6F7 FF00 0000"
$"FF00 F6F6 F62B FFF9 F9F9 F9F9 F9F9 F9F9"
$"F9F9 F9F9 F9F9 F9F9 FF2B F6F7 FF00 0000"
$"FF00 F6F6 F62B FFF9 F9F9 F9F9 F9F9 F9FF"
$"FFF9 F9F9 F9F9 F9F9 FF2B F6F7 FF00 0000"
$"FF00 F7F6 F6FF F9F9 F9F9 F9F9 F9FF FFFF"
$"FFFF F9F9 F9F9 F9F9 F9FF F6F7 FF00 0000"
$"FF00 FFF7 F6FF F9F9 F9F9 F9F9 FFFF 2BFF"
$"FFFF F9F9 F9F9 F9F9 F9FF F6F7 FF00 0000"
$"FFFF 00FF 00FF F9F9 F9F9 F9F9 FFFF 2BFF"
$"F9F9 F9F9 F9F9 F9F9 F9FF F6F7 FF00 FF00"
$"FF00 00FF 00FF FFF9 F9F9 F9F9 F9FF FFFF"
$"FFF9 F9F9 F9F9 F9F9 FFFF F6F7 FFFF F7FF"
$"0000 00FF 00F6 FFF9 F9F9 F9F9 F9F9 F9FF"
$"FFFF F9F9 F9F9 F9F9 FFF6 F6F7 FF00 F7FF"
$"0000 00FF 00F6 F6FF F9F9 F9F9 F9F9 F9FF"
$"F9F9 F9F9 F9F9 F9FF F6F6 F6F6 F6F6 F7FF"
$"0000 00FF 00F6 F6FF FFF9 F9F9 F9F9 F9FF"
$"FFFF F9F9 F9F9 FFF6 F6F6 F6F6 F6F6 F7FF"
$"0000 00FF 00F6 F6F6 FFF9 F9F9 F9FF FFFF"
$"FFF9 F9F9 F9F9 FFF6 F6F6 F6F6 F6F6 F7FF"
$"0000 00FF 00F6 F6F6 F6FF F9F9 FFFF 2BFF"
$"F9F9 F9F9 F9FF F6F6 F6F6 F6F6 F6F6 F7FF"
$"0000 00FF 00F6 F6F6 F6FF F9F9 FFFF 2BFF"
$"F9F9 F9F9 F9FF F6F6 F6F6 F6F6 F6F6 F7FF"
$"0000 00FF 00F6 F6F6 F6F6 FFF9 F9FF FFFF"
$"FFFF F9F9 FFF6 F6F6 F6F6 F6F6 F6F6 F7FF"
$"0000 00FF 00F6 F6F6 F6F6 FFFF F9F9 F9FF"
$"F9FF F9FF F6F6 F6F6 F6F6 F6F6 F6F6 F7FF"
$"0000 00FF 00F6 F6F6 F6F6 F6FF F9F9 F9FF"
$"F9F9 F9FF F6F6 F6F6 F6F6 F6F6 F7F6 F7FF"
$"0000 00FF 00F6 F6F6 F6F6 F6F6 FFF9 F9FF"
$"F9F9 FFF6 F6F6 F6F6 F6F6 F6F7 FFF7 F7FF"
$"FF00 00FF 00F6 F6F6 F6F6 F6F6 FFF9 F9FF"
$"F9F9 FFF6 F6F6 F6F6 F6F6 F6F7 FFFF F7FF"
$"FFFF 00FF 00F6 F6F6 F6F6 F6F6 FFF9 F9FF"
$"F9F9 FFF6 F6F6 F6F6 F6F6 F6F7 FF00 FF00"
$"FF00 FF00 F6F6 F6F6 F6F6 F6F6 F6FF F9FF"
$"F9FF F6F6 F6F6 F6F6 F6F6 F6F7 FF00 0000"
$"FF00 00F6 F6F6 F6F6 F6F6 F6F6 F6FF F9FF"
$"F9FF F6F6 F6F6 F6F6 F6F6 F6F7 FF00 0000"
$"FF00 F6F6 F6F6 F6F6 F6F6 F6F6 F6FF F9FF"
$"F9FF F6F6 F6F6 F6F6 F6F6 F6F7 FF00 0000"
$"FF00 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6 FFFF"
$"FFF6 F6F6 F6F6 F6F6 F6F6 F6F7 FF00 0000"
$"FF00 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6"
$"F6F6 F6F6 F6F6 F6F6 F6F6 F6F7 FF00 0000"
$"FF00 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6"
$"F6F6 F6F6 F6F6 F6F6 F6F6 F6F7 FF00 0000"
$"FF00 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6"
$"F6F6 F6F6 F6F6 F6F6 F6F6 F6F7 FF00 0000"
$"FFF6 F7F7 F7F7 F7F7 F7F7 F7F7 F7F7 F7F7"
$"F7F7 F7F7 F7F7 F7F7 F7F7 F7F7 FF00 0000"
$"00FF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF"
};
resource 'icm#' (129) {
{ /* array: 2 elements */
/* [1] */
$"",
/* [2] */
$""
}
};
resource 'icm#' (128) {
{ /* array: 2 elements */
/* [1] */
$"",
/* [2] */
$""
}
};
resource 'icm#' (130) {
{ /* array: 2 elements */
/* [1] */
$"",
/* [2] */
$""
}
};
resource 'icm4' (129) {
$""
};
resource 'icm4' (128) {
$""
};
resource 'icm4' (130) {
$""
};
resource 'icm8' (129) {
$""
};
resource 'icm8' (128) {
$""
};
resource 'icm8' (130) {
$""
};
resource 'ICN#' (128) {
{ /* array: 2 elements */
/* [1] */
$"0000 0000 7F00 01FE 7F00 01FE 7E00 00FE"
$"7E01 80FE 7E07 C0FE 7E0D C0FE 7E0D 00FE"
$"7C07 807E 7C01 C07E 7C01 207E 7E01 C0FE"
$"7E07 80FE 7F0D 01FE 7F8D 03FE 7F87 C3FE"
$"7FC1 47FE 7FC1 07FE 7FE1 0FFE 7FF1 1FFE"
$"7FF1 1FFE 7FF9 3FFE 7FF9 3FFE 7FF9 3FFE"
$"7FFD 7FFE 7FFD 7FFE 7FFD 7FFE 7FFD 7FFE"
$"7FFE FFFE 7FFF FFFE 7FFF FFFE 7FFF FFFE",
/* [2] */
$"0000 0000 7F00 01FE 7F00 01FE 7E00 00FE"
$"7E01 80FE 7E07 C0FE 7E0D C0FE 7E0D 00FE"
$"7C07 807E 7C01 C07E 7C01 207E 7E01 C0FE"
$"7E07 80FE 7F0D 01FE 7F8D 03FE 7F87 C3FE"
$"7FC1 47FE 7FC1 07FE 7FE1 0FFE 7FF1 1FFE"
$"7FF1 1FFE 7FF9 3FFE 7FF9 3FFE 7FF9 3FFE"
$"7FFD 7FFE 7FFD 7FFE 7FFD 7FFE 7FFD 7FFE"
$"7FFE FFFE 7FFF FFFE 7FFF FFFE 7FFF FFFE"
}
};
resource 'ICN#' (129, "Editor icon-generic ") {
{ /* array: 2 elements */
/* [1] */
$"7FFF FFF0 8000 0008 8000 0008 8000 0008"
$"82AA AA88 8200 0088 8200 0088 8201 8088"
$"A407 C048 D40D C04A 940D 004D 1607 80C9"
$"1201 C081 1101 0101 1181 C201 1087 8201"
$"104D 0401 104D 0401 1027 C801 1031 5001"
$"1011 1009 9009 200D D009 200A A009 2008"
$"8005 4008 8005 4008 8005 4008 8003 8008"
$"8000 0008 8000 0008 8000 0008 7FFF FFF0",
/* [2] */
$"0000 0000 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFF8 FFFF FFF8 FFFF FFF8"
}
};
resource 'ICN#' (130, "Editor icon-generic ") {
{ /* array: 2 elements */
/* [1] */
$"0000 0000 1FFF FFF8 1000 0008 1000 0008"
$"FAAA AAAF 9200 00A1 8200 0089 9201 8081"
$"8407 C049 940D C041 840D 0049 9607 80C1"
$"8201 C089 9101 0101 8181 C209 9087 8201"
$"804D 0409 904D 0401 8027 C809 9031 5001"
$"8011 1009 9009 2001 8009 2009 9009 2001"
$"8005 4009 9005 4001 8005 4009 9557 D55F"
$"8000 0008 8000 0008 FFFF FFF8",
/* [2] */
$"0000 0000 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFF8 FFFF FFF8 FFFF FFF8"
}
};
resource 'ics#' (129, "Editor icon-generic ") {
{ /* array: 2 elements */
/* [1] */
$"3FFC 2004 E007 8001 8001 8001 8001 8001"
$"8001 8001 8001 8001 8001 8007 8004 FFFC",
/* [2] */
$"3FFC 3FFC FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFC FFFC"
}
};
resource 'ics#' (128) {
{ /* array: 2 elements */
/* [1] */
$"",
/* [2] */
$""
}
};
resource 'ics#' (130, "Editor icon-generic ") {
{ /* array: 2 elements */
/* [1] */
$"3FFC 2004 E007 8001 8001 8001 8001 8001"
$"8001 8001 8001 8001 8001 8007 8004 FFFC",
/* [2] */
$"3FFC 3FFC FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFC FFFC"
}
};
resource 'ics4' (129, "Editor icon-generic ") {
$"00FF FFFF FFFF FF00 00F0 0000 0000 CF00"
$"FFFD DDDD DDDD DFFF F0D0 0000 0000 CDCF"
$"F0D0 CCCC CCCC CDCF F0D0 CCCC CCCC CDCF"
$"F0D0 CCCC CCCC CDCF F0D0 CCCC CCCC CDCF"
$"F0D0 CCCC CCCC CDCF F0D0 CCCC CCCC CDCF"
$"F0D0 CCCC CCCC CDCF F0D0 CCCC CCCC CDCF"
$"F0DC CCCC CCCC CDCF F0DD DDDD DDDD DFFF"
$"FCCC CCCC CCCC CF00 FFFF FFFF FFFF FF"
};
resource 'ics4' (128) {
$""
};
resource 'ics4' (130, "Editor icon-generic ") {
$"00FF FFFF FFFF FF00 00F0 0000 0000 CF00"
$"FFFD DDDD DDDD DFFF F0D0 0000 0000 CDCF"
$"F0D0 CCCC CCCC CDCF F0D0 CCCC CCCC CDCF"
$"F0D0 CCCC CCCC CDCF F0D0 CCCC CCCC CDCF"
$"F0D0 CCCC CCCC CDCF F0D0 CCCC CCCC CDCF"
$"F0D0 CCCC CCCC CDCF F0D0 CCCC CCCC CDCF"
$"F0DC CCCC CCCC CDCF F0DD DDDD DDDD DFFF"
$"FCCC CCCC CCCC CF00 FFFF FFFF FFFF FF"
};
resource 'ics8' (129, "Editor icon-generic ") {
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF 0000"
$"0000 FFF5 F5F5 F5F5 F5F5 F5F5 F6FF 0000"
$"FFFF FFF9 F9F9 F9F9 F9F9 F9F9 F9FF FFFF"
$"FFF5 F9F5 F5F5 F5F5 F5F5 F5F5 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F92B 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F9 F9F9 F9F9 F9F9 F9F9 F9FF FFFF"
$"FFF6 F8F8 F8F8 F8F8 F8F8 F8F8 F8FF 0000"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
};
resource 'ics8' (128) {
$""
};
resource 'ics8' (130, "Editor icon-generic ") {
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF 0000"
$"0000 FFF5 F5F5 F5F5 F5F5 F5F5 F6FF 0000"
$"FFFF FFF9 F9F9 F9F9 F9F9 F9F9 F9FF FFFF"
$"FFF5 F9F5 F5F5 F5F5 F5F5 F5F5 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F92B 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F9 F9F9 F9F9 F9F9 F9F9 F9FF FFFF"
$"FFF6 F8F8 F8F8 F8F8 F8F8 F8F8 F8FF 0000"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
};
data 'iSNP' (129) {
$"0000" /* .. */
};
data 'iSNP' (128) {
$"0000" /* .. */
};
data 'iSNP' (130) {
$"0000" /* .. */
};
resource 'BNDL' (128) {
'CSOR',
0,
{ /* array TypeArray: 2 elements */
/* [1] */
'ICN#',
{ /* array IDArray: 3 elements */
/* [1] */
0, 128,
/* [2] */
1, 129,
/* [3] */
2, 130
},
/* [2] */
'FREF',
{ /* array IDArray: 3 elements */
/* [1] */
0, 128,
/* [2] */
1, 129,
/* [3] */
2, 130
}
}
};
resource 'MENU' (1, preload)
{
1, textMenuProc, 0b11111111111111111111111111111110 , enabled, apple ,
@@ -624,3 +25,4 @@ resource 'MENU' (1, preload)
resource 'MBAR' (1,preload)
{
{ 1 } ;
} ;

View File

@@ -20,11 +20,83 @@
#include "wx/icon.h"
#include "wx/log.h"
extern "C"
{
#include "xpm.h"
} ;
#if !USE_SHARED_LIBRARIES
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
#endif
#include <PictUtils.h>
CTabHandle wxMacCreateColorTable( int numColors )
{
CTabHandle newColors; /* Handle to the new color table */
short index; /* Index into the table of colors */
/* Allocate memory for the color table */
newColors = (CTabHandle)NewHandleClear( sizeof (ColorTable) +
sizeof (ColorSpec) * (numColors - 1) );
if (newColors != nil)
{
/* Initialize the fields */
(**newColors).ctSeed = GetCTSeed();
(**newColors).ctFlags = 0;
(**newColors).ctSize = numColors - 1;
/* Initialize the table of colors */
}
return newColors ;
}
void wxMacDestroyColorTable( CTabHandle colors )
{
DisposeHandle( (Handle) colors ) ;
}
void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue )
{
(**newColors).ctTable[index].value = index;
(**newColors).ctTable[index].rgb.red = 0 ;// someRedValue;
(**newColors).ctTable[index].rgb.green = 0 ; // someGreenValue;
(**newColors).ctTable[index].rgb.blue = 0 ; // someBlueValue;
}
GWorldPtr wxMacCreateGWorld( int height , int width , int depth )
{
OSErr err = noErr ;
GWorldPtr port ;
Rect rect = { 0 , 0 , width , height } ;
if ( depth < 0 )
{
// get max pixel depth
CGrafPtr port ;
GetCWMgrPort( &port ) ;
GDHandle maxDevice ;
maxDevice = GetMaxDevice( &port->portRect ) ;
if ( maxDevice )
depth = (**((**maxDevice).gdPMap)).pixelSize ;
else
depth = 8 ;
}
err = NewGWorld( &port , depth , &rect , NULL , NULL , 0 ) ;
if ( err == noErr )
{
return port ;
}
return NULL ;
}
void wxMacDestroyGWorld( GWorldPtr gw )
{
if ( gw )
DisposeGWorld( gw ) ;
}
wxBitmapRefData::wxBitmapRefData()
{
m_ok = FALSE;
@@ -34,17 +106,43 @@ wxBitmapRefData::wxBitmapRefData()
m_quality = 0;
m_numColors = 0;
m_bitmapMask = NULL;
m_hBitmap = NULL ;
m_hPict = NULL ;
m_bitmapType = kMacBitmapTypeUnknownType ;
}
wxBitmapRefData::~wxBitmapRefData()
{
/*
* TODO: delete the bitmap data here.
*/
if (m_bitmapMask)
delete m_bitmapMask;
switch (m_bitmapType)
{
case kMacBitmapTypePict :
{
if ( m_hPict )
{
KillPicture( m_hPict ) ;
m_hPict = NULL ;
}
}
break ;
case kMacBitmapTypeGrafWorld :
{
if ( m_hBitmap )
{
wxMacDestroyGWorld( m_hBitmap ) ;
m_hBitmap = NULL ;
}
}
break ;
default :
// unkown type ?
break ;
} ;
if (m_bitmapMask)
{
delete m_bitmapMask;
m_bitmapMask = NULL;
}
}
wxList wxBitmap::sm_handlers;
@@ -71,8 +169,57 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
M_BITMAPDATA->m_height = the_height ;
M_BITMAPDATA->m_depth = no_bits ;
M_BITMAPDATA->m_numColors = 0;
/* TODO: create the bitmap from data */
if ( no_bits == 1 )
{
M_BITMAPDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
M_BITMAPDATA->m_hBitmap = wxMacCreateGWorld( the_width , the_height , no_bits ) ;
M_BITMAPDATA->m_ok = (M_BITMAPDATA->m_hBitmap != NULL ) ;
CGrafPtr origPort ;
GDHandle origDevice ;
GetGWorld( &origPort , &origDevice ) ;
SetGWorld( M_BITMAPDATA->m_hBitmap , NULL ) ;
// bits is a word aligned array
unsigned char* linestart = (unsigned char*) bits ;
int linesize = ( the_width / 16 ) * 2 ;
if ( the_width % 16 )
{
linesize += 2 ;
} ;
RGBColor colors[2] = {
{ 0xFFFF , 0xFFFF , 0xFFFF } ,
{ 0, 0 , 0 }
} ;
for( int y = 0 ; y < the_height ; ++y , linestart += linesize )
{
for( int x = 0 ; x < the_width ; ++x )
{
int index = x / 8 ;
int bit = x % 8 ;
int mask = 1 << bit ;
if ( linestart[index] & mask )
{
SetCPixel( x , y , &colors[1] ) ;
}
else
{
SetCPixel( x , y , &colors[0] ) ;
}
}
}
SetGWorld( origPort , origDevice ) ;
}
else
{
//multicolor BITMAPs not yet implemented
}
if ( wxTheBitmapList )
wxTheBitmapList->AddBitmap(this);
@@ -102,13 +249,10 @@ wxBitmap::wxBitmap(const wxString& filename, long type)
wxTheBitmapList->AddBitmap(this);
}
/* TODO: maybe allow creation from XPM
// Create from data
wxBitmap::wxBitmap(const char **data)
{
(void) Create((void *)data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
}
*/
bool wxBitmap::Create(int w, int h, int d)
{
@@ -120,11 +264,19 @@ bool wxBitmap::Create(int w, int h, int d)
M_BITMAPDATA->m_height = h;
M_BITMAPDATA->m_depth = d;
/* TODO: create new bitmap */
M_BITMAPDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
M_BITMAPDATA->m_hBitmap = wxMacCreateGWorld( w , h , d ) ;
M_BITMAPDATA->m_ok = (M_BITMAPDATA->m_hBitmap != NULL ) ;
return M_BITMAPDATA->m_ok;
}
void wxBitmap::SetHBITMAP(WXHBITMAP bmp)
{
M_BITMAPDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
M_BITMAPDATA->m_hBitmap = bmp ;
M_BITMAPDATA->m_ok = (M_BITMAPDATA->m_hBitmap != NULL ) ;
}
bool wxBitmap::LoadFile(const wxString& filename, long type)
{
UnRef();
@@ -386,6 +538,52 @@ bool wxBitmapHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int type,
* Standard handlers
*/
class WXDLLEXPORT wxPICTResourceHandler: public wxBitmapHandler
{
DECLARE_DYNAMIC_CLASS(wxPICTResourceHandler)
public:
inline wxPICTResourceHandler()
{
m_name = "Macintosh Pict resource";
m_extension = "";
m_type = wxBITMAP_TYPE_PICT_RESOURCE;
};
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight);
};
IMPLEMENT_DYNAMIC_CLASS(wxPICTResourceHandler, wxBitmapHandler)
bool wxPICTResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight)
{
Str255 theName ;
strcpy( (char*) theName , name ) ;
c2pstr( (char*) theName ) ;
PicHandle thePict = (PicHandle ) GetNamedResource( 'PICT' , theName ) ;
if ( thePict )
{
PictInfo theInfo ;
GetPictInfo( thePict , &theInfo , 0 , 0 , systemMethod , 0 ) ;
DetachResource( (Handle) thePict ) ;
M_BITMAPHANDLERDATA->m_bitmapType = kMacBitmapTypePict ;
M_BITMAPHANDLERDATA->m_hPict = thePict ;
M_BITMAPHANDLERDATA->m_width = theInfo.sourceRect.right - theInfo.sourceRect.left ;
M_BITMAPHANDLERDATA->m_height = theInfo.sourceRect.bottom - theInfo.sourceRect.top ;
M_BITMAPHANDLERDATA->m_depth = theInfo.depth ;
M_BITMAPHANDLERDATA->m_ok = true ;
M_BITMAPHANDLERDATA->m_numColors = theInfo.uniqueColors ;
// M_BITMAPHANDLERDATA->m_bitmapPalette;
// M_BITMAPHANDLERDATA->m_quality;
return TRUE ;
}
return FALSE ;
}
/* TODO: bitmap handlers, a bit like this:
class WXDLLEXPORT wxBMPResourceHandler: public wxBitmapHandler
{
@@ -404,6 +602,251 @@ public:
IMPLEMENT_DYNAMIC_CLASS(wxBMPResourceHandler, wxBitmapHandler)
*/
class WXDLLEXPORT wxXPMFileHandler: public wxBitmapHandler
{
DECLARE_DYNAMIC_CLASS(wxXPMFileHandler)
public:
inline wxXPMFileHandler(void)
{
m_name = "XPM bitmap file";
m_extension = "xpm";
m_type = wxBITMAP_TYPE_XPM;
};
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth = -1, int desiredHeight = -1);
virtual bool SaveFile(wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette = NULL);
};
IMPLEMENT_DYNAMIC_CLASS(wxXPMFileHandler, wxBitmapHandler)
bool wxXPMFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight)
{
#if USE_XPM_IN_MSW
XImage *ximage;
XpmAttributes xpmAttr;
HDC dc;
M_BITMAPHANDLERDATA->m_ok = FALSE;
dc = CreateCompatibleDC(NULL);
if (dc)
{
xpmAttr.valuemask = XpmReturnPixels;
int errorStatus = XpmReadFileToImage(&dc, WXSTRINGCAST name, &ximage, (XImage **) NULL, &xpmAttr);
DeleteDC(dc);
if (errorStatus == XpmSuccess)
{
M_BITMAPHANDLERDATA->m_hBitmap = (WXHBITMAP) ximage->bitmap;
BITMAP bm;
GetObject((HBITMAP)M_BITMAPHANDLERDATA->m_hBitmap, sizeof(bm), (LPSTR) & bm);
M_BITMAPHANDLERDATA->m_width = (bm.bmWidth);
M_BITMAPHANDLERDATA->m_height = (bm.bmHeight);
M_BITMAPHANDLERDATA->m_depth = (bm.bmPlanes * bm.bmBitsPixel);
M_BITMAPHANDLERDATA->m_numColors = xpmAttr.npixels;
XpmFreeAttributes(&xpmAttr);
XImageFree(ximage);
M_BITMAPHANDLERDATA->m_ok = TRUE;
return TRUE;
}
else
{
M_BITMAPHANDLERDATA->m_ok = FALSE;
return FALSE;
}
}
#endif
return FALSE;
}
bool wxXPMFileHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette)
{
#if USE_XPM_IN_MSW
HDC dc = NULL;
Visual *visual = NULL;
XImage ximage;
dc = CreateCompatibleDC(NULL);
if (dc)
{
if (SelectObject(dc, (HBITMAP) M_BITMAPHANDLERDATA->m_hBitmap))
{ /* for following SetPixel */
/* fill the XImage struct 'by hand' */
ximage.width = M_BITMAPHANDLERDATA->m_width;
ximage.height = M_BITMAPHANDLERDATA->m_height;
ximage.depth = M_BITMAPHANDLERDATA->m_depth;
ximage.bitmap = (void *)M_BITMAPHANDLERDATA->m_hBitmap;
int errorStatus = XpmWriteFileFromImage(&dc, WXSTRINGCAST name,
&ximage, (XImage *) NULL, (XpmAttributes *) NULL);
if (dc)
DeleteDC(dc);
if (errorStatus == XpmSuccess)
return TRUE; /* no error */
else
return FALSE;
} else return FALSE;
} else return FALSE;
#else
return FALSE;
#endif
}
class WXDLLEXPORT wxXPMDataHandler: public wxBitmapHandler
{
DECLARE_DYNAMIC_CLASS(wxXPMDataHandler)
public:
inline wxXPMDataHandler(void)
{
m_name = "XPM bitmap data";
m_extension = "xpm";
m_type = wxBITMAP_TYPE_XPM_DATA;
};
virtual bool Create(wxBitmap *bitmap, void *data, long flags, int width, int height, int depth = 1);
};
IMPLEMENT_DYNAMIC_CLASS(wxXPMDataHandler, wxBitmapHandler)
bool wxXPMDataHandler::Create(wxBitmap *bitmap, void *data, long flags, int width, int height, int depth)
{
XImage * ximage;
int ErrorStatus;
XpmAttributes xpmAttr;
xpmAttr.valuemask = XpmReturnInfos; // get infos back
ErrorStatus = XpmCreateImageFromData( GetMainDevice() , (char **)data,
&ximage, (XImage **) NULL, &xpmAttr);
if (ErrorStatus == XpmSuccess)
{
M_BITMAPHANDLERDATA->m_ok = FALSE;
M_BITMAPHANDLERDATA->m_numColors = 0;
M_BITMAPHANDLERDATA->m_hBitmap = ximage->gworldptr ;
M_BITMAPHANDLERDATA->m_width = ximage->width;
M_BITMAPHANDLERDATA->m_height = ximage->height;
M_BITMAPHANDLERDATA->m_depth = ximage->depth;
M_BITMAPHANDLERDATA->m_numColors = xpmAttr.npixels;
XpmFreeAttributes(&xpmAttr);
M_BITMAPHANDLERDATA->m_ok = TRUE;
ximage->gworldptr = NULL ;
XImageFree(ximage); // releases the malloc, but does not detroy
// the bitmap
M_BITMAPHANDLERDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
return TRUE;
}
else
{
M_BITMAPHANDLERDATA->m_ok = FALSE;
return FALSE;
}
return FALSE;
}
class WXDLLEXPORT wxBMPResourceHandler: public wxBitmapHandler
{
DECLARE_DYNAMIC_CLASS(wxBMPResourceHandler)
public:
inline wxBMPResourceHandler()
{
m_name = "Windows bitmap resource";
m_extension = "";
m_type = wxBITMAP_TYPE_BMP_RESOURCE;
};
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight);
};
IMPLEMENT_DYNAMIC_CLASS(wxBMPResourceHandler, wxBitmapHandler)
bool wxBMPResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight)
{
// TODO: load colourmap.
/*
M_BITMAPHANDLERDATA->m_hBitmap = (WXHBITMAP) ::LoadBitmap(wxGetInstance(), name);
if (M_BITMAPHANDLERDATA->m_hBitmap)
{
M_BITMAPHANDLERDATA->m_ok = TRUE;
BITMAP bm;
GetObject((HBITMAP) M_BITMAPHANDLERDATA->m_hBitmap, sizeof(BITMAP), (LPSTR) &bm);
M_BITMAPHANDLERDATA->m_width = bm.bmWidth;
M_BITMAPHANDLERDATA->m_height = bm.bmHeight;
M_BITMAPHANDLERDATA->m_depth = bm.bmBitsPixel;
return TRUE;
}
*/
// it's probably not found
wxLogError("Can't load bitmap '%s' from resources! Check .rc file.", name.c_str());
return FALSE;
}
class WXDLLEXPORT wxBMPFileHandler: public wxBitmapHandler
{
DECLARE_DYNAMIC_CLASS(wxBMPFileHandler)
public:
inline wxBMPFileHandler(void)
{
m_name = "Windows bitmap file";
m_extension = "bmp";
m_type = wxBITMAP_TYPE_BMP;
};
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight);
virtual bool SaveFile(wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette = NULL);
};
IMPLEMENT_DYNAMIC_CLASS(wxBMPFileHandler, wxBitmapHandler)
bool wxBMPFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight)
{
#if USE_IMAGE_LOADING_IN_MSW
wxPalette *palette = NULL;
bool success = FALSE;
/*
if (type & wxBITMAP_DISCARD_COLOURMAP)
success = wxLoadIntoBitmap(WXSTRINGCAST name, bitmap);
else
*/
success = (wxLoadIntoBitmap(WXSTRINGCAST name, bitmap, &palette) != 0);
if (!success && palette)
{
delete palette;
palette = NULL;
}
if (palette)
M_BITMAPHANDLERDATA->m_bitmapPalette = *palette;
return success;
#else
return FALSE;
#endif
}
bool wxBMPFileHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int type, const wxPalette *pal)
{
#if USE_IMAGE_LOADING_IN_MSW
wxPalette *actualPalette = (wxPalette *)pal;
if (!actualPalette && (!M_BITMAPHANDLERDATA->m_bitmapPalette.IsNull()))
actualPalette = & (M_BITMAPHANDLERDATA->m_bitmapPalette);
return (wxSaveBitmap(WXSTRINGCAST name, bitmap, actualPalette) != 0);
#else
return FALSE;
#endif
}
void wxBitmap::CleanUpHandlers()
{
wxNode *node = sm_handlers.First();
@@ -419,12 +862,10 @@ void wxBitmap::CleanUpHandlers()
void wxBitmap::InitStandardHandlers()
{
/* TODO: initialize all standard bitmap or derive class handlers here.
AddHandler(new wxBMPResourceHandler);
AddHandler(new wxBMPFileHandler);
AddHandler(new wxXPMFileHandler);
AddHandler(new wxXPMDataHandler);
AddHandler(new wxICOResourceHandler);
AddHandler(new wxICOFileHandler);
*/
AddHandler( new wxPICTResourceHandler ) ;
AddHandler( new wxICONResourceHandler ) ;
AddHandler(new wxXPMFileHandler);
AddHandler(new wxXPMDataHandler);
AddHandler(new wxBMPResourceHandler);
AddHandler(new wxBMPFileHandler);
}

View File

@@ -24,7 +24,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
wxBrushRefData::wxBrushRefData()
{
m_style = wxSOLID;
// TODO: null data
}
wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
@@ -32,14 +31,10 @@ wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
m_style = data.m_style;
m_stipple = data.m_stipple;
m_colour = data.m_colour;
/* TODO: null data
m_hBrush = 0;
*/
}
wxBrushRefData::~wxBrushRefData()
{
// TODO: delete data
}
// Brushes
@@ -134,7 +129,6 @@ void wxBrush::SetStipple(const wxBitmap& Stipple)
bool wxBrush::RealizeResource()
{
// TODO: create the brush
return FALSE;
return TRUE;
}

View File

@@ -19,53 +19,42 @@
IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl)
#endif
#include <wx/mac/uma.h>
// Button
bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint& pos,
const wxSize& size, long style,
const wxValidator& validator,
const wxString& name)
{
SetName(name);
SetValidator(validator);
m_windowStyle = style;
Rect bounds ;
Str255 title ;
m_macHorizontalBorder = 2 ; // additional pixels around the real control
m_macVerticalBorder = 2 ;
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
parent->AddChild((wxButton *)this);
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
kControlPushButtonProc , (long) this ) ;
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
MacPostControlCreate() ;
if (id == -1)
m_windowId = NewControlId();
else
m_windowId = id;
// TODO: create button
return FALSE;
}
void wxButton::SetSize(int x, int y, int width, int height, int sizeFlags)
{
// TODO
return TRUE;
}
void wxButton::SetDefault()
{
wxWindow *parent = (wxWindow *)GetParent();
if (parent)
parent->SetDefaultItem(this);
wxWindow *parent = (wxWindow *)GetParent();
if (parent)
parent->SetDefaultItem(this);
// TODO: make button the default
}
wxString wxButton::GetLabel() const
{
// TODO
return wxString("");
}
void wxButton::SetLabel(const wxString& label)
{
// TODO
if ( m_macControl )
{
UMASetControlData( m_macControl , kControlButtonPart , kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)((Boolean)1) ) ;
}
}
void wxButton::Command (wxCommandEvent & event)
@@ -73,3 +62,10 @@ void wxButton::Command (wxCommandEvent & event)
ProcessCommand (event);
}
void wxButton::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
{
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, m_windowId );
event.SetEventObject(this);
ProcessCommand(event);
}

File diff suppressed because it is too large Load Diff

View File

@@ -7,611 +7,12 @@ resource 'STR#' ( 128 , "Simple Alert Messages" )
"This application needs at least a MacPlus" ,
"This application needs more memory" ,
"This application is out of memory" ,
"This application needs at least System 7" ,
"This application needs at least System 7.5" ,
"About this wxWindows Application" ,
"This application needs Appearance extension (built in with System 8) - this restriction will be relieved in the final release"
}
} ;
data 'alis' (128, "Libs alias") {
$"0000 0000 00CE 0002 0001 0A58 5858 5858"
$"5858 5858 5800 0000 0000 0000 0000 0000"
$"0000 0000 0000 AB9F 536B 4244 0000 0002"
$"EE7C 044C 6962 7300 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0003 1F71 AE82 7707 006A 0016 026C"
$"01A3 0001 0001 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0009 5858 5858 5858"
$"5858 5800 0001 0004 0002 EE7C 0002 0019"
$"5858 5858 5858 5858 5858 5858 5858 5858"
$"5858 5858 5858 5858 5800 FFFF 0000"
};
data 'CSOR' (0) {
$"1441 6476 616E 6365 6420 436F 6E63 6570"
$"7473 2041 47"
};
resource 'FREF' (128) {
'APPL',
0,
""
};
resource 'FREF' (129) {
'shlb',
1,
""
};
resource 'FREF' (130) {
'PLPW',
2,
""
};
resource 'icl4' (128) {
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0666 6666 0000 0000 0000 0006 6666 6660"
$"0666 6666 0000 0000 0000 0006 6666 6660"
$"0666 6660 0000 0000 0000 0000 6666 6660"
$"0666 6660 0000 0006 6000 0000 6666 6660"
$"0666 6660 0000 0666 6600 0000 6666 6660"
$"0666 6660 0000 6606 6600 0000 6666 6660"
$"0666 6660 0000 6606 0000 0000 6666 6660"
$"0666 6600 0000 0666 6000 0000 0666 6660"
$"0666 6600 0000 0006 6600 0000 0666 6660"
$"0666 6600 0000 0006 0060 0000 0666 6660"
$"0666 6660 0000 0006 6600 0000 6666 6660"
$"0666 6660 0000 0666 6000 0000 6666 6660"
$"0666 6666 0000 6606 0000 0006 6666 6660"
$"0666 6666 6000 6606 0000 0066 6666 6660"
$"0666 6666 6000 0666 6600 0066 6666 6660"
$"0666 6666 6600 0006 0600 0666 6666 6660"
$"0666 6666 6600 0006 0000 0666 6666 6660"
$"0666 6666 6660 0006 0000 6666 6666 6660"
$"0666 6666 6666 0006 0006 6666 6666 6660"
$"0666 6666 6666 0006 0006 6666 6666 6660"
$"0666 6666 6666 6006 0066 6666 6666 6660"
$"0666 6666 6666 6006 0066 6666 6666 6660"
$"0666 6666 6666 6006 0066 6666 6666 6660"
$"0666 6666 6666 6606 0666 6666 6666 6660"
$"0666 6666 6666 6606 0666 6666 6666 6660"
$"0666 6666 6666 6606 0666 6666 6666 6660"
$"0666 6666 6666 6606 0666 6666 6666 6660"
$"0666 6666 6666 6660 6666 6666 6666 6660"
$"0666 6666 6666 6666 6666 6666 6666 6660"
$"0666 6666 6666 6666 6666 6666 6666 6660"
$"0666 6666 6666 6666 6666 6666 6666 6660"
};
resource 'icl4' (129, "Editor icon-generic ") {
$"0FFF FFFF FFFF FFFF FFFF FFFF FFFF 0000"
$"F000 0000 0000 0000 0000 0000 000C F000"
$"F0CC CCCC CCCC CCCC CCCC CCCC CCCC F000"
$"F0CC CCCC CCCC CCCC CCCC CCCC CCCC F000"
$"F0CC CCCF FFFF FFFF FFFF FFFF CCCC F000"
$"F0CC CCFD DDDD DDDD DDDD DDDD FCCC F000"
$"F0CC CCFD DDDD DDDF FDDD DDDD FCCC F000"
$"F0CC CFDD DDDD DFFF FFDD DDDD DFCC F000"
$"F0FC CFDD DDDD FFCF FFDD DDDD DFCC F000"
$"FF0F 0FDD DDDD FFCF DDDD DDDD DFCC F0F0"
$"F00F 0FFD DDDD DFFF FDDD DDDD FFCC FFCF"
$"000F 0CFD DDDD DDDF FFDD DDDD FCCC F0CF"
$"000F 0CCF DDDD DDDF DDDD DDDF CCCC CCCF"
$"000F 0CCF FDDD DDDF FFDD DDFC CCCC CCCF"
$"000F 0CCC FDDD DFFF FDDD DDFC CCCC CCCF"
$"000F 0CCC CFDD FFCF DDDD DFCC CCCC CCCF"
$"000F 0CCC CFDD FFCF DDDD DFCC CCCC CCCF"
$"000F 0CCC CCFD DFFF FFDD FCCC CCCC CCCF"
$"000F 0CCC CCFF DDDF DFDF CCCC CCCC CCCF"
$"000F 0CCC CCCF DDDF DDDF CCCC CCCC CCCF"
$"000F 0CCC CCCC FDDF DDFC CCCC CCCC FCCF"
$"F00F 0CCC CCCC FDDF DDFC CCCC CCCC FFCF"
$"FF0F 0CCC CCCC FDDF DDFC CCCC CCCC F0F0"
$"F0F0 CCCC CCCC CFDF DFCC CCCC CCCC F000"
$"F00C CCCC CCCC CFDF DFCC CCCC CCCC F000"
$"F0CC CCCC CCCC CFDF DFCC CCCC CCCC F000"
$"F0CC CCCC CCCC CCFF FCCC CCCC CCCC F000"
$"F0CC CCCC CCCC CCCC CCCC CCCC CCCC F000"
$"F0CC CCCC CCCC CCCC CCCC CCCC CCCC F000"
$"F0CC CCCC CCCC CCCC CCCC CCCC CCCC F000"
$"FCCC CCCC CCCC CCCC CCCC CCCC CCCC F000"
$"0FFF FFFF FFFF FFFF FFFF FFFF FFFF"
};
resource 'icl4' (130, "Editor icon-generic ") {
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"000F FFFF FFFF FFFF FFFF FFFF FFFF F000"
$"000F 0000 0000 0000 0000 0000 0000 F000"
$"000F 0CCC CCCC CCCC CCCC CCCC CCCC F000"
$"FFFF DDDD DDDD DDDD DDDD DDDD DDDD FFFF"
$"F00D 0000 0000 0000 0000 0000 0000 D00F"
$"F0CD 0CFD DDDD DDDD DDDD DDDD FCCC DCCF"
$"F0CD 0CFD DDDD DDDF FDDD DDDD FCCC DCCF"
$"F0CD 0FDD DDDD DFFF FFDD DDDD DFCC DCCF"
$"F0CD 0FDD DDDD FFCF FFDD DDDD DFCC DCCF"
$"F0CD 0FDD DDDD FFCF DDDD DDDD DFCC DCCF"
$"F0CD 0FFD DDDD DFFF FDDD DDDD FFCC DCCF"
$"F0CD 0CFD DDDD DDDF FFDD DDDD FCCC DCCF"
$"F0CD 0CCF DDDD DDDF DDDD DDDF CCCC DCCF"
$"F0CD 0CCF FDDD DDDF FFDD DDFC CCCC DCCF"
$"F0CD 0CCC FDDD DFFF FDDD DDFC CCCC DCCF"
$"F0CD 0CCC CFDD FFCF DDDD DFCC CCCC DCCF"
$"F0CD 0CCC CFDD FFCF DDDD DFCC CCCC DCCF"
$"F0CD 0CCC CCFD DFFF FFDD FCCC CCCC DCCF"
$"F0CD 0CCC CCFF DDDF DFDF CCCC CCCC DCCF"
$"F0CD 0CCC CCCF DDDF DDDF CCCC CCCC DCCF"
$"F0CD 0CCC CCCC FDDF DDFC CCCC CCCC DCCF"
$"F0CD 0CCC CCCC FDDF DDFC CCCC CCCC DCCF"
$"F0CD 0CCC CCCC FDDF DDFC CCCC CCCC DCCF"
$"F0CD 0CCC CCCC CFDF DFCC CCCC CCCC DCCF"
$"F0CD 0CCC CCCC CFDF DFCC CCCC CCCC DCCF"
$"F0CD 0CCC CCCC CFDF DFCC CCCC CCCC DCCF"
$"F0CD DDDD DDDD DDFF FDDD DDDD DDDD FFFF"
$"F0CC CCCC CCCC CCCC CCCC CCCC CCCC F000"
$"F0CC CCCC CCCC CCCC CCCC CCCC CCCC F000"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF F0"
};
resource 'icl8' (128) {
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"00AB ABAB ABAB ABAB 0000 0000 0000 0000"
$"0000 0000 0000 00AB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB 0000 0000 0000 0000"
$"0000 0000 0000 00AB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB AB00 0000 0000 0000 0000"
$"0000 0000 0000 0000 ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB AB00 0000 0000 0000 00AB"
$"AB00 0000 0000 0000 ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB AB00 0000 0000 00AB ABAB"
$"ABAB 0000 0000 0000 ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB AB00 0000 0000 ABAB 00AB"
$"ABAB 0000 0000 0000 ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB AB00 0000 0000 ABAB 00AB"
$"0000 0000 0000 0000 ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB 0000 0000 0000 00AB ABAB"
$"AB00 0000 0000 0000 00AB ABAB ABAB AB00"
$"00AB ABAB ABAB 0000 0000 0000 0000 00AB"
$"ABAB 0000 0000 0000 00AB ABAB ABAB AB00"
$"00AB ABAB ABAB 0000 0000 0000 0000 00AB"
$"0000 AB00 0000 0000 00AB ABAB ABAB AB00"
$"00AB ABAB ABAB AB00 0000 0000 0000 00AB"
$"ABAB 0000 0000 0000 ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB AB00 0000 0000 00AB ABAB"
$"AB00 0000 0000 0000 ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB 0000 0000 ABAB 00AB"
$"0000 0000 0000 00AB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB AB00 0000 ABAB 00AB"
$"0000 0000 0000 ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB AB00 0000 00AB ABAB"
$"ABAB 0000 0000 ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB 0000 0000 00AB"
$"00AB 0000 00AB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB 0000 0000 00AB"
$"0000 0000 00AB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB AB00 0000 00AB"
$"0000 0000 ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB 0000 00AB"
$"0000 00AB ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB 0000 00AB"
$"0000 00AB ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB AB00 00AB"
$"0000 ABAB ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB AB00 00AB"
$"0000 ABAB ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB AB00 00AB"
$"0000 ABAB ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB ABAB 00AB"
$"00AB ABAB ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB ABAB 00AB"
$"00AB ABAB ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB ABAB 00AB"
$"00AB ABAB ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB ABAB 00AB"
$"00AB ABAB ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB ABAB AB00"
$"ABAB ABAB ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB ABAB ABAB"
$"ABAB ABAB ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB ABAB ABAB"
$"ABAB ABAB ABAB ABAB ABAB ABAB ABAB AB00"
$"00AB ABAB ABAB ABAB ABAB ABAB ABAB ABAB"
$"ABAB ABAB ABAB ABAB ABAB ABAB ABAB AB"
};
resource 'icl8' (130, "Editor icon-generic ") {
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 0000 0000"
$"0000 00FF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FF00 0000"
$"0000 00FF 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 00F5 FF00 0000"
$"0000 00FF F5F6 F6F6 F6F6 F6F6 F6F6 F6F6"
$"F6F6 F6F6 F6F6 F6F6 F6F6 F6F8 FF00 0000"
$"FFFF FFFF F9F9 F9F9 F9F9 F9F9 F9F9 F9F9"
$"F9F9 F9F9 F9F9 F9F9 F9F9 F9F9 FFFF FFFF"
$"FF00 F5F9 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 0000 F9F5 00FF"
$"FF00 F6F9 002B FFF9 F9F9 F9F9 F9F9 F9F9"
$"F9F9 F9F9 F9F9 F9F9 FF2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B FFF9 F9F9 F9F9 F9F9 F9FF"
$"FFF9 F9F9 F9F9 F9F9 FF2B 2BF8 F92B F8FF"
$"FF00 F6F9 00FF F9F9 F9F9 F9F9 F9FF FFFF"
$"FFFF F9F9 F9F9 F9F9 F9FF 2BF8 F92B F8FF"
$"FF00 F6F9 00FF F9F9 F9F9 F9F9 FFFF 2BFF"
$"FFFF F9F9 F9F9 F9F9 F9FF 2BF8 F92B F8FF"
$"FF00 F6F9 00FF F9F9 F9F9 F9F9 FFFF 2BFF"
$"F9F9 F9F9 F9F9 F9F9 F9FF 2BF8 F92B F8FF"
$"FF00 F6F9 00FF FFF9 F9F9 F9F9 F9FF FFFF"
$"FFF9 F9F9 F9F9 F9F9 FFFF 2BF8 F92B F8FF"
$"FF00 F6F9 002B FFF9 F9F9 F9F9 F9F9 F9FF"
$"FFFF F9F9 F9F9 F9F9 FF2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2BFF F9F9 F9F9 F9F9 F9FF"
$"F9F9 F9F9 F9F9 F9FF 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2BFF FFF9 F9F9 F9F9 F9FF"
$"FFFF F9F9 F9F9 FF2B 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2B2B FFF9 F9F9 F9FF FFFF"
$"FFF9 F9F9 F9F9 FF2B 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2B2B 2BFF F9F9 FFFF 2BFF"
$"F9F9 F9F9 F9FF 2B2B 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2B2B 2BFF F9F9 FFFF 2BFF"
$"F9F9 F9F9 F9FF 2B2B 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2B2B 2B2B FFF9 F9FF FFFF"
$"FFFF F9F9 FF2B 2B2B 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2B2B 2B2B FFFF F9F9 F9FF"
$"F9FF F9FF 2B2B 2B2B 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2B2B 2B2B 2BFF F9F9 F9FF"
$"F9F9 F9FF 2B2B 2B2B 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2B2B 2B2B 2B2B FFF9 F9FF"
$"F9F9 FF2B 2B2B 2B2B 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2B2B 2B2B 2B2B FFF9 F9FF"
$"F9F9 FF2B 2B2B 2B2B 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2B2B 2B2B 2B2B FFF9 F9FF"
$"F9F9 FF2B 2B2B 2B2B 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2B2B 2B2B 2B2B 2BFF F9FF"
$"F9FF 2B2B 2B2B 2B2B 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 002B 2B2B 2B2B 2B2B 2BFF F9FF"
$"F9FF 2B2B 2B2B 2B2B 2B2B 2BF8 F92B F8FF"
$"FF00 F6F9 00F8 F82B 2B2B 2B2B 2BFF F9FF"
$"F9FF 2B2B 2B2B 2B2B F8F8 F8F8 F9F7 F8FF"
$"FF00 F6F9 F9F9 F9F9 F9F9 F9F9 F9F9 FFFF"
$"FFF9 F9F9 F9F9 F9F9 F9F9 F9F9 FFFF FFFF"
$"FF00 F62B 2B2B 2B2B 2B2B 2B2B 2B2B 2B2B"
$"2B2B 2B2B 2B2B 2B2B 2B2B 2BF8 FF00 0000"
$"FFF5 F8F8 F8F8 F8F8 F8F8 F8F8 F8F8 F8F8"
$"F8F8 F8F8 F8F8 F8F8 F8F8 F8F8 FF00 0000"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FF"
};
resource 'icl8' (129) {
$"00FF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF 0000 0000"
$"FF00 0000 0000 0000 0000 0000 0000 0000"
$"0000 0000 0000 0000 0000 00F6 FF00 0000"
$"FF00 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6"
$"F6F6 F6F6 F6F6 F6F6 F6F6 F6F7 FF00 0000"
$"FF00 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6"
$"F6F6 F6F6 F6F6 F6F6 F6F6 F6F7 FF00 0000"
$"FF00 F6F6 F6F6 F6FF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF F6F6 F6F7 FF00 0000"
$"FF00 F6F6 F62B FFF9 F9F9 F9F9 F9F9 F9F9"
$"F9F9 F9F9 F9F9 F9F9 FF2B F6F7 FF00 0000"
$"FF00 F6F6 F62B FFF9 F9F9 F9F9 F9F9 F9FF"
$"FFF9 F9F9 F9F9 F9F9 FF2B F6F7 FF00 0000"
$"FF00 F7F6 F6FF F9F9 F9F9 F9F9 F9FF FFFF"
$"FFFF F9F9 F9F9 F9F9 F9FF F6F7 FF00 0000"
$"FF00 FFF7 F6FF F9F9 F9F9 F9F9 FFFF 2BFF"
$"FFFF F9F9 F9F9 F9F9 F9FF F6F7 FF00 0000"
$"FFFF 00FF 00FF F9F9 F9F9 F9F9 FFFF 2BFF"
$"F9F9 F9F9 F9F9 F9F9 F9FF F6F7 FF00 FF00"
$"FF00 00FF 00FF FFF9 F9F9 F9F9 F9FF FFFF"
$"FFF9 F9F9 F9F9 F9F9 FFFF F6F7 FFFF F7FF"
$"0000 00FF 00F6 FFF9 F9F9 F9F9 F9F9 F9FF"
$"FFFF F9F9 F9F9 F9F9 FFF6 F6F7 FF00 F7FF"
$"0000 00FF 00F6 F6FF F9F9 F9F9 F9F9 F9FF"
$"F9F9 F9F9 F9F9 F9FF F6F6 F6F6 F6F6 F7FF"
$"0000 00FF 00F6 F6FF FFF9 F9F9 F9F9 F9FF"
$"FFFF F9F9 F9F9 FFF6 F6F6 F6F6 F6F6 F7FF"
$"0000 00FF 00F6 F6F6 FFF9 F9F9 F9FF FFFF"
$"FFF9 F9F9 F9F9 FFF6 F6F6 F6F6 F6F6 F7FF"
$"0000 00FF 00F6 F6F6 F6FF F9F9 FFFF 2BFF"
$"F9F9 F9F9 F9FF F6F6 F6F6 F6F6 F6F6 F7FF"
$"0000 00FF 00F6 F6F6 F6FF F9F9 FFFF 2BFF"
$"F9F9 F9F9 F9FF F6F6 F6F6 F6F6 F6F6 F7FF"
$"0000 00FF 00F6 F6F6 F6F6 FFF9 F9FF FFFF"
$"FFFF F9F9 FFF6 F6F6 F6F6 F6F6 F6F6 F7FF"
$"0000 00FF 00F6 F6F6 F6F6 FFFF F9F9 F9FF"
$"F9FF F9FF F6F6 F6F6 F6F6 F6F6 F6F6 F7FF"
$"0000 00FF 00F6 F6F6 F6F6 F6FF F9F9 F9FF"
$"F9F9 F9FF F6F6 F6F6 F6F6 F6F6 F7F6 F7FF"
$"0000 00FF 00F6 F6F6 F6F6 F6F6 FFF9 F9FF"
$"F9F9 FFF6 F6F6 F6F6 F6F6 F6F7 FFF7 F7FF"
$"FF00 00FF 00F6 F6F6 F6F6 F6F6 FFF9 F9FF"
$"F9F9 FFF6 F6F6 F6F6 F6F6 F6F7 FFFF F7FF"
$"FFFF 00FF 00F6 F6F6 F6F6 F6F6 FFF9 F9FF"
$"F9F9 FFF6 F6F6 F6F6 F6F6 F6F7 FF00 FF00"
$"FF00 FF00 F6F6 F6F6 F6F6 F6F6 F6FF F9FF"
$"F9FF F6F6 F6F6 F6F6 F6F6 F6F7 FF00 0000"
$"FF00 00F6 F6F6 F6F6 F6F6 F6F6 F6FF F9FF"
$"F9FF F6F6 F6F6 F6F6 F6F6 F6F7 FF00 0000"
$"FF00 F6F6 F6F6 F6F6 F6F6 F6F6 F6FF F9FF"
$"F9FF F6F6 F6F6 F6F6 F6F6 F6F7 FF00 0000"
$"FF00 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6 FFFF"
$"FFF6 F6F6 F6F6 F6F6 F6F6 F6F7 FF00 0000"
$"FF00 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6"
$"F6F6 F6F6 F6F6 F6F6 F6F6 F6F7 FF00 0000"
$"FF00 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6"
$"F6F6 F6F6 F6F6 F6F6 F6F6 F6F7 FF00 0000"
$"FF00 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6 F6F6"
$"F6F6 F6F6 F6F6 F6F6 F6F6 F6F7 FF00 0000"
$"FFF6 F7F7 F7F7 F7F7 F7F7 F7F7 F7F7 F7F7"
$"F7F7 F7F7 F7F7 F7F7 F7F7 F7F7 FF00 0000"
$"00FF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF"
};
resource 'icm#' (129) {
{ /* array: 2 elements */
/* [1] */
$"",
/* [2] */
$""
}
};
resource 'icm#' (128) {
{ /* array: 2 elements */
/* [1] */
$"",
/* [2] */
$""
}
};
resource 'icm#' (130) {
{ /* array: 2 elements */
/* [1] */
$"",
/* [2] */
$""
}
};
resource 'icm4' (129) {
$""
};
resource 'icm4' (128) {
$""
};
resource 'icm4' (130) {
$""
};
resource 'icm8' (129) {
$""
};
resource 'icm8' (128) {
$""
};
resource 'icm8' (130) {
$""
};
resource 'ICN#' (128) {
{ /* array: 2 elements */
/* [1] */
$"0000 0000 7F00 01FE 7F00 01FE 7E00 00FE"
$"7E01 80FE 7E07 C0FE 7E0D C0FE 7E0D 00FE"
$"7C07 807E 7C01 C07E 7C01 207E 7E01 C0FE"
$"7E07 80FE 7F0D 01FE 7F8D 03FE 7F87 C3FE"
$"7FC1 47FE 7FC1 07FE 7FE1 0FFE 7FF1 1FFE"
$"7FF1 1FFE 7FF9 3FFE 7FF9 3FFE 7FF9 3FFE"
$"7FFD 7FFE 7FFD 7FFE 7FFD 7FFE 7FFD 7FFE"
$"7FFE FFFE 7FFF FFFE 7FFF FFFE 7FFF FFFE",
/* [2] */
$"0000 0000 7F00 01FE 7F00 01FE 7E00 00FE"
$"7E01 80FE 7E07 C0FE 7E0D C0FE 7E0D 00FE"
$"7C07 807E 7C01 C07E 7C01 207E 7E01 C0FE"
$"7E07 80FE 7F0D 01FE 7F8D 03FE 7F87 C3FE"
$"7FC1 47FE 7FC1 07FE 7FE1 0FFE 7FF1 1FFE"
$"7FF1 1FFE 7FF9 3FFE 7FF9 3FFE 7FF9 3FFE"
$"7FFD 7FFE 7FFD 7FFE 7FFD 7FFE 7FFD 7FFE"
$"7FFE FFFE 7FFF FFFE 7FFF FFFE 7FFF FFFE"
}
};
resource 'ICN#' (129, "Editor icon-generic ") {
{ /* array: 2 elements */
/* [1] */
$"7FFF FFF0 8000 0008 8000 0008 8000 0008"
$"82AA AA88 8200 0088 8200 0088 8201 8088"
$"A407 C048 D40D C04A 940D 004D 1607 80C9"
$"1201 C081 1101 0101 1181 C201 1087 8201"
$"104D 0401 104D 0401 1027 C801 1031 5001"
$"1011 1009 9009 200D D009 200A A009 2008"
$"8005 4008 8005 4008 8005 4008 8003 8008"
$"8000 0008 8000 0008 8000 0008 7FFF FFF0",
/* [2] */
$"0000 0000 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFF8 FFFF FFF8 FFFF FFF8"
}
};
resource 'ICN#' (130, "Editor icon-generic ") {
{ /* array: 2 elements */
/* [1] */
$"0000 0000 1FFF FFF8 1000 0008 1000 0008"
$"FAAA AAAF 9200 00A1 8200 0089 9201 8081"
$"8407 C049 940D C041 840D 0049 9607 80C1"
$"8201 C089 9101 0101 8181 C209 9087 8201"
$"804D 0409 904D 0401 8027 C809 9031 5001"
$"8011 1009 9009 2001 8009 2009 9009 2001"
$"8005 4009 9005 4001 8005 4009 9557 D55F"
$"8000 0008 8000 0008 FFFF FFF8",
/* [2] */
$"0000 0000 1FFF FFF8 1FFF FFF8 1FFF FFF8"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFF8 FFFF FFF8 FFFF FFF8"
}
};
resource 'ics#' (129, "Editor icon-generic ") {
{ /* array: 2 elements */
/* [1] */
$"3FFC 2004 E007 8001 8001 8001 8001 8001"
$"8001 8001 8001 8001 8001 8007 8004 FFFC",
/* [2] */
$"3FFC 3FFC FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFC FFFC"
}
};
resource 'ics#' (128) {
{ /* array: 2 elements */
/* [1] */
$"",
/* [2] */
$""
}
};
resource 'ics#' (130, "Editor icon-generic ") {
{ /* array: 2 elements */
/* [1] */
$"3FFC 2004 E007 8001 8001 8001 8001 8001"
$"8001 8001 8001 8001 8001 8007 8004 FFFC",
/* [2] */
$"3FFC 3FFC FFFF FFFF FFFF FFFF FFFF FFFF"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFC FFFC"
}
};
resource 'ics4' (129, "Editor icon-generic ") {
$"00FF FFFF FFFF FF00 00F0 0000 0000 CF00"
$"FFFD DDDD DDDD DFFF F0D0 0000 0000 CDCF"
$"F0D0 CCCC CCCC CDCF F0D0 CCCC CCCC CDCF"
$"F0D0 CCCC CCCC CDCF F0D0 CCCC CCCC CDCF"
$"F0D0 CCCC CCCC CDCF F0D0 CCCC CCCC CDCF"
$"F0D0 CCCC CCCC CDCF F0D0 CCCC CCCC CDCF"
$"F0DC CCCC CCCC CDCF F0DD DDDD DDDD DFFF"
$"FCCC CCCC CCCC CF00 FFFF FFFF FFFF FF"
};
resource 'ics4' (128) {
$""
};
resource 'ics4' (130, "Editor icon-generic ") {
$"00FF FFFF FFFF FF00 00F0 0000 0000 CF00"
$"FFFD DDDD DDDD DFFF F0D0 0000 0000 CDCF"
$"F0D0 CCCC CCCC CDCF F0D0 CCCC CCCC CDCF"
$"F0D0 CCCC CCCC CDCF F0D0 CCCC CCCC CDCF"
$"F0D0 CCCC CCCC CDCF F0D0 CCCC CCCC CDCF"
$"F0D0 CCCC CCCC CDCF F0D0 CCCC CCCC CDCF"
$"F0DC CCCC CCCC CDCF F0DD DDDD DDDD DFFF"
$"FCCC CCCC CCCC CF00 FFFF FFFF FFFF FF"
};
resource 'ics8' (129, "Editor icon-generic ") {
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF 0000"
$"0000 FFF5 F5F5 F5F5 F5F5 F5F5 F6FF 0000"
$"FFFF FFF9 F9F9 F9F9 F9F9 F9F9 F9FF FFFF"
$"FFF5 F9F5 F5F5 F5F5 F5F5 F5F5 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F92B 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F9 F9F9 F9F9 F9F9 F9F9 F9FF FFFF"
$"FFF6 F8F8 F8F8 F8F8 F8F8 F8F8 F8FF 0000"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
};
resource 'ics8' (128) {
$""
};
resource 'ics8' (130, "Editor icon-generic ") {
$"0000 FFFF FFFF FFFF FFFF FFFF FFFF 0000"
$"0000 FFF5 F5F5 F5F5 F5F5 F5F5 F6FF 0000"
$"FFFF FFF9 F9F9 F9F9 F9F9 F9F9 F9FF FFFF"
$"FFF5 F9F5 F5F5 F5F5 F5F5 F5F5 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F5 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F92B 2B2B 2B2B 2B2B 2B2B 2BF9 F8FF"
$"FFF5 F9F9 F9F9 F9F9 F9F9 F9F9 F9FF FFFF"
$"FFF6 F8F8 F8F8 F8F8 F8F8 F8F8 F8FF 0000"
$"FFFF FFFF FFFF FFFF FFFF FFFF FFFF"
};
data 'iSNP' (129) {
$"0000" /* .. */
};
data 'iSNP' (128) {
$"0000" /* .. */
};
data 'iSNP' (130) {
$"0000" /* .. */
};
resource 'BNDL' (128) {
'CSOR',
0,
{ /* array TypeArray: 2 elements */
/* [1] */
'ICN#',
{ /* array IDArray: 3 elements */
/* [1] */
0, 128,
/* [2] */
1, 129,
/* [3] */
2, 130
},
/* [2] */
'FREF',
{ /* array IDArray: 3 elements */
/* [1] */
0, 128,
/* [2] */
1, 129,
/* [3] */
2, 130
}
}
};
resource 'MENU' (1, preload)
{
1, textMenuProc, 0b11111111111111111111111111111110 , enabled, apple ,
@@ -624,3 +25,4 @@ resource 'MENU' (1, preload)
resource 'MBAR' (1,preload)
{
{ 1 } ;
} ;

View File

@@ -20,11 +20,83 @@
#include "wx/icon.h"
#include "wx/log.h"
extern "C"
{
#include "xpm.h"
} ;
#if !USE_SHARED_LIBRARIES
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
#endif
#include <PictUtils.h>
CTabHandle wxMacCreateColorTable( int numColors )
{
CTabHandle newColors; /* Handle to the new color table */
short index; /* Index into the table of colors */
/* Allocate memory for the color table */
newColors = (CTabHandle)NewHandleClear( sizeof (ColorTable) +
sizeof (ColorSpec) * (numColors - 1) );
if (newColors != nil)
{
/* Initialize the fields */
(**newColors).ctSeed = GetCTSeed();
(**newColors).ctFlags = 0;
(**newColors).ctSize = numColors - 1;
/* Initialize the table of colors */
}
return newColors ;
}
void wxMacDestroyColorTable( CTabHandle colors )
{
DisposeHandle( (Handle) colors ) ;
}
void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue )
{
(**newColors).ctTable[index].value = index;
(**newColors).ctTable[index].rgb.red = 0 ;// someRedValue;
(**newColors).ctTable[index].rgb.green = 0 ; // someGreenValue;
(**newColors).ctTable[index].rgb.blue = 0 ; // someBlueValue;
}
GWorldPtr wxMacCreateGWorld( int height , int width , int depth )
{
OSErr err = noErr ;
GWorldPtr port ;
Rect rect = { 0 , 0 , width , height } ;
if ( depth < 0 )
{
// get max pixel depth
CGrafPtr port ;
GetCWMgrPort( &port ) ;
GDHandle maxDevice ;
maxDevice = GetMaxDevice( &port->portRect ) ;
if ( maxDevice )
depth = (**((**maxDevice).gdPMap)).pixelSize ;
else
depth = 8 ;
}
err = NewGWorld( &port , depth , &rect , NULL , NULL , 0 ) ;
if ( err == noErr )
{
return port ;
}
return NULL ;
}
void wxMacDestroyGWorld( GWorldPtr gw )
{
if ( gw )
DisposeGWorld( gw ) ;
}
wxBitmapRefData::wxBitmapRefData()
{
m_ok = FALSE;
@@ -34,17 +106,43 @@ wxBitmapRefData::wxBitmapRefData()
m_quality = 0;
m_numColors = 0;
m_bitmapMask = NULL;
m_hBitmap = NULL ;
m_hPict = NULL ;
m_bitmapType = kMacBitmapTypeUnknownType ;
}
wxBitmapRefData::~wxBitmapRefData()
{
/*
* TODO: delete the bitmap data here.
*/
if (m_bitmapMask)
delete m_bitmapMask;
switch (m_bitmapType)
{
case kMacBitmapTypePict :
{
if ( m_hPict )
{
KillPicture( m_hPict ) ;
m_hPict = NULL ;
}
}
break ;
case kMacBitmapTypeGrafWorld :
{
if ( m_hBitmap )
{
wxMacDestroyGWorld( m_hBitmap ) ;
m_hBitmap = NULL ;
}
}
break ;
default :
// unkown type ?
break ;
} ;
if (m_bitmapMask)
{
delete m_bitmapMask;
m_bitmapMask = NULL;
}
}
wxList wxBitmap::sm_handlers;
@@ -71,8 +169,57 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
M_BITMAPDATA->m_height = the_height ;
M_BITMAPDATA->m_depth = no_bits ;
M_BITMAPDATA->m_numColors = 0;
/* TODO: create the bitmap from data */
if ( no_bits == 1 )
{
M_BITMAPDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
M_BITMAPDATA->m_hBitmap = wxMacCreateGWorld( the_width , the_height , no_bits ) ;
M_BITMAPDATA->m_ok = (M_BITMAPDATA->m_hBitmap != NULL ) ;
CGrafPtr origPort ;
GDHandle origDevice ;
GetGWorld( &origPort , &origDevice ) ;
SetGWorld( M_BITMAPDATA->m_hBitmap , NULL ) ;
// bits is a word aligned array
unsigned char* linestart = (unsigned char*) bits ;
int linesize = ( the_width / 16 ) * 2 ;
if ( the_width % 16 )
{
linesize += 2 ;
} ;
RGBColor colors[2] = {
{ 0xFFFF , 0xFFFF , 0xFFFF } ,
{ 0, 0 , 0 }
} ;
for( int y = 0 ; y < the_height ; ++y , linestart += linesize )
{
for( int x = 0 ; x < the_width ; ++x )
{
int index = x / 8 ;
int bit = x % 8 ;
int mask = 1 << bit ;
if ( linestart[index] & mask )
{
SetCPixel( x , y , &colors[1] ) ;
}
else
{
SetCPixel( x , y , &colors[0] ) ;
}
}
}
SetGWorld( origPort , origDevice ) ;
}
else
{
//multicolor BITMAPs not yet implemented
}
if ( wxTheBitmapList )
wxTheBitmapList->AddBitmap(this);
@@ -102,13 +249,10 @@ wxBitmap::wxBitmap(const wxString& filename, long type)
wxTheBitmapList->AddBitmap(this);
}
/* TODO: maybe allow creation from XPM
// Create from data
wxBitmap::wxBitmap(const char **data)
{
(void) Create((void *)data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
}
*/
bool wxBitmap::Create(int w, int h, int d)
{
@@ -120,11 +264,19 @@ bool wxBitmap::Create(int w, int h, int d)
M_BITMAPDATA->m_height = h;
M_BITMAPDATA->m_depth = d;
/* TODO: create new bitmap */
M_BITMAPDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
M_BITMAPDATA->m_hBitmap = wxMacCreateGWorld( w , h , d ) ;
M_BITMAPDATA->m_ok = (M_BITMAPDATA->m_hBitmap != NULL ) ;
return M_BITMAPDATA->m_ok;
}
void wxBitmap::SetHBITMAP(WXHBITMAP bmp)
{
M_BITMAPDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
M_BITMAPDATA->m_hBitmap = bmp ;
M_BITMAPDATA->m_ok = (M_BITMAPDATA->m_hBitmap != NULL ) ;
}
bool wxBitmap::LoadFile(const wxString& filename, long type)
{
UnRef();
@@ -386,6 +538,52 @@ bool wxBitmapHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int type,
* Standard handlers
*/
class WXDLLEXPORT wxPICTResourceHandler: public wxBitmapHandler
{
DECLARE_DYNAMIC_CLASS(wxPICTResourceHandler)
public:
inline wxPICTResourceHandler()
{
m_name = "Macintosh Pict resource";
m_extension = "";
m_type = wxBITMAP_TYPE_PICT_RESOURCE;
};
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight);
};
IMPLEMENT_DYNAMIC_CLASS(wxPICTResourceHandler, wxBitmapHandler)
bool wxPICTResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight)
{
Str255 theName ;
strcpy( (char*) theName , name ) ;
c2pstr( (char*) theName ) ;
PicHandle thePict = (PicHandle ) GetNamedResource( 'PICT' , theName ) ;
if ( thePict )
{
PictInfo theInfo ;
GetPictInfo( thePict , &theInfo , 0 , 0 , systemMethod , 0 ) ;
DetachResource( (Handle) thePict ) ;
M_BITMAPHANDLERDATA->m_bitmapType = kMacBitmapTypePict ;
M_BITMAPHANDLERDATA->m_hPict = thePict ;
M_BITMAPHANDLERDATA->m_width = theInfo.sourceRect.right - theInfo.sourceRect.left ;
M_BITMAPHANDLERDATA->m_height = theInfo.sourceRect.bottom - theInfo.sourceRect.top ;
M_BITMAPHANDLERDATA->m_depth = theInfo.depth ;
M_BITMAPHANDLERDATA->m_ok = true ;
M_BITMAPHANDLERDATA->m_numColors = theInfo.uniqueColors ;
// M_BITMAPHANDLERDATA->m_bitmapPalette;
// M_BITMAPHANDLERDATA->m_quality;
return TRUE ;
}
return FALSE ;
}
/* TODO: bitmap handlers, a bit like this:
class WXDLLEXPORT wxBMPResourceHandler: public wxBitmapHandler
{
@@ -404,6 +602,251 @@ public:
IMPLEMENT_DYNAMIC_CLASS(wxBMPResourceHandler, wxBitmapHandler)
*/
class WXDLLEXPORT wxXPMFileHandler: public wxBitmapHandler
{
DECLARE_DYNAMIC_CLASS(wxXPMFileHandler)
public:
inline wxXPMFileHandler(void)
{
m_name = "XPM bitmap file";
m_extension = "xpm";
m_type = wxBITMAP_TYPE_XPM;
};
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth = -1, int desiredHeight = -1);
virtual bool SaveFile(wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette = NULL);
};
IMPLEMENT_DYNAMIC_CLASS(wxXPMFileHandler, wxBitmapHandler)
bool wxXPMFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight)
{
#if USE_XPM_IN_MSW
XImage *ximage;
XpmAttributes xpmAttr;
HDC dc;
M_BITMAPHANDLERDATA->m_ok = FALSE;
dc = CreateCompatibleDC(NULL);
if (dc)
{
xpmAttr.valuemask = XpmReturnPixels;
int errorStatus = XpmReadFileToImage(&dc, WXSTRINGCAST name, &ximage, (XImage **) NULL, &xpmAttr);
DeleteDC(dc);
if (errorStatus == XpmSuccess)
{
M_BITMAPHANDLERDATA->m_hBitmap = (WXHBITMAP) ximage->bitmap;
BITMAP bm;
GetObject((HBITMAP)M_BITMAPHANDLERDATA->m_hBitmap, sizeof(bm), (LPSTR) & bm);
M_BITMAPHANDLERDATA->m_width = (bm.bmWidth);
M_BITMAPHANDLERDATA->m_height = (bm.bmHeight);
M_BITMAPHANDLERDATA->m_depth = (bm.bmPlanes * bm.bmBitsPixel);
M_BITMAPHANDLERDATA->m_numColors = xpmAttr.npixels;
XpmFreeAttributes(&xpmAttr);
XImageFree(ximage);
M_BITMAPHANDLERDATA->m_ok = TRUE;
return TRUE;
}
else
{
M_BITMAPHANDLERDATA->m_ok = FALSE;
return FALSE;
}
}
#endif
return FALSE;
}
bool wxXPMFileHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette)
{
#if USE_XPM_IN_MSW
HDC dc = NULL;
Visual *visual = NULL;
XImage ximage;
dc = CreateCompatibleDC(NULL);
if (dc)
{
if (SelectObject(dc, (HBITMAP) M_BITMAPHANDLERDATA->m_hBitmap))
{ /* for following SetPixel */
/* fill the XImage struct 'by hand' */
ximage.width = M_BITMAPHANDLERDATA->m_width;
ximage.height = M_BITMAPHANDLERDATA->m_height;
ximage.depth = M_BITMAPHANDLERDATA->m_depth;
ximage.bitmap = (void *)M_BITMAPHANDLERDATA->m_hBitmap;
int errorStatus = XpmWriteFileFromImage(&dc, WXSTRINGCAST name,
&ximage, (XImage *) NULL, (XpmAttributes *) NULL);
if (dc)
DeleteDC(dc);
if (errorStatus == XpmSuccess)
return TRUE; /* no error */
else
return FALSE;
} else return FALSE;
} else return FALSE;
#else
return FALSE;
#endif
}
class WXDLLEXPORT wxXPMDataHandler: public wxBitmapHandler
{
DECLARE_DYNAMIC_CLASS(wxXPMDataHandler)
public:
inline wxXPMDataHandler(void)
{
m_name = "XPM bitmap data";
m_extension = "xpm";
m_type = wxBITMAP_TYPE_XPM_DATA;
};
virtual bool Create(wxBitmap *bitmap, void *data, long flags, int width, int height, int depth = 1);
};
IMPLEMENT_DYNAMIC_CLASS(wxXPMDataHandler, wxBitmapHandler)
bool wxXPMDataHandler::Create(wxBitmap *bitmap, void *data, long flags, int width, int height, int depth)
{
XImage * ximage;
int ErrorStatus;
XpmAttributes xpmAttr;
xpmAttr.valuemask = XpmReturnInfos; // get infos back
ErrorStatus = XpmCreateImageFromData( GetMainDevice() , (char **)data,
&ximage, (XImage **) NULL, &xpmAttr);
if (ErrorStatus == XpmSuccess)
{
M_BITMAPHANDLERDATA->m_ok = FALSE;
M_BITMAPHANDLERDATA->m_numColors = 0;
M_BITMAPHANDLERDATA->m_hBitmap = ximage->gworldptr ;
M_BITMAPHANDLERDATA->m_width = ximage->width;
M_BITMAPHANDLERDATA->m_height = ximage->height;
M_BITMAPHANDLERDATA->m_depth = ximage->depth;
M_BITMAPHANDLERDATA->m_numColors = xpmAttr.npixels;
XpmFreeAttributes(&xpmAttr);
M_BITMAPHANDLERDATA->m_ok = TRUE;
ximage->gworldptr = NULL ;
XImageFree(ximage); // releases the malloc, but does not detroy
// the bitmap
M_BITMAPHANDLERDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
return TRUE;
}
else
{
M_BITMAPHANDLERDATA->m_ok = FALSE;
return FALSE;
}
return FALSE;
}
class WXDLLEXPORT wxBMPResourceHandler: public wxBitmapHandler
{
DECLARE_DYNAMIC_CLASS(wxBMPResourceHandler)
public:
inline wxBMPResourceHandler()
{
m_name = "Windows bitmap resource";
m_extension = "";
m_type = wxBITMAP_TYPE_BMP_RESOURCE;
};
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight);
};
IMPLEMENT_DYNAMIC_CLASS(wxBMPResourceHandler, wxBitmapHandler)
bool wxBMPResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight)
{
// TODO: load colourmap.
/*
M_BITMAPHANDLERDATA->m_hBitmap = (WXHBITMAP) ::LoadBitmap(wxGetInstance(), name);
if (M_BITMAPHANDLERDATA->m_hBitmap)
{
M_BITMAPHANDLERDATA->m_ok = TRUE;
BITMAP bm;
GetObject((HBITMAP) M_BITMAPHANDLERDATA->m_hBitmap, sizeof(BITMAP), (LPSTR) &bm);
M_BITMAPHANDLERDATA->m_width = bm.bmWidth;
M_BITMAPHANDLERDATA->m_height = bm.bmHeight;
M_BITMAPHANDLERDATA->m_depth = bm.bmBitsPixel;
return TRUE;
}
*/
// it's probably not found
wxLogError("Can't load bitmap '%s' from resources! Check .rc file.", name.c_str());
return FALSE;
}
class WXDLLEXPORT wxBMPFileHandler: public wxBitmapHandler
{
DECLARE_DYNAMIC_CLASS(wxBMPFileHandler)
public:
inline wxBMPFileHandler(void)
{
m_name = "Windows bitmap file";
m_extension = "bmp";
m_type = wxBITMAP_TYPE_BMP;
};
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight);
virtual bool SaveFile(wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette = NULL);
};
IMPLEMENT_DYNAMIC_CLASS(wxBMPFileHandler, wxBitmapHandler)
bool wxBMPFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight)
{
#if USE_IMAGE_LOADING_IN_MSW
wxPalette *palette = NULL;
bool success = FALSE;
/*
if (type & wxBITMAP_DISCARD_COLOURMAP)
success = wxLoadIntoBitmap(WXSTRINGCAST name, bitmap);
else
*/
success = (wxLoadIntoBitmap(WXSTRINGCAST name, bitmap, &palette) != 0);
if (!success && palette)
{
delete palette;
palette = NULL;
}
if (palette)
M_BITMAPHANDLERDATA->m_bitmapPalette = *palette;
return success;
#else
return FALSE;
#endif
}
bool wxBMPFileHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int type, const wxPalette *pal)
{
#if USE_IMAGE_LOADING_IN_MSW
wxPalette *actualPalette = (wxPalette *)pal;
if (!actualPalette && (!M_BITMAPHANDLERDATA->m_bitmapPalette.IsNull()))
actualPalette = & (M_BITMAPHANDLERDATA->m_bitmapPalette);
return (wxSaveBitmap(WXSTRINGCAST name, bitmap, actualPalette) != 0);
#else
return FALSE;
#endif
}
void wxBitmap::CleanUpHandlers()
{
wxNode *node = sm_handlers.First();
@@ -419,12 +862,10 @@ void wxBitmap::CleanUpHandlers()
void wxBitmap::InitStandardHandlers()
{
/* TODO: initialize all standard bitmap or derive class handlers here.
AddHandler(new wxBMPResourceHandler);
AddHandler(new wxBMPFileHandler);
AddHandler(new wxXPMFileHandler);
AddHandler(new wxXPMDataHandler);
AddHandler(new wxICOResourceHandler);
AddHandler(new wxICOFileHandler);
*/
AddHandler( new wxPICTResourceHandler ) ;
AddHandler( new wxICONResourceHandler ) ;
AddHandler(new wxXPMFileHandler);
AddHandler(new wxXPMDataHandler);
AddHandler(new wxBMPResourceHandler);
AddHandler(new wxBMPFileHandler);
}

View File

@@ -24,7 +24,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
wxBrushRefData::wxBrushRefData()
{
m_style = wxSOLID;
// TODO: null data
}
wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
@@ -32,14 +31,10 @@ wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
m_style = data.m_style;
m_stipple = data.m_stipple;
m_colour = data.m_colour;
/* TODO: null data
m_hBrush = 0;
*/
}
wxBrushRefData::~wxBrushRefData()
{
// TODO: delete data
}
// Brushes
@@ -134,7 +129,6 @@ void wxBrush::SetStipple(const wxBitmap& Stipple)
bool wxBrush::RealizeResource()
{
// TODO: create the brush
return FALSE;
return TRUE;
}

View File

@@ -19,53 +19,42 @@
IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl)
#endif
#include <wx/mac/uma.h>
// Button
bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint& pos,
const wxSize& size, long style,
const wxValidator& validator,
const wxString& name)
{
SetName(name);
SetValidator(validator);
m_windowStyle = style;
Rect bounds ;
Str255 title ;
m_macHorizontalBorder = 2 ; // additional pixels around the real control
m_macVerticalBorder = 2 ;
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
parent->AddChild((wxButton *)this);
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
kControlPushButtonProc , (long) this ) ;
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
MacPostControlCreate() ;
if (id == -1)
m_windowId = NewControlId();
else
m_windowId = id;
// TODO: create button
return FALSE;
}
void wxButton::SetSize(int x, int y, int width, int height, int sizeFlags)
{
// TODO
return TRUE;
}
void wxButton::SetDefault()
{
wxWindow *parent = (wxWindow *)GetParent();
if (parent)
parent->SetDefaultItem(this);
wxWindow *parent = (wxWindow *)GetParent();
if (parent)
parent->SetDefaultItem(this);
// TODO: make button the default
}
wxString wxButton::GetLabel() const
{
// TODO
return wxString("");
}
void wxButton::SetLabel(const wxString& label)
{
// TODO
if ( m_macControl )
{
UMASetControlData( m_macControl , kControlButtonPart , kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)((Boolean)1) ) ;
}
}
void wxButton::Command (wxCommandEvent & event)
@@ -73,3 +62,10 @@ void wxButton::Command (wxCommandEvent & event)
ProcessCommand (event);
}
void wxButton::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
{
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, m_windowId );
event.SetEventObject(this);
ProcessCommand(event);
}

View File

@@ -20,6 +20,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox)
#endif
#include <wx/mac/uma.h>
// Single check box item
bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint& pos,
@@ -27,41 +29,27 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
const wxValidator& validator,
const wxString& name)
{
SetName(name);
SetValidator(validator);
m_windowStyle = style;
Rect bounds ;
Str255 title ;
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
if (parent) parent->AddChild(this);
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
kControlCheckBoxProc , (long) this ) ;
MacPostControlCreate() ;
if ( id == -1 )
m_windowId = NewControlId();
else
m_windowId = id;
// TODO: create checkbox
return FALSE;
}
void wxCheckBox::SetLabel(const wxString& label)
{
// TODO
}
void wxCheckBox::SetSize(int x, int y, int width, int height, int sizeFlags)
{
// TODO
return TRUE;
}
void wxCheckBox::SetValue(bool val)
{
// TODO
::SetControlValue( m_macControl , val ) ;
}
bool wxCheckBox::GetValue() const
{
// TODO
return FALSE;
return ::GetControlValue( m_macControl ) ;
}
void wxCheckBox::Command (wxCommandEvent & event)
@@ -70,6 +58,11 @@ void wxCheckBox::Command (wxCommandEvent & event)
ProcessCommand (event);
}
void wxCheckBox::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
{
SetValue( !GetValue() ) ;
}
// Bitmap checkbox
bool wxBitmapCheckBox::Create(wxWindow *parent, wxWindowID id, const wxBitmap *label,
const wxPoint& pos,
@@ -100,7 +93,7 @@ void wxBitmapCheckBox::SetLabel(const wxBitmap *bitmap)
void wxBitmapCheckBox::SetSize(int x, int y, int width, int height, int sizeFlags)
{
// TODO
wxControl::SetSize( x , y , width , height , sizeFlags ) ;
}
void wxBitmapCheckBox::SetValue(bool val)

View File

@@ -15,6 +15,7 @@
// For compilers that support precompilation, includes "wx.h".
#include "wx/choice.h"
#include "wx/mac/uma.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl)
@@ -23,71 +24,103 @@ IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl)
bool wxChoice::Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
int n, const wxString choices[],
long style,
int n, const wxString choices[],
long style,
const wxValidator& validator,
const wxString& name)
{
SetName(name);
SetValidator(validator);
m_noStrings = n;
m_windowStyle = style;
if (parent) parent->AddChild(this);
Rect bounds ;
Str255 title ;
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , -12345 , 0,
kControlPopupButtonProc , (long) this ) ;
m_macPopUpMenuHandle = NewMenu( 1 , "\pPopUp Menu" ) ;
SetControlData( m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
for ( int i = 0 ; i < n ; i++ )
{
appendmenu( m_macPopUpMenuHandle , choices[i] ) ;
}
SetControlMinimum( m_macControl , 0 ) ;
SetControlMaximum( m_macControl , m_noStrings) ;
SetControlValue( m_macControl , 1 ) ;
if ( id == -1 )
m_windowId = (int)NewControlId();
else
m_windowId = id;
MacPostControlCreate() ;
// TODO: create choice control
return FALSE;
return TRUE;
}
void wxChoice::Append(const wxString& item)
{
// TODO
appendmenu( m_macPopUpMenuHandle , item ) ;
m_noStrings ++;
SetControlMaximum( m_macControl , m_noStrings) ;
}
void wxChoice::Delete(int n)
{
// TODO
wxASSERT( n < m_noStrings ) ;
::DeleteMenuItem( m_macPopUpMenuHandle , n + 1) ;
m_noStrings --;
SetControlMaximum( m_macControl , m_noStrings) ;
}
void wxChoice::Clear()
{
// TODO
for ( int i = 0 ; i < m_noStrings ; i++ )
{
::DeleteMenuItem( m_macPopUpMenuHandle , 1 ) ;
}
m_noStrings = 0;
SetControlMaximum( m_macControl , m_noStrings) ;
}
int wxChoice::GetSelection() const
{
// TODO
return 0;
return GetControlValue( m_macControl ) -1 ;
}
void wxChoice::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
{
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId );
event.SetInt(GetSelection());
event.SetEventObject(this);
event.SetString(copystring(GetStringSelection()));
ProcessCommand(event);
delete[] event.GetString();
}
void wxChoice::SetSelection(int n)
{
// TODO
SetControlValue( m_macControl , n + 1 ) ;
}
int wxChoice::FindString(const wxString& s) const
{
// TODO
return 0;
for( int i = 0 ; i < m_noStrings ; i++ )
{
if ( GetString( i ) == s )
return i ;
}
return -1;
}
wxString wxChoice::GetString(int n) const
{
// TODO
return wxString("");
Str255 text ;
::GetMenuItemText( m_macPopUpMenuHandle , n+1 , text ) ;
p2cstr( text ) ;
return wxString( text );
}
void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags)
{
// TODO
wxControl::SetSize( x,y,width,height,sizeFlags ) ;
}
wxString wxChoice::GetStringSelection () const

View File

@@ -30,19 +30,17 @@ IMPLEMENT_ABSTRACT_CLASS(wxClipboardClient, wxObject)
bool wxOpenClipboard()
{
// TODO
return FALSE;
return TRUE;
}
bool wxCloseClipboard()
{
// TODO
return FALSE;
}
bool wxEmptyClipboard()
{
// TODO
ZeroScrap() ;
return FALSE;
}
@@ -169,7 +167,7 @@ wxClipboardClient *wxClipboard::GetClipboardClient()
}
void wxClipboard::SetClipboardString(char *str, long time)
{
{/*
bool got_selection;
if (clipOwner) {
@@ -195,6 +193,7 @@ void wxClipboard::SetClipboardString(char *str, long time)
delete[] cbString;
cbString = NULL;
}
*/
}
char *wxClipboard::GetClipboardString(long time)

View File

@@ -14,7 +14,7 @@
#pragma implementation "colordlg.h"
#endif
#include "wx/stubs/colordlg.h"
#include "wx/mac/colordlg.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog)
@@ -45,8 +45,20 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data)
int wxColourDialog::ShowModal()
{
/* TODO: implement dialog
*/
Point where ;
RGBColor currentColor = m_colourData.dataColour.GetPixel() , newColor ;
where.h = where.v = -1;
if (GetColor( where, "\pSelect a new palette color.", &currentColor, &newColor ))
{
m_colourData.dataColour.Set( newColor ) ;
return wxID_OK;
}
else
{
return wxID_CANCEL;
}
return wxID_CANCEL;
}

View File

@@ -22,13 +22,20 @@ IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
// Colour
static void wxComposeRGBColor( RGBColor * col , int red, int blue, int green ) ;
static void wxComposeRGBColor( RGBColor * col , int red, int blue, int green )
{
col->red = (red << 8) + red;
col->blue = (blue << 8) + blue;
col->green = (green << 8) + green;
}
wxColour::wxColour ()
{
m_isInit = FALSE;
m_red = m_blue = m_green = 0;
/* TODO
m_pixel = 0;
*/
m_isInit = FALSE;
m_red = m_blue = m_green = 0;
wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
}
wxColour::wxColour (unsigned char r, unsigned char g, unsigned char b)
@@ -37,9 +44,8 @@ wxColour::wxColour (unsigned char r, unsigned char g, unsigned char b)
m_green = g;
m_blue = b;
m_isInit = TRUE;
/* TODO
m_pixel = PALETTERGB (m_red, m_green, m_blue);
*/
wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
}
wxColour::wxColour (const wxColour& col)
@@ -48,9 +54,18 @@ wxColour::wxColour (const wxColour& col)
m_green = col.m_green;
m_blue = col.m_blue;
m_isInit = col.m_isInit;
/* TODO
m_pixel = col.m_pixel;
*/
}
wxColour::wxColour (const wxColour* col)
{
m_red = col->m_red;
m_green = col->m_green;
m_blue = col->m_blue;
m_isInit = col->m_isInit;
m_pixel = col->m_pixel;
}
wxColour& wxColour::operator =(const wxColour& col)
@@ -59,9 +74,9 @@ wxColour& wxColour::operator =(const wxColour& col)
m_green = col.m_green;
m_blue = col.m_blue;
m_isInit = col.m_isInit;
/* TODO
m_pixel = col.m_pixel;
*/
return *this;
}
@@ -82,9 +97,8 @@ void wxColour::InitFromName(const wxString& col)
m_blue = 0;
m_isInit = FALSE;
}
/* TODO
m_pixel = PALETTERGB (m_red, m_green, m_blue);
*/
wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
}
wxColour::~wxColour ()
@@ -97,7 +111,6 @@ void wxColour::Set (unsigned char r, unsigned char g, unsigned char b)
m_green = g;
m_blue = b;
m_isInit = TRUE;
/* TODO
m_pixel = PALETTERGB (m_red, m_green, m_blue);
*/
wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
}

View File

@@ -14,11 +14,15 @@
#endif
#include "wx/combobox.h"
#include "wx/mac/uma.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl)
#endif
// right now we don't support editable comboboxes
bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
const wxString& value,
const wxPoint& pos,
@@ -28,32 +32,39 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
const wxValidator& validator,
const wxString& name)
{
SetName(name);
SetValidator(validator);
m_noStrings = n;
m_windowStyle = style;
if (parent) parent->AddChild(this);
Rect bounds ;
Str255 title ;
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , -12345 , 0,
kControlPopupButtonProc , (long) this ) ;
m_macPopUpMenuHandle = NewMenu( 1 , "\pPopUp Menu" ) ;
SetControlData( m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
for ( int i = 0 ; i < n ; i++ )
{
appendmenu( m_macPopUpMenuHandle , choices[i] ) ;
}
SetControlMinimum( m_macControl , 0 ) ;
SetControlMaximum( m_macControl , m_noStrings) ;
SetControlValue( m_macControl , 1 ) ;
if ( id == -1 )
m_windowId = (int)NewControlId();
else
m_windowId = id;
MacPostControlCreate() ;
// TODO: create combobox control
return TRUE;
return TRUE;
}
wxString wxComboBox::GetValue() const
{
// TODO
return wxString("");
return GetStringSelection() ;
}
void wxComboBox::SetValue(const wxString& value)
{
// TODO
SetStringSelection( value ) ;
}
// Clipboard operations
@@ -116,50 +127,85 @@ void wxComboBox::SetSelection(long from, long to)
void wxComboBox::Append(const wxString& item)
{
// TODO
appendmenu( m_macPopUpMenuHandle , item ) ;
m_noStrings ++;
SetControlMaximum( m_macControl , m_noStrings) ;
}
void wxComboBox::Delete(int n)
{
// TODO
wxASSERT( n < m_noStrings ) ;
::DeleteMenuItem( m_macPopUpMenuHandle , n + 1) ;
m_noStrings --;
SetControlMaximum( m_macControl , m_noStrings) ;
}
void wxComboBox::Clear()
{
// TODO
for ( int i = 0 ; i < m_noStrings ; i++ )
{
::DeleteMenuItem( m_macPopUpMenuHandle , 1 ) ;
}
m_noStrings = 0;
SetControlMaximum( m_macControl , m_noStrings) ;
}
int wxComboBox::GetSelection() const
{
// TODO
return -1;
return GetControlValue( m_macControl ) -1 ;
}
void wxComboBox::SetSelection(int n)
{
// TODO
SetControlValue( m_macControl , n + 1 ) ;
}
int wxComboBox::FindString(const wxString& s) const
{
// TODO
for( int i = 0 ; i < m_noStrings ; i++ )
{
if ( GetString( i ) == s )
return i ;
}
return -1;
}
wxString wxComboBox::GetString(int n) const
{
// TODO
return wxString("");
Str255 text ;
::GetMenuItemText( m_macPopUpMenuHandle , n+1 , text ) ;
p2cstr( text ) ;
return wxString( text );
}
wxString wxComboBox::GetStringSelection() const
{
// TODO
return wxString("");
int sel = GetSelection ();
if (sel > -1)
return wxString(this->GetString (sel));
else
return wxString("");
}
bool wxComboBox::SetStringSelection(const wxString& sel)
{
// TODO
return FALSE;
int s = FindString (sel);
if (s > -1)
{
SetSelection (s);
return TRUE;
}
else
return FALSE;
}
void wxComboBox::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
{
wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId );
event.SetInt(GetSelection());
event.SetEventObject(this);
event.SetString(copystring(GetStringSelection()));
ProcessCommand(event);
delete[] event.GetString();
}

View File

@@ -14,20 +14,51 @@
#endif
#include "wx/control.h"
#include "wx/notebook.h"
#include "wx/tabctrl.h"
#include "wx/spinbutt.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
BEGIN_EVENT_TABLE(wxControl, wxWindow)
EVT_MOUSE_EVENTS( wxControl::OnMouseEvent )
EVT_CHAR( wxControl::OnKeyDown )
EVT_PAINT( wxControl::OnPaint )
END_EVENT_TABLE()
#endif
#include <wx/mac/uma.h>
// Item members
ControlActionUPP wxMacLiveScrollbarActionUPP = NULL ;
pascal void wxMacLiveScrollbarActionProc( ControlHandle control , ControlPartCode partCode )
{
if ( partCode != 0)
{
wxControl* wx = (wxControl*) GetControlReference( control ) ;
if ( wx )
{
wx->MacHandleControlClick( control , partCode ) ;
}
}
}
wxControl::wxControl()
{
m_macControl = NULL ;
m_macHorizontalBorder = 0 ; // additional pixels around the real control
m_macVerticalBorder = 0 ;
m_backgroundColour = *wxWHITE;
m_foregroundColour = *wxBLACK;
m_callback = 0;
if ( wxMacLiveScrollbarActionUPP == NULL )
{
wxMacLiveScrollbarActionUPP = NewControlActionProc( wxMacLiveScrollbarActionProc ) ;
}
}
wxControl::~wxControl()
@@ -40,17 +71,31 @@ wxControl::~wxControl()
if (parent->GetDefaultItem() == (wxButton*) this)
parent->SetDefaultItem(NULL);
}
if ( m_macControl )
{
UMADisposeControl( m_macControl ) ;
m_macControl = NULL ;
}
}
void wxControl::SetLabel(const wxString& label)
{
// TODO
m_label = label ;
if ( m_macControl )
{
Str255 maclabel ;
strcpy( (char*) maclabel , label ) ;
c2pstr( (char*) maclabel ) ;
::SetControlTitle( m_macControl , maclabel ) ;
}
}
wxString wxControl::GetLabel() const
{
// TODO
return wxString("");
return m_label ;
}
void wxControl::ProcessCommand (wxCommandEvent & event)
@@ -93,3 +138,566 @@ void wxControl::Centre (int direction)
SetSize (new_x, new_y, width, height);
}
void wxControl::SetClientSize (int width, int height)
{
SetSize (-1, -1, width, height);
}
// ------------------------
wxList *wxWinMacControlList = NULL;
wxControl *wxFindControlFromMacControl(ControlHandle inControl )
{
wxNode *node = wxWinMacControlList->Find((long)inControl);
if (!node)
return NULL;
return (wxControl *)node->Data();
}
void wxAssociateControlWithMacControl(ControlHandle inControl, wxControl *control)
{
// adding NULL WindowRef is (first) surely a result of an error and
// (secondly) breaks menu command processing
wxCHECK_RET( inControl != (ControlHandle) NULL, "attempt to add a NULL WindowRef to window list" );
if ( !wxWinMacControlList->Find((long)inControl) )
wxWinMacControlList->Append((long)inControl, control);
}
void wxRemoveMacControlAssociation(wxControl *control)
{
wxWinMacControlList->DeleteObject(control);
}
void wxControl::MacPreControlCreate( wxWindow *parent, wxWindowID id, wxString label ,
const wxPoint& pos,
const wxSize& size, long style,
const wxValidator& validator,
const wxString& name , Rect *outBounds , StringPtr maclabel )
{
m_label = label ;
SetName(name);
if ( &validator )
SetValidator(validator);
m_windowStyle = style;
parent->AddChild((wxButton *)this);
m_backgroundColour = parent->GetBackgroundColour() ;
m_foregroundColour = parent->GetForegroundColour() ;
if (id == -1)
m_windowId = NewControlId();
else
m_windowId = id;
m_width = size.x ;
m_height = size.y ;
int x = pos.x ;
int y = pos.y ;
AdjustForParentClientOrigin(x, y, wxSIZE_USE_EXISTING);
m_x = x ;
m_y = y ;
Point localOrigin ;
Rect clipRect ;
parent->MacClientToRootWindow( &x , &y ) ;
outBounds->top = y + m_macVerticalBorder ;
outBounds->left = x + m_macHorizontalBorder ;
outBounds->bottom = outBounds->top + m_height - 2 * m_macVerticalBorder;
outBounds->right = outBounds->left + m_width - 2 * m_macHorizontalBorder ;
strcpy( (char*) maclabel , label ) ;
if( wxApp::s_macDefaultEncodingIsPC )
{
wxMacConvertFromPCForControls( (char*) maclabel ) ;
}
c2pstr( (char*) maclabel ) ;
}
void wxControl::MacPostControlCreate()
{
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
if ( IsKindOf( CLASSINFO( wxScrollBar ) ) )
{
// no font
}
else if ( IsKindOf( CLASSINFO( wxStaticBox ) ) )
{
ControlFontStyleRec controlstyle ;
controlstyle.flags = kControlUseFontMask ;
controlstyle.font = kControlFontSmallBoldSystemFont ;
::UMASetControlFontStyle( m_macControl , &controlstyle ) ;
}
else
{
ControlFontStyleRec controlstyle ;
controlstyle.flags = kControlUseFontMask ;
controlstyle.font = kControlFontSmallSystemFont ;
::UMASetControlFontStyle( m_macControl , &controlstyle ) ;
}
ControlHandle container = GetParent()->MacGetContainerForEmbedding() ;
wxASSERT_MSG( container != NULL , "No valid mac container control" ) ;
::UMAEmbedControl( m_macControl , container ) ;
MacAdjustControlRect() ;
wxAssociateControlWithMacControl( m_macControl , this ) ;
}
void wxControl::MacAdjustControlRect()
{
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
if ( m_width == -1 || m_height == -1 )
{
Rect bestsize = { 0 , 0 , 0 , 0 } ;
short baselineoffset ;
UMAGetBestControlRect( m_macControl , &bestsize , &baselineoffset ) ;
if ( EmptyRect( &bestsize ) )
{
baselineoffset = 0;
bestsize.left = bestsize.top = 0 ;
bestsize.right = 16 ;
bestsize.bottom = 16 ;
if ( IsKindOf( CLASSINFO( wxScrollBar ) ) )
{
bestsize.bottom = 16 ;
}
else if ( IsKindOf( CLASSINFO( wxSpinButton ) ) )
{
bestsize.bottom = 24 ;
}
}
if ( m_width == -1 )
{
if ( IsKindOf( CLASSINFO( wxButton ) ) )
{
m_width = m_label.Length() * 8 + 12 + 2 * m_macHorizontalBorder;
}
else if ( IsKindOf( CLASSINFO( wxStaticText ) ) )
{
m_width = m_label.Length() * 8 ;
}
else
m_width = bestsize.right - bestsize.left + 2 * m_macHorizontalBorder;
}
if ( m_height == -1 )
{
m_height = bestsize.bottom - bestsize.top ;
if ( m_height < 10 )
m_height = 13 ;
m_height += 2 * m_macVerticalBorder;
}
wxMacDrawingHelper helper ( wxFindWinFromMacWindow( GetMacRootWindow() ) ) ;
if ( helper.Ok() )
{
UMASizeControl( m_macControl , m_width - 2 * m_macHorizontalBorder, m_height - 2 * m_macVerticalBorder ) ;
}
}
}
ControlHandle wxControl::MacGetContainerForEmbedding()
{
if ( m_macControl )
return m_macControl ;
return wxWindow::MacGetContainerForEmbedding() ;
}
void wxControl::MacSuperChangedPosition()
{
if ( m_macControl )
{
int former_mac_x = (**m_macControl).contrlRect.left ;
int former_mac_y = (**m_macControl).contrlRect.top ;
int mac_x = m_x ;
int mac_y = m_y ;
GetParent()->MacClientToRootWindow( & mac_x , & mac_y ) ;
WindowRef rootwindow = GetMacRootWindow() ;
wxWindow* wxrootwindow = wxFindWinFromMacWindow( rootwindow ) ;
UMASetThemeWindowBackground( rootwindow , kThemeBrushDialogBackgroundActive , false ) ;
wxMacDrawingHelper focus( wxrootwindow ) ;
if ( mac_x != former_mac_x || mac_y != former_mac_y )
{
{
Rect inval = { former_mac_y , former_mac_x , former_mac_y + m_height , former_mac_x + m_width } ;
InvalRect( &inval ) ;
}
UMAMoveControl( m_macControl , mac_x + m_macHorizontalBorder , mac_y + m_macVerticalBorder ) ;
{
Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
InvalRect( &inval ) ;
}
}
if ( wxrootwindow->IsKindOf( CLASSINFO( wxDialog ) ) )
{
}
else
{
UMASetThemeWindowBackground( rootwindow , kThemeBrushDocumentWindowBackground , false ) ;
}
}
wxWindow::MacSuperChangedPosition() ;
}
void wxControl::MacSuperEnabled( bool enabled )
{
if ( m_macControl )
{
if ( UMAHasAppearance() )
{
if ( !enabled )
{
::DeactivateControl( m_macControl ) ;
}
else
{
if ( m_macEnabled )
::ActivateControl( m_macControl ) ;
}
}
else
{
if ( !enabled )
{
::HiliteControl( m_macControl , 255 ) ;
}
else
{
if ( m_macEnabled )
::HiliteControl( m_macControl , 0 ) ;
}
}
}
wxWindow::MacSuperEnabled( enabled ) ;
}
void wxControl::MacSuperShown( bool show )
{
if ( m_macControl )
{
if ( !show )
{
::UMAHideControl( m_macControl ) ;
}
else
{
if ( m_macShown )
::UMAShowControl( m_macControl ) ;
}
}
wxWindow::MacSuperShown( show ) ;
}
void wxControl::DoSetSize(int x, int y,
int width, int height,
int sizeFlags )
{
if ( m_macControl == NULL )
{
wxWindow::DoSetSize( x , y ,width , height ,sizeFlags ) ;
return ;
}
WindowRef rootwindow = GetMacRootWindow() ;
wxWindow* wxrootwindow = wxFindWinFromMacWindow( rootwindow ) ;
UMASetThemeWindowBackground( rootwindow , kThemeBrushDialogBackgroundActive , false ) ;
int former_x = m_x ;
int former_y = m_y ;
int former_w = m_width ;
int former_h = m_height ;
int former_mac_x = (**m_macControl).contrlRect.left ;
int former_mac_y = (**m_macControl).contrlRect.top ;
int currentX, currentY;
GetPosition(&currentX, &currentY);
int currentW,currentH;
GetSize(&currentW, &currentH);
int actualWidth = width;
int actualHeight = height;
int actualX = x;
int actualY = y;
if (x == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
actualX = currentX;
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
actualY = currentY;
if (width == -1)
actualWidth = currentW ;
if (height == -1)
actualHeight = currentH ;
if ( actualX == currentX && actualY == currentY && actualWidth == currentW && actualHeight == currentH)
return ;
AdjustForParentClientOrigin(actualX, actualY, sizeFlags);
wxMacDrawingHelper focus( wxFindWinFromMacWindow( GetMacRootWindow() ) ) ;
int mac_x = actualX ;
int mac_y = actualY ;
GetParent()->MacClientToRootWindow( & mac_x , & mac_y ) ;
if ( mac_x != former_mac_x || mac_y != former_mac_y )
{
{
Rect inval = { former_mac_y , former_mac_x , former_mac_y + m_height , former_mac_x + m_width } ;
InvalRect( &inval ) ;
}
UMAMoveControl( m_macControl , mac_x + m_macHorizontalBorder , mac_y + m_macVerticalBorder ) ;
{
Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
InvalRect( &inval ) ;
}
}
if ( actualX != former_x || actualY != former_y )
{
m_x = actualX ;
m_y = actualY ;
MacRepositionScrollBars() ;
// To consider -> should the parameters be the effective or the virtual coordinates (AdjustForParent..)
wxMoveEvent event(wxPoint(m_x, m_y), m_windowId);
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
}
if ( actualWidth != former_w || actualHeight != former_h )
{
{
Rect inval = { mac_y , mac_x , mac_y + former_h , mac_x + former_w } ;
InvalRect( &inval ) ;
}
m_width = actualWidth ;
m_height = actualHeight ;
UMASizeControl( m_macControl , m_width - 2 * m_macHorizontalBorder, m_height - 2 * m_macVerticalBorder ) ;
{
Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
InvalRect( &inval ) ;
}
MacRepositionScrollBars() ;
wxSizeEvent event(wxSize(m_width, m_height), m_windowId);
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
}
if ( wxrootwindow->IsKindOf( CLASSINFO( wxDialog ) ) )
{
}
else
{
UMASetThemeWindowBackground( rootwindow , kThemeBrushDocumentWindowBackground , false ) ;
}
}
void wxControl::DoSetClientSize(int width, int height)
{
DoSetSize( -1 , -1 , width , height ) ;
}
bool wxControl::Show(bool show)
{
if ( m_macControl == NULL )
return wxWindow::Show( show ) ;
if ( m_macShown == show )
return TRUE ;
if ( show )
::UMAShowControl( m_macControl ) ;
else
::UMAHideControl( m_macControl ) ;
return wxWindow::Show( show ) ;
}
void wxControl::Enable(bool enable)
{
if ( m_macControl == NULL )
return wxWindow::Enable( enable ) ;
if ( m_macEnabled == enable )
return ;
if ( UMAHasAppearance() )
{
if ( enable )
::ActivateControl( m_macControl ) ;
else
::DeactivateControl( m_macControl ) ;
}
else
{
if ( enable )
::HiliteControl( m_macControl , 0 ) ;
else
::HiliteControl( m_macControl , 255 ) ;
}
return wxWindow::Enable( enable ) ;
}
void wxControl::Refresh(bool eraseBack, const wxRect *rect)
{
if ( m_macControl )
{
wxWindow::Refresh( eraseBack , rect ) ;
}
else
{
wxWindow::Refresh( eraseBack , rect ) ;
}
}
void wxControl::OnPaint(wxPaintEvent& event)
{
if ( m_macControl )
{
WindowRef window = GetMacRootWindow() ;
if ( window )
{
wxWindow* win = wxFindWinFromMacWindow( window ) ;
if ( win )
{
wxMacDrawingHelper help( win ) ;
SetOrigin( 0 , 0 ) ;
bool hasTabBehind = false ;
wxWindow* parent = GetParent() ;
while ( parent )
{
if( parent->m_macWindowData )
{
UMASetThemeWindowBackground( win->m_macWindowData->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
break ;
}
if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
{
if ( ((wxControl*)parent)->m_macControl )
SetUpControlBackground( ((wxControl*)parent)->m_macControl , -1 , true ) ;
break ;
}
parent = parent->GetParent() ;
}
UMADrawControl( m_macControl ) ;
UMASetThemeWindowBackground( win->m_macWindowData->m_macWindow , win->m_macWindowData->m_macWindowBackgroundTheme , false ) ;
}
}
}
else
{
wxWindow::OnPaint( event ) ;
}
}
void wxControl::OnKeyDown( wxKeyEvent &event )
{
if ( m_macControl == NULL )
return ;
EventRecord *ev = wxTheApp->MacGetCurrentEvent() ;
short keycode ;
short keychar ;
keychar = short(ev->message & charCodeMask);
keycode = short(ev->message & keyCodeMask) >> 8 ;
UMAHandleControlKey( m_macControl , keycode , keychar , ev->modifiers ) ;
}
void wxControl::OnMouseEvent( wxMouseEvent &event )
{
if ( m_macControl == NULL )
{
event.Skip() ;
return ;
}
if (event.GetEventType() == wxEVT_LEFT_DOWN )
{
int x = event.m_x ;
int y = event.m_y ;
MacClientToRootWindow( &x , &y ) ;
ControlHandle control ;
Point localwhere ;
GrafPtr port ;
SInt16 controlpart ;
WindowRef window = GetMacRootWindow() ;
localwhere.h = x ;
localwhere.v = y ;
short modifiers = 0;
if ( !event.m_leftDown && !event.m_rightDown )
modifiers |= btnState ;
if ( event.m_shiftDown )
modifiers |= shiftKey ;
if ( event.m_controlDown )
modifiers |= controlKey ;
if ( event.m_altDown )
modifiers |= optionKey ;
if ( event.m_metaDown )
modifiers |= cmdKey ;
controlpart = FindControl( localwhere , window , &control ) ;
{
if ( AcceptsFocus() && FindFocus() != this )
{
SetFocus() ;
}
if ( control && UMAIsControlActive( control ) )
{
{
if ( controlpart == kControlIndicatorPart && !UMAHasAppearance() )
controlpart = UMAHandleControlClick( control , localwhere , modifiers , (ControlActionUPP) NULL ) ;
else
controlpart = UMAHandleControlClick( control , localwhere , modifiers , (ControlActionUPP) -1 ) ;
wxTheApp->s_lastMouseDown = 0 ;
if ( controlpart && ! ( ( UMAHasAppearance() || (controlpart != kControlIndicatorPart) )
&& (IsKindOf( CLASSINFO( wxScrollBar ) ) ) ) ) // otherwise we will get the event twice
{
MacHandleControlClick( control , controlpart ) ;
}
}
}
}
}
}
bool wxControl::MacCanFocus() const
{
{ if ( m_macControl == NULL )
return true ;
else
return false ;
}
}
void wxControl::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
{
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
}

View File

@@ -1,8 +1,18 @@
#include <Types.r>
resource 'ALRT' (128, purgeable) {
#if UNIVERSAL_INTERFACES_VERSION > 0x320
#include <ControlDefinitions.r>
#endif
#define kMacOKAlertResourceID 128
#define kMacYesNoAlertResourceID 129
#define kMacYesNoCancelAlertResourceID 130
#define kMacNoYesAlertResourceID 131
#define kMacNoYesCancelAlertResourceID 132
resource 'ALRT' (kMacOKAlertResourceID, purgeable) {
{70, 50, 198, 470},
128,
kMacOKAlertResourceID,
{ /* array: 4 elements */
/* [1] */
OK, visible, sound1,
@@ -16,9 +26,9 @@ resource 'ALRT' (128, purgeable) {
noAutoCenter
};
resource 'ALRT' (129, purgeable) {
resource 'ALRT' (kMacYesNoAlertResourceID, purgeable) {
{70, 50, 198, 470},
129,
kMacYesNoAlertResourceID,
{ /* array: 4 elements */
/* [1] */
OK, visible, sound1,
@@ -32,7 +42,39 @@ resource 'ALRT' (129, purgeable) {
noAutoCenter
};
resource 'ALRT' (130, purgeable) {
resource 'ALRT' (kMacYesNoAlertResourceID + 10, purgeable) {
{70, 50, 198, 470},
kMacYesNoAlertResourceID + 10,
{ /* array: 4 elements */
/* [1] */
OK, visible, sound1,
/* [2] */
OK, visible, sound1,
/* [3] */
OK, visible, sound1,
/* [4] */
OK, visible, sound1
},
noAutoCenter
};
resource 'ALRT' (kMacYesNoAlertResourceID + 20, purgeable) {
{70, 50, 198, 470},
kMacYesNoAlertResourceID + 20,
{ /* array: 4 elements */
/* [1] */
OK, visible, sound1,
/* [2] */
OK, visible, sound1,
/* [3] */
OK, visible, sound1,
/* [4] */
OK, visible, sound1
},
noAutoCenter
};
resource 'ALRT' (kMacYesNoCancelAlertResourceID, purgeable) {
{70, 50, 198, 470},
130,
{ /* array: 4 elements */
@@ -48,7 +90,7 @@ resource 'ALRT' (130, purgeable) {
noAutoCenter
};
resource 'ALRT' (131, purgeable) {
resource 'ALRT' (kMacNoYesAlertResourceID, purgeable) {
{70, 50, 198, 470},
131,
{ /* array: 4 elements */
@@ -64,7 +106,7 @@ resource 'ALRT' (131, purgeable) {
noAutoCenter
};
resource 'ALRT' (132, purgeable) {
resource 'ALRT' (kMacNoYesCancelAlertResourceID, purgeable) {
{70, 50, 198, 470},
132,
{ /* array: 4 elements */
@@ -80,7 +122,7 @@ resource 'ALRT' (132, purgeable) {
noAutoCenter
};
resource 'DITL' (128, purgeable) {
resource 'DITL' (kMacOKAlertResourceID, purgeable) {
{ /* array DITLarray: 3 elements */
/* [1] */
{100, 340, 120, 408},
@@ -103,13 +145,71 @@ resource 'DITL' (128, purgeable) {
}
};
resource 'DITL' (129, purgeable) {
resource 'DITL' (kMacYesNoAlertResourceID, purgeable) {
{ /* array DITLarray: 4 elements */
/* [1] */
{100, 340, 120, 408},
Button {
enabled,
"Yes"
"Ja"
},
/* [2] */
{100, 260, 120, 324},
Button {
enabled,
"Nein"
},
/* [3] */
{38, 64, 88, 408},
StaticText {
disabled,
"^1"
},
/* [4] */
{10, 64, 30, 412},
StaticText {
disabled,
"^0"
}
}
};
resource 'DITL' (kMacYesNoAlertResourceID + 10, purgeable) {
{ /* array DITLarray: 4 elements */
/* [1] */
{100, 340, 120, 408},
Button {
enabled,
"Oui"
},
/* [2] */
{100, 260, 120, 324},
Button {
enabled,
"Non"
},
/* [3] */
{38, 64, 88, 408},
StaticText {
disabled,
"^1"
},
/* [4] */
{10, 64, 30, 412},
StaticText {
disabled,
"^0"
}
}
};
resource 'DITL' (kMacYesNoAlertResourceID + 20, purgeable) {
{ /* array DITLarray: 4 elements */
/* [1] */
{100, 340, 120, 408},
Button {
enabled,
"Si"
},
/* [2] */
{100, 260, 120, 324},
@@ -132,7 +232,7 @@ resource 'DITL' (129, purgeable) {
}
};
resource 'DITL' (130, purgeable) {
resource 'DITL' (kMacYesNoCancelAlertResourceID, purgeable) {
{ /* array DITLarray: 5 elements */
/* [1] */
{100, 340, 120, 408},
@@ -167,7 +267,7 @@ resource 'DITL' (130, purgeable) {
}
};
resource 'DITL' (131, purgeable) {
resource 'DITL' (kMacNoYesAlertResourceID, purgeable) {
{ /* array DITLarray: 4 elements */
/* [1] */
{100, 340, 120, 408},
@@ -196,7 +296,7 @@ resource 'DITL' (131, purgeable) {
}
};
resource 'DITL' (132, purgeable) {
resource 'DITL' (kMacNoYesCancelAlertResourceID, purgeable) {
{ /* array DITLarray: 5 elements */
/* [1] */
{100, 340, 120, 408},
@@ -278,54 +378,17 @@ data 'DLGX' (132) {
$"0000 0006 0000 0000 0000 0000 0000" /* .............. */
};
data 'ics#' (200, "<EFBFBD> New File") {
$"0000 3FE0 2C70 3458 2C78 3408 2C08 3408" /* ..?<EFBFBD>,p4X,x4.,.4. */
$"2C08 3408 2C08 3408 2C0E 340F 3FFE 0000" /* ,.4.,.4.,.4.?<EFBFBD>.. */
$"0000 3FE0 3FF0 3FF8 3FF8 3FF8 3FF8 3FF8" /* ..?<EFBFBD>?<EFBFBD>?<EFBFBD>?<EFBFBD>?<EFBFBD>?<EFBFBD>?<EFBFBD> */
$"3FF8 3FF8 3FF8 3FF8 3FFE 3FFF 3FFE 0000" /* ?<EFBFBD>?<EFBFBD>?<EFBFBD>?<EFBFBD>?<EFBFBD>?<EFBFBD>?<EFBFBD>.. */
};
data 'ics4' (200, "<EFBFBD> New File") {
$"0000 0000 0000 0000 00FF FFFF FFF0 0000" /* .........<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.. */
$"00F1 FFED EFFF 0000 00FF 1FDE DFCF F000" /* .<2E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...<EFBFBD>.<2E><EFBFBD><EFBFBD><EFBFBD>. */
$"00F1 FFED EFFF F000 00FF 1FDE DEEE F000" /* .<2E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>..<EFBFBD>.<2E><EFBFBD><EFBFBD><EFBFBD>. */
$"00F1 FFED EDED F000 00FF 1FDE DEDE F000" /* .<2E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>..<EFBFBD>.<2E><EFBFBD><EFBFBD><EFBFBD>. */
$"00F1 FFED EDED F000 00FF 1FDE DEDE F000" /* .<2E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>..<EFBFBD>.<2E><EFBFBD><EFBFBD><EFBFBD>. */
$"00F1 FFED EDED F000 00FF 1FDE DEDE F000" /* .<2E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>..<EFBFBD>.<2E><EFBFBD><EFBFBD><EFBFBD>. */
$"00F1 FFED EDED FEE0 00FF 1FDE DEDE FEEE" /* .<2E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.<2E>.<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
$"00FF FFFF FFFF FEE0 0000 0000 0000 0000" /* .<2E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>........ */
};
data 'ics8' (200, "<EFBFBD> New File") {
$"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
$"0000 FFFF FFFF FFFF FFFF FF00 0000 0000" /* ..<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>..... */
$"0000 FF05 FFFF FB7F FBFF FFFF 0000 0000" /* ..<EFBFBD>.<2E><EFBFBD><EFBFBD>.<2E><EFBFBD><EFBFBD><EFBFBD>.... */
$"0000 FFFF 0BFF 7FFB 7FFF F6FF FF00 0000" /* ..<EFBFBD><EFBFBD>.<2E>.<EFBFBD>.<2E><EFBFBD><EFBFBD><EFBFBD>... */
$"0000 FF05 FFFF FB7F FBFF FFFF FF00 0000" /* ..<EFBFBD>.<2E><EFBFBD><EFBFBD>.<2E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>... */
$"0000 FFFF 0BFF 7FFB 7FFB FBFB FF00 0000" /* ..<EFBFBD><EFBFBD>.<2E>.<EFBFBD>.<2E><EFBFBD><EFBFBD><EFBFBD>... */
$"0000 FF05 FFFF FB7F FB7F FB7F FF00 0000" /* ..<EFBFBD>.<2E><EFBFBD><EFBFBD>.<2E>.<EFBFBD>.<2E>... */
$"0000 FFFF 0BFF 7FFB 7FFB 7FFB FF00 0000" /* ..<EFBFBD><EFBFBD>.<2E>.<EFBFBD>.<2E>.<EFBFBD><EFBFBD>... */
$"0000 FF05 FFFF FB7F FB7F FB7F FF00 0000" /* ..<EFBFBD>.<2E><EFBFBD><EFBFBD>.<2E>.<EFBFBD>.<2E>... */
$"0000 FFFF 0BFF 7FFB 7FFB 7FFB FF00 0000" /* ..<EFBFBD><EFBFBD>.<2E>.<EFBFBD>.<2E>.<EFBFBD><EFBFBD>... */
$"0000 FF05 FFFF FB7F FB7F FB7F FF00 0000" /* ..<EFBFBD>.<2E><EFBFBD><EFBFBD>.<2E>.<EFBFBD>.<2E>... */
$"0000 FFFF 0BFF 7FFB 7FFB 7FFB FF00 0000" /* ..<EFBFBD><EFBFBD>.<2E>.<EFBFBD>.<2E>.<EFBFBD><EFBFBD>... */
$"0000 FF05 FFFF FB7F FB7F FB7F FFFC FC00" /* ..<EFBFBD>.<2E><EFBFBD><EFBFBD>.<2E>.<EFBFBD>.<2E><EFBFBD><EFBFBD>. */
$"0000 FFFF 0BFF 7FFB 7FFB 7FFB FFFC FCFC" /* ..<EFBFBD><EFBFBD>.<2E>.<EFBFBD>.<2E>.<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
$"0000 FFFF FFFF FFFF FFFF FFFF FFFC FC00" /* ..<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. */
$"0000 0000 0000 0000 0000 0000 0000 0000" /* ................ */
};
resource 'ldes' ( 128 )
{
versionZero
{
0 ,
1 ,
0 ,
0 ,
0 ,
hasVertScroll ,
noHorizScroll ,
0 ,
128 ,
noGrowSpace ,
}
} ;
@@ -536,3 +599,4 @@ resource 'STR#' (251) {
}
};
// end of get file

View File

@@ -20,18 +20,24 @@
IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxBitmap)
#endif
const short kwxCursorHandId = 9 ;
const short kwxCursorSizeWEId = 10 ;
const short kwxCursorSizeNSId = 11 ;
Cursor* MacArrowCursorPtr = &qd.arrow ;
CursHandle MacArrowCursor = &MacArrowCursorPtr ;
CursHandle gMacCurrentCursor = NULL ;
wxCursorRefData::wxCursorRefData()
{
m_width = 32; m_height = 32;
/* TODO
m_hCursor = 0 ;
*/
m_width = 32;
m_height = 32;
m_hCursor = NULL ;
}
wxCursorRefData::~wxCursorRefData()
{
// TODO: destroy cursor
if ( m_hCursor && ( m_hCursor != MacArrowCursor ) )
::DisposeHandle( (Handle) m_hCursor ) ;
}
// Cursors
@@ -56,122 +62,133 @@ wxCursor::wxCursor(int cursor_type)
{
m_refData = new wxCursorRefData;
/* TODO
switch (cursor_type)
{
case wxCURSOR_WAIT:
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_WAIT);
M_CURSORDATA->m_hCursor = ::GetCursor(watchCursor);
break;
case wxCURSOR_IBEAM:
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_IBEAM);
M_CURSORDATA->m_hCursor = ::GetCursor(iBeamCursor);
break;
case wxCURSOR_CROSS:
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_CROSS);
M_CURSORDATA->m_hCursor = ::GetCursor(crossCursor);
break;
case wxCURSOR_SIZENWSE:
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_SIZENWSE);
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeWEId);
break;
case wxCURSOR_SIZENESW:
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_SIZENESW);
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeWEId);
break;
case wxCURSOR_SIZEWE:
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_SIZEWE);
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeWEId);
break;
case wxCURSOR_SIZENS:
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_SIZENS);
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNSId);
break;
case wxCURSOR_CHAR:
{
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_ARROW);
M_CURSORDATA->m_hCursor = MacArrowCursor;
break;
}
case wxCURSOR_HAND:
{
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_HAND");
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorHandId);
break;
}
case wxCURSOR_BULLSEYE:
{
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_BULLSEYE");
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorHandId);
break;
}
case wxCURSOR_PENCIL:
{
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_PENCIL");
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorHandId);
break;
}
case wxCURSOR_MAGNIFIER:
{
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_MAGNIFIER");
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorHandId);
break;
}
case wxCURSOR_NO_ENTRY:
{
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_NO_ENTRY");
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorHandId);
break;
}
case wxCURSOR_LEFT_BUTTON:
{
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_ARROW);
M_CURSORDATA->m_hCursor = MacArrowCursor;
break;
}
case wxCURSOR_RIGHT_BUTTON:
{
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_ARROW);
M_CURSORDATA->m_hCursor = MacArrowCursor;
break;
}
case wxCURSOR_MIDDLE_BUTTON:
{
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_ARROW);
M_CURSORDATA->m_hCursor = MacArrowCursor;
break;
}
case wxCURSOR_SIZING:
{
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_SIZING");
M_CURSORDATA->m_hCursor = MacArrowCursor;
break;
}
case wxCURSOR_WATCH:
{
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_WATCH");
M_CURSORDATA->m_hCursor = ::GetCursor(watchCursor);
break;
}
case wxCURSOR_SPRAYCAN:
{
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_ROLLER");
M_CURSORDATA->m_hCursor = MacArrowCursor;
break;
}
case wxCURSOR_PAINT_BRUSH:
{
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_PBRUSH");
M_CURSORDATA->m_hCursor = MacArrowCursor;
break;
}
case wxCURSOR_POINT_LEFT:
{
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_PLEFT");
M_CURSORDATA->m_hCursor = MacArrowCursor;
break;
}
case wxCURSOR_POINT_RIGHT:
{
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_PRIGHT");
M_CURSORDATA->m_hCursor = MacArrowCursor;
break;
}
case wxCURSOR_QUESTION_ARROW:
{
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_QARROW");
M_CURSORDATA->m_hCursor = MacArrowCursor;
break;
}
case wxCURSOR_BLANK:
{
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_BLANK");
M_CURSORDATA->m_hCursor = MacArrowCursor;
break;
}
default:
case wxCURSOR_ARROW:
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_ARROW);
M_CURSORDATA->m_hCursor = MacArrowCursor;
break;
}
*/
}
}
void wxCursor::MacInstall() const
{
if ( m_refData && M_CURSORDATA->m_hCursor )
{
::SetCursor( *M_CURSORDATA->m_hCursor ) ;
gMacCurrentCursor = M_CURSORDATA->m_hCursor ;
}
else
{
::SetCursor( *MacArrowCursor ) ;
gMacCurrentCursor = NULL ;
}
}
wxCursor::~wxCursor()
@@ -181,7 +198,7 @@ wxCursor::~wxCursor()
// Global cursor setting
void wxSetCursor(const wxCursor& cursor)
{
// TODO (optional on platforms with no global cursor)
cursor.MacInstall() ;
}

View File

@@ -25,7 +25,7 @@
char *wxBuffer = NULL;
// Windows List
wxList wxTopLevelWindows;
wxWindowList wxTopLevelWindows;
// List of windows pending deletion
wxList wxPendingDelete;

File diff suppressed because it is too large Load Diff

View File

@@ -38,598 +38,78 @@ IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
* wxWindowDC
*/
#include <wx/mac/uma.h>
wxWindowDC::wxWindowDC(void)
{
};
}
wxWindowDC::wxWindowDC( wxWindow *window )
wxWindowDC::wxWindowDC(wxWindow *the_canvas)
{
};
WindowRef windowref ;
wxWindow* rootwindow ;
// this time it is really the full window
the_canvas->MacGetPortParams(&m_macLocalOrigin, &m_macClipRect , &windowref , &rootwindow );
m_macPort = UMAGetWindowPort( windowref ) ;
MacSetupPort() ;
m_ok = TRUE ;
}
wxWindowDC::~wxWindowDC(void)
{
};
void wxWindowDC::FloodFill( long WXUNUSED(x1), long WXUNUSED(y1),
const wxColour& WXUNUSED(col), int WXUNUSED(style) )
{
};
bool wxWindowDC::GetPixel( long WXUNUSED(x1), long WXUNUSED(y1), wxColour *WXUNUSED(col) ) const
{
return FALSE;
};
void wxWindowDC::DrawLine( long x1, long y1, long x2, long y2 )
{
if (!Ok()) return;
};
void wxWindowDC::CrossHair( long x, long y )
{
if (!Ok()) return;
};
void wxWindowDC::DrawArc( long x1, long y1, long x2, long y2, long xc, long yc )
{
if (!Ok()) return;
long xx1 = XLOG2DEV(x1);
long yy1 = YLOG2DEV(y1);
long xx2 = XLOG2DEV(x2);
long yy2 = YLOG2DEV(y2);
long xxc = XLOG2DEV((long)xc);
long yyc = YLOG2DEV((long)yc);
double dx = xx1 - xxc;
double dy = yy1 - yyc;
double radius = sqrt(dx*dx+dy*dy);
long r = (long)radius;
double radius1, radius2;
if (xx1 == xx2 && yy1 == yy2)
{
radius1 = 0.0;
radius2 = 360.0;
}
else
if (radius == 0.0)
{
radius1 = radius2 = 0.0;
}
else
{
radius1 = (xx1 - xxc == 0) ?
(yy1 - yyc < 0) ? 90.0 : -90.0 :
-atan2(double(yy1-yyc), double(xx1-xxc)) * RAD2DEG;
radius2 = (xx2 - xxc == 0) ?
(yy2 - yyc < 0) ? 90.0 : -90.0 :
-atan2(double(yy2-yyc), double(xx2-xxc)) * RAD2DEG;
};
long alpha1 = long(radius1 * 64.0);
long alpha2 = long((radius2 - radius1) * 64.0);
while (alpha2 <= 0) alpha2 += 360*64;
while (alpha1 > 360*64) alpha1 -= 360*64;
if (m_brush.GetStyle() != wxTRANSPARENT) {};
if (m_pen.GetStyle() != wxTRANSPARENT) {};
};
void wxWindowDC::DrawEllipticArc( long x, long y, long width, long height, double sa, double ea )
{
if (!Ok()) return;
long xx = XLOG2DEV(x);
long yy = YLOG2DEV(y);
long ww = m_signX * XLOG2DEVREL(width);
long hh = m_signY * YLOG2DEVREL(height);
// CMB: handle -ve width and/or height
if (ww < 0) { ww = -ww; xx = xx - ww; }
if (hh < 0) { hh = -hh; yy = yy - hh; }
long start = long(sa * 64.0);
long end = long(ea * 64.0);
if (m_brush.GetStyle() != wxTRANSPARENT) {};
if (m_pen.GetStyle() != wxTRANSPARENT) {};
};
void wxWindowDC::DrawPoint( long x, long y )
{
if (!Ok()) return;
if (m_pen.GetStyle() != wxTRANSPARENT) {};
};
void wxWindowDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset )
{
if (!Ok()) return;
if (m_pen.GetStyle() == wxTRANSPARENT) return;
for (int i = 0; i < n-1; i++)
{
long x1 = XLOG2DEV(points[i].x + xoffset);
long x2 = XLOG2DEV(points[i+1].x + xoffset);
long y1 = YLOG2DEV(points[i].y + yoffset); // oh, what a waste
long y2 = YLOG2DEV(points[i+1].y + yoffset);
};
};
void wxWindowDC::DrawLines( wxList *points, long xoffset, long yoffset )
{
if (!Ok()) return;
if (m_pen.GetStyle() == wxTRANSPARENT) return;
wxNode *node = points->First();
while (node->Next())
{
wxPoint *point = (wxPoint*)node->Data();
wxPoint *npoint = (wxPoint*)node->Next()->Data();
long x1 = XLOG2DEV(point->x + xoffset);
long x2 = XLOG2DEV(npoint->x + xoffset);
long y1 = YLOG2DEV(point->y + yoffset); // and again...
long y2 = YLOG2DEV(npoint->y + yoffset);
node = node->Next();
};
};
void wxWindowDC::DrawPolygon( int WXUNUSED(n), wxPoint WXUNUSED(points)[],
long WXUNUSED(xoffset), long WXUNUSED(yoffset), int WXUNUSED(fillStyle) )
{
if (!Ok()) return;
};
void wxWindowDC::DrawPolygon( wxList *WXUNUSED(lines), long WXUNUSED(xoffset),
long WXUNUSED(yoffset), int WXUNUSED(fillStyle) )
{
if (!Ok()) return;
};
void wxWindowDC::DrawRectangle( long x, long y, long width, long height )
{
if (!Ok()) return;
long xx = XLOG2DEV(x);
long yy = YLOG2DEV(y);
long ww = m_signX * XLOG2DEVREL(width);
long hh = m_signY * YLOG2DEVREL(height);
// CMB: draw nothing if transformed w or h is 0
if (ww == 0 || hh == 0) return;
// CMB: handle -ve width and/or height
if (ww < 0) { ww = -ww; xx = xx - ww; }
if (hh < 0) { hh = -hh; yy = yy - hh; }
if (m_brush.GetStyle() != wxTRANSPARENT) {};
if (m_pen.GetStyle() != wxTRANSPARENT) {};
};
void wxWindowDC::DrawRoundedRectangle( long x, long y, long width, long height, double radius )
{
if (!Ok()) return;
if (radius < 0.0) radius = - radius * ((width < height) ? width : height);
long xx = XLOG2DEV(x);
long yy = YLOG2DEV(y);
long ww = m_signX * XLOG2DEVREL(width);
long hh = m_signY * YLOG2DEVREL(height);
long rr = XLOG2DEVREL((long)radius);
// CMB: handle -ve width and/or height
if (ww < 0) { ww = -ww; xx = xx - ww; }
if (hh < 0) { hh = -hh; yy = yy - hh; }
// CMB: if radius is zero use DrawRectangle() instead to avoid
// X drawing errors with small radii
if (rr == 0)
{
DrawRectangle( x, y, width, height );
return;
}
// CMB: draw nothing if transformed w or h is 0
if (ww == 0 || hh == 0) return;
// CMB: adjust size if outline is drawn otherwise the result is
// 1 pixel too wide and high
if (m_pen.GetStyle() != wxTRANSPARENT)
{
ww--;
hh--;
}
// CMB: ensure dd is not larger than rectangle otherwise we
// get an hour glass shape
long dd = 2 * rr;
if (dd > ww) dd = ww;
if (dd > hh) dd = hh;
rr = dd / 2;
if (m_brush.GetStyle() != wxTRANSPARENT)
{
};
if (m_pen.GetStyle() != wxTRANSPARENT)
{
};
};
void wxWindowDC::DrawEllipse( long x, long y, long width, long height )
{
if (!Ok()) return;
long xx = XLOG2DEV(x);
long yy = YLOG2DEV(y);
long ww = m_signX * XLOG2DEVREL(width);
long hh = m_signY * YLOG2DEVREL(height);
// CMB: handle -ve width and/or height
if (ww < 0) { ww = -ww; xx = xx - ww; }
if (hh < 0) { hh = -hh; yy = yy - hh; }
if (m_brush.GetStyle() != wxTRANSPARENT) {};
if (m_pen.GetStyle() != wxTRANSPARENT) {};
};
bool wxWindowDC::CanDrawBitmap(void) const
{
return TRUE;
};
void wxWindowDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
{
if (!Ok()) return;
if (!icon.Ok()) return;
int xx = XLOG2DEV(x);
int yy = YLOG2DEV(y);
};
bool wxWindowDC::Blit( long xdest, long ydest, long width, long height,
wxDC *source, long xsrc, long ysrc, int WXUNUSED(logical_func), bool WXUNUSED(useMask) )
{
if (!Ok()) return FALSE;
// CMB 20/5/98: add blitting of bitmaps
if (source->IsKindOf(CLASSINFO(wxMemoryDC)))
{
wxMemoryDC* srcDC = (wxMemoryDC*)source;
/*
GdkBitmap* bmap = srcDC->m_selected.GetBitmap();
if (bmap)
{
gdk_draw_bitmap (
m_window,
m_textGC,
bmap,
source->DeviceToLogicalX(xsrc), source->DeviceToLogicalY(ysrc),
XLOG2DEV(xdest), YLOG2DEV(ydest),
source->DeviceToLogicalXRel(width), source->DeviceToLogicalYRel(height)
);
return TRUE;
}
*/
}
return TRUE;
};
void wxWindowDC::DrawText( const wxString &text, long x, long y, bool
WXUNUSED(use16) )
{
if (!Ok()) return;
};
bool wxWindowDC::CanGetTextExtent(void) const
{
return TRUE;
};
void wxWindowDC::GetTextExtent( const wxString &string, long *width, long *height,
long *WXUNUSED(descent), long *WXUNUSED(externalLeading),
wxFont *WXUNUSED(theFont), bool WXUNUSED(use16) )
{
if (!Ok()) return;
};
long wxWindowDC::GetCharWidth(void)
{
if (!Ok()) return 0;
return 0;
};
long wxWindowDC::GetCharHeight(void)
{
if (!Ok()) return 0;
return 0;
};
void wxWindowDC::Clear(void)
{
if (!Ok()) return;
};
void wxWindowDC::SetFont( const wxFont &font )
{
if (!Ok()) return;
m_font = font;
};
void wxWindowDC::SetPen( const wxPen &pen )
{
if (!Ok()) return;
if (m_pen == pen) return;
m_pen = pen;
if (!m_pen.Ok()) return;
};
void wxWindowDC::SetBrush( const wxBrush &brush )
{
if (!Ok()) return;
if (m_brush == brush) return;
m_brush = brush;
if (!m_brush.Ok()) return;
};
void wxWindowDC::SetBackground( const wxBrush &brush )
{
if (!Ok()) return;
if (m_backgroundBrush == brush) return;
m_backgroundBrush = brush;
if (!m_backgroundBrush.Ok()) return;
};
void wxWindowDC::SetLogicalFunction( int function )
{
if (m_logicalFunction == function) return;
};
void wxWindowDC::SetTextForeground( const wxColour &col )
{
if (!Ok()) return;
if (m_textForegroundColour == col) return;
m_textForegroundColour = col;
if (!m_textForegroundColour.Ok()) return;
};
void wxWindowDC::SetTextBackground( const wxColour &col )
{
if (!Ok()) return;
if (m_textBackgroundColour == col) return;
m_textBackgroundColour = col;
if (!m_textBackgroundColour.Ok()) return;
};
void wxWindowDC::SetBackgroundMode( int mode )
{
m_backgroundMode = mode;
if (m_brush.GetStyle() != wxSOLID && m_brush.GetStyle() != wxTRANSPARENT)
{
}
};
void wxWindowDC::SetPalette( const wxPalette& WXUNUSED(palette) )
{
};
void wxWindowDC::SetClippingRegion( long x, long y, long width, long height )
{
wxDC::SetClippingRegion( x, y, width, height );
// TODO
};
void wxWindowDC::SetClippingRegion( const wxRegion& region )
{
wxRect box = region.GetBox();
wxDC::SetClippingRegion( box.x, box.y, box.width, box.height );
// TODO
}
void wxWindowDC::DestroyClippingRegion(void)
/*
* wxClientDC
*/
wxClientDC::wxClientDC(void)
{
wxDC::DestroyClippingRegion();
};
// ----------------------------------- spline code ----------------------------------------
void wx_quadratic_spline(double a1, double b1, double a2, double b2,
double a3, double b3, double a4, double b4);
void wx_clear_stack(void);
int wx_spline_pop(double *x1, double *y1, double *x2, double *y2, double *x3,
double *y3, double *x4, double *y4);
void wx_spline_push(double x1, double y1, double x2, double y2, double x3, double y3,
double x4, double y4);
static bool wx_spline_add_point(double x, double y);
static void wx_spline_draw_point_array(wxDC *dc);
wxList wx_spline_point_list;
#define half(z1, z2) ((z1+z2)/2.0)
#define THRESHOLD 5
/* iterative version */
void wx_quadratic_spline(double a1, double b1, double a2, double b2, double a3, double b3, double a4,
double b4)
{
register double xmid, ymid;
double x1, y1, x2, y2, x3, y3, x4, y4;
wx_clear_stack();
wx_spline_push(a1, b1, a2, b2, a3, b3, a4, b4);
while (wx_spline_pop(&x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)) {
xmid = (double)half(x2, x3);
ymid = (double)half(y2, y3);
if (fabs(x1 - xmid) < THRESHOLD && fabs(y1 - ymid) < THRESHOLD &&
fabs(xmid - x4) < THRESHOLD && fabs(ymid - y4) < THRESHOLD) {
wx_spline_add_point( x1, y1 );
wx_spline_add_point( xmid, ymid );
} else {
wx_spline_push(xmid, ymid, (double)half(xmid, x3), (double)half(ymid, y3),
(double)half(x3, x4), (double)half(y3, y4), x4, y4);
wx_spline_push(x1, y1, (double)half(x1, x2), (double)half(y1, y2),
(double)half(x2, xmid), (double)half(y2, ymid), xmid, ymid);
}
}
}
/* utilities used by spline drawing routines */
typedef struct wx_spline_stack_struct {
double x1, y1, x2, y2, x3, y3, x4, y4;
} Stack;
#define SPLINE_STACK_DEPTH 20
static Stack wx_spline_stack[SPLINE_STACK_DEPTH];
static Stack *wx_stack_top;
static int wx_stack_count;
void wx_clear_stack(void)
wxClientDC::wxClientDC(wxWindow *window)
{
wx_stack_top = wx_spline_stack;
wx_stack_count = 0;
WindowRef windowref ;
wxWindow* rootwindow ;
window->MacGetPortClientParams(&m_macLocalOrigin, &m_macClipRect , &windowref , &rootwindow );
m_macPort = UMAGetWindowPort( windowref ) ;
MacSetupPort() ;
m_ok = TRUE ;
SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID));
}
void wx_spline_push(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
wxClientDC::~wxClientDC(void)
{
wx_stack_top->x1 = x1;
wx_stack_top->y1 = y1;
wx_stack_top->x2 = x2;
wx_stack_top->y2 = y2;
wx_stack_top->x3 = x3;
wx_stack_top->y3 = y3;
wx_stack_top->x4 = x4;
wx_stack_top->y4 = y4;
wx_stack_top++;
wx_stack_count++;
}
int wx_spline_pop(double *x1, double *y1, double *x2, double *y2,
double *x3, double *y3, double *x4, double *y4)
/*
* wxPaintDC
*/
wxPaintDC::wxPaintDC(void)
{
if (wx_stack_count == 0)
return (0);
wx_stack_top--;
wx_stack_count--;
*x1 = wx_stack_top->x1;
*y1 = wx_stack_top->y1;
*x2 = wx_stack_top->x2;
*y2 = wx_stack_top->y2;
*x3 = wx_stack_top->x3;
*y3 = wx_stack_top->y3;
*x4 = wx_stack_top->x4;
*y4 = wx_stack_top->y4;
return (1);
}
static bool wx_spline_add_point(double x, double y)
wxPaintDC::wxPaintDC(wxWindow *window)
{
wxPoint *point = new wxPoint ;
point->x = (int) x;
point->y = (int) y;
wx_spline_point_list.Append((wxObject*)point);
return TRUE;
WindowRef windowref ;
wxWindow* rootwindow ;
window->MacGetPortClientParams(&m_macLocalOrigin, &m_macClipRect , &windowref , &rootwindow );
m_macPort = UMAGetWindowPort( windowref ) ;
MacSetupPort() ;
m_ok = TRUE ;
long x , y ,w , h ;
window->GetUpdateRegion().GetBox( x , y , w , h ) ;
SetClippingRegion( x , y , w , h ) ;
SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID));
}
static void wx_spline_draw_point_array(wxDC *dc)
wxPaintDC::~wxPaintDC()
{
dc->DrawLines(&wx_spline_point_list, 0, 0 );
wxNode *node = wx_spline_point_list.First();
while (node)
{
wxPoint *point = (wxPoint *)node->Data();
delete point;
delete node;
node = wx_spline_point_list.First();
}
}
void wxWindowDC::DrawSpline( wxList *points )
{
wxPoint *p;
double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
double x1, y1, x2, y2;
wxNode *node = points->First();
p = (wxPoint *)node->Data();
x1 = p->x;
y1 = p->y;
node = node->Next();
p = (wxPoint *)node->Data();
x2 = p->x;
y2 = p->y;
cx1 = (double)((x1 + x2) / 2);
cy1 = (double)((y1 + y2) / 2);
cx2 = (double)((cx1 + x2) / 2);
cy2 = (double)((cy1 + y2) / 2);
wx_spline_add_point(x1, y1);
while ((node = node->Next()) != NULL)
{
p = (wxPoint *)node->Data();
x1 = x2;
y1 = y2;
x2 = p->x;
y2 = p->y;
cx4 = (double)(x1 + x2) / 2;
cy4 = (double)(y1 + y2) / 2;
cx3 = (double)(x1 + cx4) / 2;
cy3 = (double)(y1 + cy4) / 2;
wx_quadratic_spline(cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4);
cx1 = cx4;
cy1 = cy4;
cx2 = (double)(cx1 + x2) / 2;
cy2 = (double)(cy1 + y2) / 2;
}
wx_spline_add_point( cx1, cy1 );
wx_spline_add_point( x2, y2 );
wx_spline_draw_point_array( this );
};

View File

@@ -40,6 +40,18 @@ void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
m_selected = bitmap;
if (m_selected.Ok())
{
wxBitmapRefData * bmap = (wxBitmapRefData*) (m_selected.GetRefData()) ;
if ( bmap->m_hBitmap )
{
m_macPort = (GrafPtr) bmap->m_hBitmap ;
MacSetupPort() ;
m_ok = TRUE ;
// SetBackground(wxBrush(*wxWHITE, wxSOLID));
}
else
{
m_ok = FALSE;
}
}
else
{

View File

@@ -22,7 +22,9 @@ IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
// Create a DC representing the whole screen
wxScreenDC::wxScreenDC()
{
// TODO
m_macPort = LMGetWMgrPort() ;
MacSetupPort() ;
m_ok = TRUE ;
}
wxScreenDC::~wxScreenDC()

View File

@@ -19,6 +19,8 @@
#include "wx/app.h"
#include "wx/settings.h"
#include <wx/mac/uma.h>
// Lists to keep track of windows, so we can disable/enable them
// for modal dialogs
wxList wxModalDialogs;
@@ -29,6 +31,7 @@ extern wxList wxPendingDelete;
IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxPanel)
BEGIN_EVENT_TABLE(wxDialog, wxPanel)
EVT_SIZE(wxDialog::OnSize)
EVT_BUTTON(wxID_OK, wxDialog::OnOK)
EVT_BUTTON(wxID_APPLY, wxDialog::OnApply)
EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel)
@@ -66,9 +69,47 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
else
m_windowId = id;
// TODO: create dialog
Rect theBoundsRect;
return FALSE;
m_x = (int)pos.x;
m_y = (int)pos.y;
if ( m_y < 50 )
m_y = 50 ;
if ( m_x < 20 )
m_x = 20 ;
m_width = size.x;
if (m_width == -1)
m_width = 20;
m_height = size.y;
if (m_height == -1)
m_height = 20;
::SetRect(&theBoundsRect, m_x, m_y, m_x + m_width, m_y + m_height);
m_macWindowData = new MacWindowData() ;
WindowClass wclass = kMovableModalWindowClass ;
WindowAttributes attr = kWindowNoAttributes ;
if ( ( m_windowStyle & wxMINIMIZE_BOX ) || ( m_windowStyle & wxMAXIMIZE_BOX ) )
{
attr |= kWindowFullZoomAttribute ;
attr |= kWindowResizableAttribute ;
}
UMACreateNewWindow( wclass , attr , &theBoundsRect , &m_macWindowData->m_macWindow ) ;
wxAssociateWinWithMacWindow( m_macWindowData->m_macWindow , this ) ;
wxString label ;
if( wxApp::s_macDefaultEncodingIsPC )
label = wxMacMakeMacStringFromPC( title ) ;
else
label = title ;
UMASetWTitleC( m_macWindowData->m_macWindow , label ) ;
m_macWindowData->m_macWindowBackgroundTheme = kThemeBrushDialogBackgroundActive ;
UMACreateRootControl( m_macWindowData->m_macWindow , &m_macWindowData->m_macRootControl ) ;
m_macWindowData->m_macFocus = NULL ;
m_macShown = false ;
return TRUE;
}
void wxDialog::SetModal(bool flag)
@@ -86,7 +127,6 @@ void wxDialog::SetModal(bool flag)
wxDialog::~wxDialog()
{
// TODO
wxTopLevelWindows.DeleteObject(this);
if ( (GetWindowStyleFlag() & wxDIALOG_MODAL) != wxDIALOG_MODAL )
@@ -99,7 +139,7 @@ wxDialog::~wxDialog()
if (wxTheApp->GetExitOnFrameDelete())
{
// TODO: exit
wxTheApp->ExitMainLoop() ;
}
}
}
@@ -132,67 +172,65 @@ bool wxDialog::IsIconized() const
return FALSE;
}
void wxDialog::SetClientSize(int width, int height)
{
// TODO
}
void wxDialog::GetPosition(int *x, int *y) const
{
// TODO
}
extern bool s_macIsInModalLoop ;
bool wxDialog::Show(bool show)
{
// TODO
return FALSE;
if ( m_macShown == show )
return TRUE ;
m_macShown = show ;
bool modal = ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL) ;
if ( modal )
{
s_macIsInModalLoop = true ;
if (show)
{
// if we don't do it, some window might be deleted while we have pointers
// to them in our disabledWindows list and the program will crash when it
// will try to reenable them after the modal dialog end
wxTheApp->DeletePendingObjects();
UMAShowWindow( m_macWindowData->m_macWindow ) ;
UMASelectWindow( m_macWindowData->m_macWindow ) ;
if (!wxModalDialogs.Member(this))
wxModalDialogs.Append(this);
while (wxModalDialogs.Member(this) )
{
wxTheApp->MacDoOneEvent() ;
}
}
else
{
wxModalDialogs.DeleteObject(this);
UMAHideWindow( m_macWindowData->m_macWindow ) ;
}
s_macIsInModalLoop = false ;
}
else // !modal
{
if (show)
{
UMAShowWindow( m_macWindowData->m_macWindow ) ;
UMASelectWindow( m_macWindowData->m_macWindow ) ;
}
else
{
UMAHideWindow( m_macWindowData->m_macWindow ) ;
}
}
return TRUE ;
}
void wxDialog::SetTitle(const wxString& title)
{
// TODO
}
wxString wxDialog::GetTitle() const
{
// TODO
return wxString("");
}
void wxDialog::Centre(int direction)
{
int x_offset,y_offset ;
int display_width, display_height;
int width, height, x, y;
wxWindow *parent = GetParent();
if ((direction & wxCENTER_FRAME) && parent)
{
parent->GetPosition(&x_offset,&y_offset) ;
parent->GetSize(&display_width,&display_height) ;
}
else
{
wxDisplaySize(&display_width, &display_height);
x_offset = 0 ;
y_offset = 0 ;
}
GetSize(&width, &height);
GetPosition(&x, &y);
if (direction & wxHORIZONTAL)
x = (int)((display_width - width)/2);
if (direction & wxVERTICAL)
y = (int)((display_height - height)/2);
SetSize(x+x_offset, y+y_offset, width, height);
}
// Replacement for Show(TRUE) for modal dialogs - returns return code
int wxDialog::ShowModal()
{
m_windowStyle |= wxDIALOG_MODAL;
// TODO: modal showing
m_windowStyle |= wxDIALOG_MODAL;
Show(TRUE);
return GetReturnCode();
}
@@ -275,6 +313,16 @@ bool wxDialog::Destroy()
return TRUE;
}
void wxDialog::OnSize(wxSizeEvent& WXUNUSED(event))
{
// if we're using constraints - do use them
#if wxUSE_CONSTRAINTS
if ( GetAutoLayout() ) {
Layout();
}
#endif
}
void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& event)
{
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
@@ -283,4 +331,128 @@ void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& event)
void wxDialog::Fit()
{
wxWindow::Fit();
}
wxSizer *wxDialog::CreateTextSizer( const wxString &message )
{
wxBoxSizer *box = new wxBoxSizer( wxVERTICAL );
// get line height for empty lines
int y = 0;
wxFont new_font( GetFont() );
if (!new_font.Ok()) new_font = *wxSWISS_FONT;
GetTextExtent( "H", (int*)NULL, &y, (int*)NULL, (int*)NULL, &new_font );
wxString line;
for (size_t pos = 0; pos < message.Len(); pos++)
{
if (message[pos] == _T('\n'))
{
if (!line.IsEmpty())
{
wxStaticText *s1 = new wxStaticText( this, -1, line );
box->Add( s1 );
line = _T("");
}
else
{
box->Add( 5, y );
}
}
else
{
line += message[pos];
}
}
// remaining text behind last '\n'
if (!line.IsEmpty())
{
wxStaticText *s2 = new wxStaticText( this, -1, line );
box->Add( s2 );
}
return box;
}
wxSizer *wxDialog::CreateButtonSizer( long flags )
{
wxBoxSizer *box = new wxBoxSizer( wxHORIZONTAL );
#if defined(__WXMSW__) || defined(__WXMAC__)
int margin = 6;
#else
int margin = 10;
#endif
wxButton *ok = (wxButton *) NULL;
wxButton *cancel = (wxButton *) NULL;
wxButton *yes = (wxButton *) NULL;
wxButton *no = (wxButton *) NULL;
// always show an OK button, unless only YES_NO is given
if ((flags & wxYES_NO) == 0) flags = flags | wxOK;
if (flags & wxYES_NO)
{
yes = new wxButton( this, wxID_YES, _("Yes") );
box->Add( yes, 0, wxLEFT|wxRIGHT, margin );
no = new wxButton( this, wxID_NO, _("No") );
box->Add( no, 0, wxLEFT|wxRIGHT, margin );
} else
if (flags & wxYES)
{
yes = new wxButton( this, wxID_YES, _("Yes") );
box->Add( yes, 0, wxLEFT|wxRIGHT, margin );
} else
if (flags & wxNO)
{
no = new wxButton( this, wxID_NO, _("No") );
box->Add( no, 0, wxLEFT|wxRIGHT, margin );
}
if (flags & wxOK)
{
ok = new wxButton( this, wxID_OK, _("OK") );
box->Add( ok, 0, wxLEFT|wxRIGHT, margin );
}
if (flags & wxFORWARD)
box->Add( new wxButton( this, wxID_FORWARD, _("Forward") ), 0, wxLEFT|wxRIGHT, margin );
if (flags & wxBACKWARD)
box->Add( new wxButton( this, wxID_BACKWARD, _("Backward") ), 0, wxLEFT|wxRIGHT, margin );
if (flags & wxSETUP)
box->Add( new wxButton( this, wxID_SETUP, _("Setup") ), 0, wxLEFT|wxRIGHT, margin );
if (flags & wxMORE)
box->Add( new wxButton( this, wxID_MORE, _("More...") ), 0, wxLEFT|wxRIGHT, margin );
if (flags & wxHELP)
box->Add( new wxButton( this, wxID_HELP, _("Help") ), 0, wxLEFT|wxRIGHT, margin );
if (flags & wxCANCEL)
{
cancel = new wxButton( this, wxID_CANCEL, _("Cancel") );
box->Add( cancel, 0, wxLEFT|wxRIGHT, margin );
}
if ((flags & wxNO_DEFAULT) == 0)
{
if (ok)
{
ok->SetDefault();
ok->SetFocus();
}
else if (yes)
{
yes->SetDefault();
yes->SetFocus();
}
}
return box;
}

View File

@@ -24,6 +24,407 @@
IMPLEMENT_CLASS(wxDirDialog, wxDialog)
#endif
enum {
kSelectItem = 10, // select button item number
kSFGetFolderDlgID = 250, // dialog resource number
kStrListID = 250, // our strings
kSelectStrNum = 1, // word 'Select: ' for button
kDesktopStrNum = 2, // word 'Desktop' for button
kSelectNoQuoteStrNum = 3, // word 'Select: ' for button
kUseQuotes = true, // parameter for SetButtonName
kDontUseQuotes = false
};
// the data we need to pass to our standard file hook routine
// includes a pointer to the dialog, a pointer to the standard
// file reply record (so we can inspect the current selection)
// and a copy of the "previous" file spec of the reply record
// so we can see if the selection has changed
struct UserDataRec {
StandardFileReply *sfrPtr;
FSSpec oldSelectionFSSpec;
DialogPtr theDlgPtr;
};
typedef struct UserDataRec
UserDataRec, *UserDataRecPtr;
static void GetLabelString(StringPtr theStr, short stringNum)
{
GetIndString(theStr, kStrListID, stringNum);
}
static void CopyPStr(StringPtr src, StringPtr dest)
{
BlockMoveData(src, dest, 1 + src[0]);
}
static char GetSelectKey(void)
{
// this is the key used to trigger the select button
// NOT INTERNATIONAL SAVVY; should at least grab it from resources
return 's';
}
// SetButtonName sets the name of the Select button in the dialog
//
// To do this, we need to call the Script Manager to truncate the
// label in the middle to fit the button and to merge the button
// name with the word Select (possibly followed by quotes). Using
// the Script Manager avoids all sorts of problems internationally.
//
// buttonName is the name to appear following the word Select
// quoteFlag should be true if the name is to appear in quotes
static void SetButtonName(DialogPtr theDlgPtr, short buttonID, StringPtr buttonName,
Boolean quoteFlag)
{
short buttonType;
Handle buttonHandle;
Rect buttonRect;
short textWidth;
Handle labelHandle;
Handle nameHandle;
Str15 keyStr;
Str255 labelStr;
OSErr err;
nameHandle = nil;
labelHandle = nil;
// get the details of the button from the dialog
GetDialogItem(theDlgPtr, buttonID, &buttonType, &buttonHandle, &buttonRect);
// get the string for the select button label, "Select ^0" or "Select <20>^0<>"
GetLabelString(labelStr, (quoteFlag == kUseQuotes) ? kSelectStrNum : kSelectNoQuoteStrNum);
// make string handles containing the select button label and the
// file name to be stuffed into the button
err = PtrToHand(&labelStr[1], &labelHandle, labelStr[0]);
if (err != noErr) goto Bail;
// cut out the middle of the file name to fit the button
//
// we'll temporarily use labelStr here to hold the modified button name
// since we don't own the buttonName string storage space
textWidth = (buttonRect.right - buttonRect.left) - StringWidth(labelStr);
CopyPStr(buttonName, labelStr);
(void) TruncString(textWidth, labelStr, smTruncMiddle);
err = PtrToHand(&labelStr[1], &nameHandle, labelStr[0]);
if (err != noErr) goto Bail;
// replace the ^0 in the Select string with the file name
CopyPStr("\p^0", keyStr);
(void) ReplaceText(labelHandle, nameHandle, keyStr);
labelStr[0] = (unsigned char) GetHandleSize(labelHandle);
BlockMoveData(*labelHandle, &labelStr[1], labelStr[0]);
// now set the control title, and re-validate the area
// above the control to avoid a needless redraw
SetControlTitle((ControlHandle) buttonHandle, labelStr);
ValidRect(&buttonRect);
Bail:
if (nameHandle) DisposeHandle(nameHandle);
if (labelHandle) DisposeHandle(labelHandle);
}
// FlashButton briefly highlights the dialog button
// as feedback for key equivalents
static void FlashButton(DialogPtr theDlgPtr, short buttonID)
{
short buttonType;
Handle buttonHandle;
Rect buttonRect;
unsigned long finalTicks;
GetDialogItem(theDlgPtr, buttonID, &buttonType, &buttonHandle, &buttonRect);
HiliteControl((ControlHandle) buttonHandle, kControlButtonPart);
Delay(10, &finalTicks);
HiliteControl((ControlHandle) buttonHandle, 0);
}
static Boolean SameFSSpec(FSSpecPtr spec1, FSSpecPtr spec2)
{
return (spec1->vRefNum == spec2->vRefNum
&& spec1->parID == spec2->parID
&& EqualString(spec1->name, spec2->name, false, false));
}
// MyModalDialogFilter maps a key to the Select button, and handles
// flashing of the button when the key is hit
static pascal Boolean SFGetFolderModalDialogFilter(DialogPtr theDlgPtr, EventRecord *eventRec,
short *item, Ptr dataPtr)
{
#pragma unused (dataPtr)
// make certain the proper dialog is showing, 'cause standard file
// can nest dialogs but calls the same filter for each
if (((WindowPeek) theDlgPtr)->refCon == sfMainDialogRefCon)
{
// check if the select button was hit
if ((eventRec->what == keyDown)
&& (eventRec->modifiers & cmdKey)
&& ((eventRec->message & charCodeMask) == GetSelectKey()))
{
*item = kSelectItem;
FlashButton(theDlgPtr, kSelectItem);
return true;
}
}
return false;
}
// MyDlgHook is a hook routine that maps the select button to Open
// and sets the Select button name
static pascal short SFGetFolderDialogHook(short item, DialogPtr theDlgPtr, Ptr dataPtr)
{
UserDataRecPtr theUserDataRecPtr;
long desktopDirID;
short desktopVRefNum;
FSSpec tempSpec;
Str63 desktopName;
OSErr err;
// be sure Std File is really showing us the intended dialog,
// not a nested modal dialog
if (((WindowPeek) theDlgPtr)->refCon != sfMainDialogRefCon)
{
return item;
}
theUserDataRecPtr = (UserDataRecPtr) dataPtr;
// map the Select button to Open
if (item == kSelectItem)
{
item = sfItemOpenButton;
}
// find the desktop folder
err = FindFolder(theUserDataRecPtr->sfrPtr->sfFile.vRefNum,
kDesktopFolderType, kDontCreateFolder,
&desktopVRefNum, &desktopDirID);
if (err != noErr)
{
// for errors, get value that won't match any real vRefNum/dirID
desktopVRefNum = 0;
desktopDirID = 0;
}
// change the Select button label if the selection has changed or
// if this is the first call to the hook
if (item == sfHookFirstCall
|| item == sfHookChangeSelection
|| item == sfHookRebuildList
|| ! SameFSSpec(&theUserDataRecPtr->sfrPtr->sfFile,
&theUserDataRecPtr->oldSelectionFSSpec))
{
// be sure there is a file name selected
if (theUserDataRecPtr->sfrPtr->sfFile.name[0] != '\0')
{
SetButtonName(theDlgPtr, kSelectItem,
theUserDataRecPtr->sfrPtr->sfFile.name,
kUseQuotes); // true -> use quotes
}
else
{
// is the desktop selected?
if (theUserDataRecPtr->sfrPtr->sfFile.vRefNum == desktopVRefNum
&& theUserDataRecPtr->sfrPtr->sfFile.parID == desktopDirID)
{
// set button to "Select Desktop"
GetLabelString(desktopName, kDesktopStrNum);
SetButtonName(theDlgPtr, kSelectItem,
desktopName, kDontUseQuotes); // false -> no quotes
}
else
{
// get parent directory's name for the Select button
//
// passing an empty name string to FSMakeFSSpec gets the
// name of the folder specified by the parID parameter
(void) FSMakeFSSpec(theUserDataRecPtr->sfrPtr->sfFile.vRefNum,
theUserDataRecPtr->sfrPtr->sfFile.parID, "\p",
&tempSpec);
SetButtonName(theDlgPtr, kSelectItem,
tempSpec.name, kUseQuotes); // true -> use quotes
}
}
}
// save the current selection as the old selection for comparison next time
//
// it's not valid on the first call, though, or if we don't have a
// name available from standard file
if (item != sfHookFirstCall || theUserDataRecPtr->sfrPtr->sfFile.name[0] != '\0')
{
theUserDataRecPtr->oldSelectionFSSpec = theUserDataRecPtr->sfrPtr->sfFile;
}
else
{
// on first call, empty string won't set the button correctly,
// so invalidate oldSelection
theUserDataRecPtr->oldSelectionFSSpec.vRefNum = 999;
theUserDataRecPtr->oldSelectionFSSpec.parID = 0;
}
return item;
}
void StandardGetFolder( ConstStr255Param message , ConstStr255Param path , FileFilterYDUPP fileFilter, StandardFileReply *theSFR)
{
Point thePt;
SFTypeList mySFTypeList;
UserDataRec myData;
FSSpec tempSpec;
Boolean folderFlag;
Boolean wasAliasedFlag;
DlgHookYDUPP dlgHookUPP;
ModalFilterYDUPP myModalFilterUPP;
OSErr err;
// presumably we're running System 7 or later so CustomGetFile is
// available
// set initial contents of Select button to a space
CopyPStr("\p ", theSFR->sfFile.name);
// point the user data parameter at the reply record so we can get to it later
myData.sfrPtr = theSFR;
// display the dialog
dlgHookUPP = NewDlgHookYDProc(SFGetFolderDialogHook);
myModalFilterUPP = NewModalFilterYDProc(SFGetFolderModalDialogFilter);
thePt.h = thePt.v = -1; // center dialog
ParamText( message , NULL , NULL , NULL ) ;
CustomGetFile( fileFilter,
-1, // show all types
mySFTypeList,
theSFR,
kSFGetFolderDlgID,
thePt, // top left point
dlgHookUPP,
myModalFilterUPP,
nil, // activate list
nil, // activate proc
&myData);
DisposeRoutineDescriptor(dlgHookUPP);
DisposeRoutineDescriptor(myModalFilterUPP);
// if cancel wasn't pressed and no fatal error occurred...
if (theSFR->sfGood)
{
// if no name is in the reply record file spec,
// use the file spec of the parent folder
if (theSFR->sfFile.name[0] == '\0')
{
err = FSMakeFSSpec(theSFR->sfFile.vRefNum, theSFR->sfFile.parID,
"\p", &tempSpec);
if (err == noErr)
{
theSFR->sfFile = tempSpec;
}
else
{
// no name to return, forget it
theSFR->sfGood = false;
}
}
// if there is now a name in the file spec, check if it's
// for a folder or a volume
if (theSFR->sfFile.name[0] != '\0')
{
// the parID of the root of a disk is always fsRtParID == 1
if (theSFR->sfFile.parID == fsRtParID)
{
theSFR->sfIsVolume = true;
theSFR->sfIsFolder = false; // it would be reasonable for this to be true, too
}
// we have a valid FSSpec, now let's make sure it's not for an alias file
err = ResolveAliasFile(&theSFR->sfFile, true, &folderFlag, &wasAliasedFlag);
if (err != noErr)
{
theSFR->sfGood = false;
}
// did the alias resolve to a folder?
if (folderFlag && ! theSFR->sfIsVolume)
{
theSFR->sfIsFolder = true;
}
}
}
}
static pascal Boolean OnlyVisibleFoldersCustomFileFilter(CInfoPBPtr myCInfoPBPtr, Ptr dataPtr)
{
#pragma unused (dataPtr)
// return true if this item is invisible or a file
Boolean visibleFlag;
Boolean folderFlag;
visibleFlag = ! (myCInfoPBPtr->hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible);
folderFlag = (myCInfoPBPtr->hFileInfo.ioFlAttrib & 0x10);
// because the semantics of the filter proc are "true means don't show
// it" we need to invert the result that we return
return !(visibleFlag && folderFlag);
}
wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message,
const wxString& defaultPath,
long style, const wxPoint& pos)
@@ -36,7 +437,35 @@ wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message,
int wxDirDialog::ShowModal()
{
// TODO
{
Str255 prompt ;
Str255 path ;
strcpy((char *)prompt, m_message) ;
c2pstr((char *)prompt ) ;
strcpy((char *)path, m_path ) ;
c2pstr((char *)path ) ;
FileFilterYDUPP invisiblesExcludedCustomFilterUPP;
StandardFileReply reply ;
invisiblesExcludedCustomFilterUPP =
NewFileFilterYDProc(OnlyVisibleFoldersCustomFileFilter);
StandardGetFolder( prompt , path , invisiblesExcludedCustomFilterUPP, &reply);
DisposeRoutineDescriptor(invisiblesExcludedCustomFilterUPP);
if ( reply.sfGood == false )
{
m_path = "" ;
return wxID_CANCEL ;
}
else
{
m_path = wxMacFSSpec2UnixFilename( &reply.sfFile ) ;
return wxID_OK ;
}
}
return wxID_CANCEL;
}

View File

@@ -23,7 +23,352 @@
IMPLEMENT_CLASS(wxFileDialog, wxDialog)
#endif
WXDLLEXPORT wxString wxFileSelector(const char *title,
// begin wxmac
#include "morefile.h"
#include "moreextr.h"
#include "fullpath.h"
#include "fspcompa.h"
#include "PLStringFuncs.h"
char * gfilters[] =
{
"*.TXT" ,
NULL
} ;
OSType gfiltersmac[] =
{
'TEXT' ,
'****'
} ;
static void wxMacSetupStandardFile(short newVRefNum, long newDirID)
{
enum
{ SFSaveDisk = 0x214, CurDirStore = 0x398 };
*(short *) SFSaveDisk = -1 * newVRefNum;
*(long *) CurDirStore = newDirID;
}
static void wxMacSetupStandardFileFromPath( const char* s )
{
Str255 volume ;
Str255 path ;
short vRefNum ;
long dirRef ;
short i,j ;
Boolean isDirectory ;
for (i=0 ; (s[i]!=0) && (s[i]!=':') ;i++)
{
volume[i]=s[i] ;
}
volume[i]=':' ;
volume[i+1]=0 ;
// then copy the rest of the filename
for (j=0;(s[i]!=0);i++,j++)
{
path[j]=s[i] ;
}
path[j]=0 ;
c2pstr((Ptr) volume) ;
c2pstr((Ptr) path) ;
SetVol(volume, 0) ;
GetVol( NULL, &vRefNum ) ;
GetDirectoryID( vRefNum , fsRtDirID , path , &dirRef , &isDirectory ) ;
wxMacSetupStandardFile(vRefNum, dirRef) ;
}
enum {
kSelectItem = 10, // select button item number
kSFGetFileDlgID = 251, // dialog resource number
kStrListID = 251, // our strings
kSelectStrNum = 1, // word 'Select: ' for button
kDesktopStrNum = 2, // word 'Desktop' for button
kSelectNoQuoteStrNum = 3, // word 'Select: ' for button
kUseQuotes = true, // parameter for SetButtonName
kDontUseQuotes = false
};
// the data we need to pass to our standard file hook routine
// includes a pointer to the dialog, a pointer to the standard
// file reply record (so we can inspect the current selection)
// and a copy of the "previous" file spec of the reply record
// so we can see if the selection has changed
const int kwxMacFileTypes = 10 ;
struct OpenUserDataRec {
StandardFileReply *sfrPtr;
FSSpec oldSelectionFSSpec;
char filter[kwxMacFileTypes][10] ;
OSType filtermactypes[kwxMacFileTypes] ;
int numfilters ;
DialogPtr theDlgPtr;
};
typedef struct OpenUserDataRec
OpenUserDataRec, *OpenUserDataRecPtr;
static void GetLabelString(StringPtr theStr, short stringNum)
{
GetIndString(theStr, kStrListID, stringNum);
}
static void CopyPStr(StringPtr src, StringPtr dest)
{
BlockMoveData(src, dest, 1 + src[0]);
}
static char GetSelectKey(void)
{
// this is the key used to trigger the select button
// NOT INTERNATIONAL SAVVY; should at least grab it from resources
return 's';
}
// FlashButton briefly highlights the dialog button
// as feedback for key equivalents
static void FlashButton(DialogPtr theDlgPtr, short buttonID)
{
short buttonType;
Handle buttonHandle;
Rect buttonRect;
unsigned long finalTicks;
GetDialogItem(theDlgPtr, buttonID, &buttonType, &buttonHandle, &buttonRect);
HiliteControl((ControlHandle) buttonHandle, kControlButtonPart);
Delay(10, &finalTicks);
HiliteControl((ControlHandle) buttonHandle, 0);
}
static Boolean SameFSSpec(FSSpecPtr spec1, FSSpecPtr spec2)
{
return (spec1->vRefNum == spec2->vRefNum
&& spec1->parID == spec2->parID
&& EqualString(spec1->name, spec2->name, false, false));
}
// MyModalDialogFilter maps a key to the Select button, and handles
// flashing of the button when the key is hit
static pascal Boolean SFGetFolderModalDialogFilter(DialogPtr theDlgPtr, EventRecord *eventRec,
short *item, Ptr dataPtr)
{
#pragma unused (dataPtr)
// make certain the proper dialog is showing, 'cause standard file
// can nest dialogs but calls the same filter for each
if (((WindowPeek) theDlgPtr)->refCon == sfMainDialogRefCon)
{
// check if the select button was hit
/*
if ((eventRec->what == keyDown)
&& (eventRec->modifiers & cmdKey)
&& ((eventRec->message & charCodeMask) == GetSelectKey()))
{
*item = kSelectItem;
FlashButton(theDlgPtr, kSelectItem);
return true;
}
*/
}
return false;
}
void ExtendedOpenFile( ConstStr255Param message , ConstStr255Param path , const char *filter , FileFilterYDUPP fileFilter, StandardFileReply *theSFR)
{
Point thePt;
OpenUserDataRec myData;
FSSpec tempSpec;
Boolean folderFlag;
Boolean wasAliasedFlag;
DlgHookYDUPP dlgHookUPP;
ModalFilterYDUPP myModalFilterUPP;
OSErr err;
SFTypeList types ;
// presumably we're running System 7 or later so CustomGetFile is
// available
// set initial contents of Select button to a space
CopyPStr("\p ", theSFR->sfFile.name);
// point the user data parameter at the reply record so we can get to it later
myData.sfrPtr = theSFR;
if ( filter && filter[0] )
{
myData.numfilters = 1 ;
for ( int i = 0 ; i < myData.numfilters ; i++ )
{
int j ;
strcpy( myData.filter[i] , filter ) ;
for( j = 0 ; myData.filter[i][j] ; j++ )
{
myData.filter[i][j] = toupper( myData.filter[i][j] ) ;
}
for ( j = 0 ; gfilters[j] ; j++ )
{
if ( strcmp( myData.filter[i] , gfilters[j] ) == 0 )
{
myData.filtermactypes[i] = gfiltersmac[j] ;
break ;
}
}
if( gfilters[j] == NULL )
{
myData.filtermactypes[i] = '****' ;
}
}
}
else
{
myData.numfilters = 0 ;
}
// display the dialog
dlgHookUPP = NULL ;
// dlgHookUPP = NewDlgHookYDProc(SFGetFolderDialogHook);
myModalFilterUPP = NewModalFilterYDProc(SFGetFolderModalDialogFilter);
thePt.h = thePt.v = -1; // center dialog
ParamText( message , NULL , NULL , NULL ) ;
CustomGetFile( fileFilter,
-1, // show all types
NULL,
theSFR,
kSFGetFileDlgID,
thePt, // top left point
dlgHookUPP,
myModalFilterUPP,
nil, // activate list
nil, // activate proc
&myData);
DisposeRoutineDescriptor(dlgHookUPP);
DisposeRoutineDescriptor(myModalFilterUPP);
// if cancel wasn't pressed and no fatal error occurred...
if (theSFR->sfGood)
{
// if no name is in the reply record file spec,
// use the file spec of the parent folder
if (theSFR->sfFile.name[0] == '\0')
{
err = FSMakeFSSpec(theSFR->sfFile.vRefNum, theSFR->sfFile.parID,
"\p", &tempSpec);
if (err == noErr)
{
theSFR->sfFile = tempSpec;
}
else
{
// no name to return, forget it
theSFR->sfGood = false;
}
}
// if there is now a name in the file spec, check if it's
// for a folder or a volume
if (theSFR->sfFile.name[0] != '\0')
{
// the parID of the root of a disk is always fsRtParID == 1
if (theSFR->sfFile.parID == fsRtParID)
{
theSFR->sfIsVolume = true;
theSFR->sfIsFolder = false; // it would be reasonable for this to be true, too
}
// we have a valid FSSpec, now let's make sure it's not for an alias file
err = ResolveAliasFile(&theSFR->sfFile, true, &folderFlag, &wasAliasedFlag);
if (err != noErr)
{
theSFR->sfGood = false;
}
// did the alias resolve to a folder?
if (folderFlag && ! theSFR->sfIsVolume)
{
theSFR->sfIsFolder = true;
}
}
}
}
static pascal Boolean CrossPlatformFileFilter(CInfoPBPtr myCInfoPBPtr, Ptr dataPtr)
{
Str255 filename ;
OpenUserDataRecPtr data = (OpenUserDataRecPtr) dataPtr ;
// return true if this item is invisible or a file
Boolean visibleFlag;
Boolean folderFlag;
visibleFlag = ! (myCInfoPBPtr->hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible);
folderFlag = (myCInfoPBPtr->hFileInfo.ioFlAttrib & 0x10);
// because the semantics of the filter proc are "true means don't show
// it" we need to invert the result that we return
if ( !visibleFlag )
return true ;
if ( !folderFlag )
{
if ( data->numfilters > 0 )
{
PLstrcpy( filename ,myCInfoPBPtr->hFileInfo.ioNamePtr ) ;
if ( filename[0] >= 4 )
{
for( int j = 1 ; j <= filename[0] ; j++ )
{
filename[j] = toupper( filename[j] ) ;
}
for ( int i = 0 ; i < data->numfilters ; ++i )
{
if ( myCInfoPBPtr->hFileInfo.ioFlFndrInfo.fdType == data->filtermactypes[i] )
return false ;
if ( strncmp( (char*) filename + 1 + filename[0] - 4 ,
& data->filter[i][ strlen(data->filter[i]) - 4 ] , 4 ) == 0 )
return false ;
}
}
return true ;
}
}
return false ;
}
// end wxmac
wxString wxFileSelector(const char *title,
const char *defaultDir, const char *defaultFileName,
const char *defaultExtension, const char *filter, int flags,
wxWindow *parent, int x, int y)
@@ -100,7 +445,61 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
int wxFileDialog::ShowModal()
{
// TODO
if ( m_dialogStyle & wxSAVE )
{
StandardFileReply reply ;
Str255 prompt ;
Str255 filename ;
strcpy((char *)prompt, m_message) ;
c2pstr((char *)prompt ) ;
strcpy((char *)filename, m_fileName) ;
c2pstr((char *)filename ) ;
StandardPutFile( prompt , filename , &reply ) ;
if ( reply.sfGood == false )
{
m_path = "" ;
return wxID_CANCEL ;
}
else
{
m_path = wxMacFSSpec2UnixFilename( &reply.sfFile ) ;
return wxID_OK ;
}
}
else
{
OSType types = '????' ;
Str255 prompt ;
Str255 path ;
strcpy((char *)prompt, m_message) ;
c2pstr((char *)prompt ) ;
strcpy((char *)path, m_path ) ;
c2pstr((char *)path ) ;
FileFilterYDUPP crossPlatformFileFilterUPP;
StandardFileReply reply ;
crossPlatformFileFilterUPP =
NewFileFilterYDProc(CrossPlatformFileFilter);
ExtendedOpenFile( prompt , path , m_wildCard , crossPlatformFileFilterUPP, &reply);
DisposeRoutineDescriptor(crossPlatformFileFilterUPP);
if ( reply.sfGood == false )
{
m_path = "" ;
return wxID_CANCEL ;
}
else
{
m_path = wxMacFSSpec2UnixFilename( &reply.sfFile ) ;
return wxID_OK ;
}
}
return wxID_CANCEL;
}

View File

@@ -31,9 +31,10 @@ wxFontRefData::wxFontRefData()
m_weight = 0;
m_underlined = 0;
m_faceName = "";
/* TODO
m_hFont = 0;
*/
m_macFontSize = m_pointSize ;
m_macFontNum = systemFont ;
m_macFontStyle = normal ;
}
wxFontRefData::wxFontRefData(const wxFontRefData& data)
@@ -45,9 +46,10 @@ wxFontRefData::wxFontRefData(const wxFontRefData& data)
m_weight = data.m_weight;
m_underlined = data.m_underlined;
m_faceName = data.m_faceName;
/* TODO
m_hFont = 0;
*/
m_macFontSize = m_pointSize ;
m_macFontNum = systemFont ;
m_macFontStyle = normal ;
}
wxFontRefData::~wxFontRefData()
@@ -55,6 +57,56 @@ wxFontRefData::~wxFontRefData()
// TODO: delete font data
}
void wxFontRefData::MacFindFont()
{
if( m_faceName == "" )
{
switch( m_family )
{
case wxDEFAULT :
m_macFontNum = ::GetAppFont() ;
break ;
case wxDECORATIVE :
::GetFNum( "\pTimes" , &m_macFontNum) ;
break ;
case wxROMAN :
::GetFNum( "\pTimes" , &m_macFontNum) ;
break ;
case wxSCRIPT :
::GetFNum( "\pTimes" , &m_macFontNum) ;
break ;
case wxSWISS :
::GetFNum( "\pHelvetica" , &m_macFontNum) ;
break ;
case wxMODERN :
::GetFNum( "\pMonaco" , &m_macFontNum) ;
break ;
}
}
else
{
if ( m_faceName == "systemfont" )
m_macFontNum = ::GetSysFont() ;
else if ( m_faceName == "applicationfont" )
m_macFontNum = ::GetAppFont() ;
else
{
strcpy(wxBuffer, m_faceName);
C2PStr(wxBuffer);
::GetFNum( (unsigned char*) wxBuffer, &m_macFontNum);
}
}
m_macFontStyle = 0;
if (m_weight == wxBOLD)
m_macFontStyle |= bold;
if (m_style == wxITALIC || m_style == wxSLANT)
m_macFontStyle |= italic;
if (m_underlined)
m_macFontStyle |= underline;
m_macFontSize = m_pointSize ;
}
wxFont::wxFont()
{
if ( wxTheFontList )
@@ -94,8 +146,8 @@ wxFont::~wxFont()
bool wxFont::RealizeResource()
{
// TODO: create the font (if there is a native font object)
return FALSE;
M_FONTDATA->MacFindFont() ;
return TRUE;
}
void wxFont::Unshare()

View File

@@ -14,7 +14,7 @@
#pragma implementation "fontdlg.h"
#endif
#include "wx/stubs/fontdlg.h"
#include "wx/mac/fontdlg.h"
#include "wx/cmndata.h"
#if !USE_SHARED_LIBRARY

View File

@@ -23,6 +23,8 @@
#include "wx/settings.h"
#include "wx/app.h"
#include <wx/mac/uma.h>
extern wxList wxModelessWindows;
extern wxList wxPendingDelete;
@@ -47,7 +49,11 @@ bool wxFrame::m_useNativeStatusBar = FALSE;
wxFrame::wxFrame()
{
#if wxUSE_TOOLBAR
m_frameToolBar = NULL ;
#endif
m_macShown = false ;
// in order to be able to give size events on show
m_frameMenuBar = NULL;
m_frameStatusBar = NULL;
@@ -69,7 +75,10 @@ bool wxFrame::Create(wxWindow *parent,
SetName(name);
m_windowStyle = style;
m_frameMenuBar = NULL;
#if wxUSE_TOOLBAR
m_frameToolBar = NULL ;
#endif
m_frameStatusBar = NULL;
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
@@ -83,9 +92,63 @@ bool wxFrame::Create(wxWindow *parent,
wxModelessWindows.Append(this);
// TODO: create frame.
// create frame.
return FALSE;
Rect theBoundsRect;
m_x = (int)pos.x;
m_y = (int)pos.y;
if ( m_y < 50 )
m_y = 50 ;
if ( m_x < 20 )
m_x = 20 ;
m_width = size.x;
if (m_width == -1)
m_width = 20;
m_height = size.y;
if (m_height == -1)
m_height = 20;
m_macWindowData = new MacWindowData() ;
::SetRect(&theBoundsRect, m_x, m_y, m_x + m_width, m_y + m_height);
WindowClass wclass = kDocumentWindowClass ;
WindowAttributes attr = kWindowNoAttributes ;
if ( ( m_windowStyle & wxMINIMIZE_BOX ) || ( m_windowStyle & wxMAXIMIZE_BOX ) )
{
attr |= kWindowFullZoomAttribute ;
attr |= kWindowResizableAttribute ;
}
if ( m_windowStyle & wxSTAY_ON_TOP )
{
wclass = kFloatingWindowClass ;
// if ( m_windowStyle & wxCAPTION )
// attr |= kHasPaletteTitlebarMask ;
}
else
{
}
if ( m_windowStyle & wxSYSTEM_MENU )
{
attr |= kWindowCloseBoxAttribute ;
}
UMACreateNewWindow( wclass , attr , &theBoundsRect , &m_macWindowData->m_macWindow ) ;
wxAssociateWinWithMacWindow( m_macWindowData->m_macWindow , this ) ;
wxString label ;
if( wxApp::s_macDefaultEncodingIsPC )
label = wxMacMakeMacStringFromPC( title ) ;
else
label = title ;
UMASetWTitleC( m_macWindowData->m_macWindow , label ) ;
UMACreateRootControl( m_macWindowData->m_macWindow , &m_macWindowData->m_macRootControl ) ;
m_macWindowData->m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
m_macWindowData->m_macFocus = NULL ;
m_macShown = false ;
return TRUE;
}
wxFrame::~wxFrame()
@@ -105,46 +168,13 @@ wxFrame::~wxFrame()
if (wxTheApp->GetExitOnFrameDelete())
{
// TODO signal to the app that we're going to close
wxTheApp->ExitMainLoop() ;
}
}
wxModelessWindows.DeleteObject(this);
}
// Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
void wxFrame::GetClientSize(int *x, int *y) const
{
// TODO
}
// Set the client size (i.e. leave the calculation of borders etc.
// to wxWindows)
void wxFrame::SetClientSize(int width, int height)
{
// TODO
}
void wxFrame::GetSize(int *width, int *height) const
{
// TODO
}
void wxFrame::GetPosition(int *x, int *y) const
{
// TODO
}
void wxFrame::SetSize(int x, int y, int width, int height, int sizeFlags)
{
// TODO
}
bool wxFrame::Show(bool show)
{
// TODO
return FALSE;
}
void wxFrame::Iconize(bool iconize)
{
@@ -170,17 +200,6 @@ bool wxFrame::IsMaximized(void) const
return FALSE;
}
void wxFrame::SetTitle(const wxString& title)
{
// TODO
}
wxString wxFrame::GetTitle() const
{
// TODO
return wxString("");
}
void wxFrame::SetIcon(const wxIcon& icon)
{
m_icon = icon;
@@ -192,10 +211,12 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
{
wxStatusBar *statusBar = NULL;
statusBar = new wxStatusBar(this, id, wxPoint(0, 0), wxSize(100, 20),
statusBar = new wxStatusBar(this, id, wxPoint(0, 0), wxSize(100, 17),
style, name);
// Set the height according to the font and the border size
// we shouldn't do this on the mac, because we have to fit the grow box
/*
wxClientDC dc(statusBar);
dc.SetFont(statusBar->GetFont());
@@ -206,6 +227,8 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
statusBar->SetSize(-1, -1, 100, height);
*/
statusBar->SetFieldsCount(number);
return statusBar;
}
@@ -245,6 +268,8 @@ void wxFrame::SetStatusWidths(int n, const int widths_field[])
void wxFrame::PositionStatusBar()
{
if (m_frameStatusBar )
{
int w, h;
GetClientSize(&w, &h);
int sw, sh;
@@ -253,6 +278,7 @@ void wxFrame::PositionStatusBar()
// Since we wish the status bar to be directly under the client area,
// we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
m_frameStatusBar->SetSize(0, h, w, sh);
}
}
void wxFrame::SetMenuBar(wxMenuBar *menuBar)
@@ -264,8 +290,8 @@ void wxFrame::SetMenuBar(wxMenuBar *menuBar)
}
m_frameMenuBar = menuBar;
// TODO
// TODO : we move this into the app code
m_frameMenuBar->MacInstallMenuBar() ;
}
void wxFrame::Fit()
@@ -333,8 +359,12 @@ void wxFrame::OnSize(wxSizeEvent& event)
wxWindow *win = (wxWindow *)node->Data();
if ( !win->IsKindOf(CLASSINFO(wxFrame)) &&
!win->IsKindOf(CLASSINFO(wxDialog)) &&
(win != GetStatusBar()) &&
(win != GetToolBar()) )
(win != GetStatusBar())
#if wxUSE_TOOLBAR
&&
(win != GetToolBar())
#endif
)
{
if ( child )
return; // it's our second subwindow - nothing to do
@@ -410,21 +440,6 @@ wxMenuBar *wxFrame::GetMenuBar() const
return m_frameMenuBar;
}
void wxFrame::Centre(int direction)
{
int display_width, display_height, width, height, x, y;
wxDisplaySize(&display_width, &display_height);
GetSize(&width, &height);
GetPosition(&x, &y);
if (direction & wxHORIZONTAL)
x = (int)((display_width - width)/2);
if (direction & wxVERTICAL)
y = (int)((display_height - height)/2);
SetSize(x, y, width, height);
}
// Call this to simulate a menu command
void wxFrame::Command(int id)
@@ -434,7 +449,7 @@ void wxFrame::Command(int id)
void wxFrame::ProcessCommand(int id)
{
wxCommandEvent commandEvent(wxEVENT_TYPE_MENU_COMMAND, id);
wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, id);
commandEvent.SetInt( id );
commandEvent.SetEventObject( this );
@@ -450,18 +465,14 @@ void wxFrame::ProcessCommand(int id)
}
*/
// Process events starting with the window with the focus, if any.
wxWindow* focusWin = wxFindFocusDescendant(this);
wxEvtHandler* evtHandler = focusWin ? focusWin->GetEventHandler() : GetEventHandler();
evtHandler->ProcessEvent(commandEvent);
GetEventHandler()->ProcessEvent(commandEvent);
}
// Checks if there is a toolbar, and returns the first free client position
wxPoint wxFrame::GetClientAreaOrigin() const
{
wxPoint pt(0, 0);
#if wxUSE_TOOLBAR
if (GetToolBar())
{
int w, h;
@@ -476,33 +487,46 @@ wxPoint wxFrame::GetClientAreaOrigin() const
pt.y += h;
}
}
#endif
return pt;
}
void wxFrame::ScreenToClient(int *x, int *y) const
void wxFrame::GetClientSize(int *x, int *y) const
{
wxWindow::ScreenToClient(x, y);
wxWindow::GetClientSize( x , y ) ;
// We may be faking the client origin.
// So a window that's really at (0, 30) may appear
// (to wxWin apps) to be at (0, 0).
wxPoint pt(GetClientAreaOrigin());
*x -= pt.x;
*y -= pt.y;
if ( GetStatusBar() )
{
int statusX, statusY;
GetStatusBar()->GetClientSize(&statusX, &statusY);
*y -= statusY;
}
wxPoint pt(GetClientAreaOrigin());
*y -= pt.y;
*x -= pt.x;
}
void wxFrame::ClientToScreen(int *x, int *y) const
void wxFrame::DoSetClientSize(int clientwidth, int clientheight)
{
// We may be faking the client origin.
// So a window that's really at (0, 30) may appear
// (to wxWin apps) to be at (0, 0).
wxPoint pt1(GetClientAreaOrigin());
*x += pt1.x;
*y += pt1.y;
int currentclientwidth , currentclientheight ;
int currentwidth , currentheight ;
GetClientSize( &currentclientwidth , &currentclientheight ) ;
GetSize( &currentwidth , &currentheight ) ;
// find the current client size
wxWindow::ClientToScreen(x, y);
// Find the difference between the entire window (title bar and all)
// and the client area; add this to the new client size to move the
// window
DoSetSize( -1 , -1 , currentwidth + clientwidth - currentclientwidth ,
currentheight + clientheight - currentclientheight , wxSIZE_USE_EXISTING ) ;
}
#if wxUSE_TOOLBAR
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
{
wxCHECK_MSG( m_frameToolBar == NULL, FALSE,
@@ -534,7 +558,10 @@ void wxFrame::PositionToolBar()
// the toolbar/status bar were added.
// So DEFINITELY replace the line below with something appropriate.
GetClientSize(& cw, &ch);
// GetClientSize(& cw, &ch);
cw = m_width ;
ch = m_height ;
if ( GetStatusBar() )
{
@@ -562,4 +589,4 @@ void wxFrame::PositionToolBar()
}
}
}
#endif

View File

@@ -19,67 +19,65 @@
IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
#endif
#include <wx/mac/uma.h>
bool wxGauge::Create(wxWindow *parent, wxWindowID id,
int range,
const wxPoint& pos,
const wxSize& size,
const wxSize& s,
long style,
const wxValidator& validator,
const wxString& name)
{
SetName(name);
SetValidator(validator);
m_rangeMax = range;
m_windowStyle = style;
wxSize size = s ;
Rect bounds ;
Str255 title ;
m_rangeMax = range ;
m_macHorizontalBorder = 2 ; // additional pixels around the real control
m_macVerticalBorder = 2 ;
if ( size.x == wxDefaultSize.x && size.y == wxDefaultSize.y)
{
size = wxSize( 200 , 16 ) ;
}
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
if (parent) parent->AddChild(this);
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , range,
kControlProgressBarProc , (long) this ) ;
MacPostControlCreate() ;
if ( id == -1 )
m_windowId = (int)NewControlId();
else
m_windowId = id;
// TODO
return FALSE;
}
void wxGauge::SetSize(int x, int y, int width, int height, int sizeFlags)
{
// TODO
return TRUE;
}
void wxGauge::SetShadowWidth(int w)
{
// TODO optional
}
void wxGauge::SetBezelFace(int w)
{
// TODO optional
}
void wxGauge::SetRange(int r)
{
m_rangeMax = r;
// TODO
::SetControlMaximum( m_macControl , m_rangeMax ) ;
}
void wxGauge::SetValue(int pos)
{
m_gaugePos = pos;
// TODO
::SetControlValue( m_macControl , m_gaugePos ) ;
}
int wxGauge::GetShadowWidth() const
{
// TODO optional
return 0;
}
int wxGauge::GetBezelFace() const
{
// TODO optional
return 0;
}

View File

@@ -26,12 +26,30 @@ IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap)
wxIconRefData::wxIconRefData()
{
// TODO: init icon handle
m_ok = FALSE;
m_width = 0;
m_height = 0;
m_depth = 0;
m_quality = 0;
m_numColors = 0;
m_bitmapMask = NULL;
m_hBitmap = NULL ;
m_hIcon = NULL ;
}
wxIconRefData::~wxIconRefData()
{
// TODO: destroy icon handle
if ( m_hIcon )
{
DisposeCIcon( m_hIcon ) ;
m_hIcon = NULL ;
}
if (m_bitmapMask)
{
delete m_bitmapMask;
m_bitmapMask = NULL;
}
}
wxIcon::wxIcon()
@@ -68,3 +86,32 @@ bool wxIcon::LoadFile(const wxString& filename, long type,
return FALSE;
}
IMPLEMENT_DYNAMIC_CLASS(wxICONResourceHandler, wxBitmapHandler)
bool wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight)
{
Str255 theName ;
short theId ;
OSType theType ;
strcpy( (char*) theName , name ) ;
c2pstr( (char*) theName ) ;
Handle resHandle = GetNamedResource( 'cicn' , theName ) ;
GetResInfo( resHandle , &theId , &theType , theName ) ;
ReleaseResource( resHandle ) ;
CIconHandle theIcon = (CIconHandle ) GetCIcon( theId ) ;
if ( theIcon )
{
M_ICONHANDLERDATA->m_hIcon = theIcon ;
M_ICONHANDLERDATA->m_width = 32 ;
M_ICONHANDLERDATA->m_height = 32 ;
M_ICONHANDLERDATA->m_depth = 8 ;
M_ICONHANDLERDATA->m_ok = true ;
M_ICONHANDLERDATA->m_numColors = 256 ;
return TRUE ;
}
return FALSE ;
}

View File

@@ -18,10 +18,22 @@
#include "wx/dynarray.h"
#include "wx/log.h"
#include "wx/utils.h"
#include "extldef.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
BEGIN_EVENT_TABLE(wxListBox, wxControl)
EVT_SIZE( wxListBox::OnSize )
END_EVENT_TABLE()
#endif
#include <wx/mac/uma.h>
extern "C" void MacDrawStringCell(Rect *cellRect, Cell lCell, ListHandle theList, long refCon) ;
const short kwxMacListWithVerticalScrollbar = 128 ;
// ============================================================================
// list box control implementation
// ============================================================================
@@ -41,111 +53,197 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
const wxValidator& validator,
const wxString& name)
{
m_noItems = n;
m_noItems = 0 ; // this will be increased by our append command
m_selected = 0;
SetName(name);
SetValidator(validator);
Rect bounds ;
Str255 title ;
m_macHorizontalBorder = 5 ; // additional pixels around the real control
m_macVerticalBorder = 5 ;
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
if (parent) parent->AddChild(this);
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , kwxMacListWithVerticalScrollbar , 0 , 0,
kControlListBoxProc , (long) this ) ;
long result ;
UMAGetControlData( m_macControl , kControlNoPart , kControlListBoxListHandleTag , sizeof( ListHandle ) , (char*) &m_macList , &result ) ;
wxSystemSettings settings;
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
NewExtLDEFInfo( m_macList , MacDrawStringCell , (long) this ) ;
(**m_macList).selFlags = lOnlyOne ;
if ( style & wxLB_MULTIPLE )
{
(**m_macList).selFlags += lNoExtend ;
}
else if ( style & wxLB_EXTENDED )
{
(**m_macList).selFlags += lExtendDrag ;
}
Point pt = (**m_macList).cellSize ;
pt.v = 14 ;
LCellSize( pt , m_macList ) ;
m_windowId = ( id == -1 ) ? (int)NewControlId() : id;
LAddColumn( 1 , 0 , m_macList ) ;
// TODO create listbox
MacPostControlCreate() ;
return FALSE;
ControlFontStyleRec controlstyle ;
controlstyle.flags = kControlUseFontMask + kControlUseSizeMask ;
//controlstyle.font = kControlFontSmallSystemFont ;
controlstyle.font = kFontIDMonaco ;
controlstyle.size = 9 ;
::UMASetControlFontStyle( m_macControl , &controlstyle ) ;
for ( int i = 0 ; i < n ; i++ )
{
Append( choices[i] ) ;
}
LSetDrawingMode( true , m_macList ) ;
return TRUE;
}
wxListBox::~wxListBox()
{
// DisposeExtLDEFInfo( m_macList ) ;
}
void wxListBox::SetFirstItem(int N)
{
// TODO
MacScrollTo( N ) ;
}
void wxListBox::SetFirstItem(const wxString& s)
{
// TODO
MacScrollTo( FindString( s ) ) ;
}
void wxListBox::Delete(int N)
{
m_noItems --;
// TODO
m_dataArray.Remove( N ) ;
m_stringArray.Remove( N ) ;
m_noItems --;
MacDelete( N ) ;
}
void wxListBox::Append(const wxString& item)
{
m_noItems ++;
// TODO
Append( item , NULL ) ;
}
void wxListBox::Append(const wxString& item, char *Client_data)
{
m_noItems ++;
// TODO
if( wxApp::s_macDefaultEncodingIsPC )
{
m_stringArray.Add( wxMacMakeMacStringFromPC( item ) ) ;
}
else
m_stringArray.Add( item ) ;
m_dataArray.Add( Client_data ) ;
m_noItems ++;
MacAppend( item ) ;
}
void wxListBox::Set(int n, const wxString *choices, char** clientData)
{
m_noItems = n;
// TODO
Clear() ;
for( int i = 0 ; i < n ; ++i )
{
if ( clientData )
Append( choices[i] , clientData[0] ) ;
else
Append( choices[i] ) ;
}
}
int wxListBox::FindString(const wxString& s) const
int wxListBox::FindString(const wxString& st) const
{
// TODO
return -1;
wxString s ;
if( wxApp::s_macDefaultEncodingIsPC )
{
s = wxMacMakeMacStringFromPC( st ) ;
}
else
s = st ;
if ( s.Right(1) == "*" )
{
wxString search = s.Left( s.Length() - 1 ) ;
int len = search.Length() ;
for ( int i = 0 ; i < m_noItems ; ++ i )
{
if ( equalstring( m_stringArray[i].Left( len ) , search , false , false ) )
return i ;
}
}
else
{
for ( int i = 0 ; i < m_noItems ; ++ i )
{
if ( equalstring( m_stringArray[i] , s , false , false ) )
return i ;
}
}
return -1;
}
void wxListBox::Clear()
{
m_noItems = 0;
// TODO
m_stringArray.Empty() ;
m_dataArray.Empty() ;
MacClear() ;
}
void wxListBox::SetSelection(int N, bool select)
{
// TODO
wxCHECK_RET( N >= 0 && N < m_noItems,
"invalid index in wxListBox::SetSelection" );
MacSetSelection( N , select ) ;
}
bool wxListBox::Selected(int N) const
{
// TODO
return FALSE;
wxCHECK_MSG( N >= 0 && N < m_noItems, FALSE,
"invalid index in wxListBox::Selected" );
return MacIsSelected( N ) ;
}
void wxListBox::Deselect(int N)
{
// TODO
wxCHECK_RET( N >= 0 && N < m_noItems,
"invalid index in wxListBox::Deselect" );
SetSelection( N , false ) ;
}
char *wxListBox::GetClientData(int N) const
{
// TODO
return (char *)NULL;
wxCHECK_MSG( N >= 0 && N < m_noItems, NULL,
"invalid index in wxListBox::GetClientData" );
return m_dataArray[N];
}
void wxListBox::SetClientData(int N, char *Client_data)
{
// TODO
wxCHECK_RET( N >= 0 && N < m_noItems,
"invalid index in wxListBox::SetClientData" );
m_dataArray[N] = Client_data ;
}
// Return number of selections and an array of selected integers
int wxListBox::GetSelections(wxArrayInt& aSelections) const
{
aSelections.Empty();
return MacGetSelections( aSelections ) ;
/* TODO
if ((m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED))
if ((m_windowStyle & wxLB_MULTIMacE) || (m_windowStyle & wxLB_EXTENDED))
{
int no_sel = ??
for ( int n = 0; n < no_sel; n++ )
@@ -160,38 +258,41 @@ int wxListBox::GetSelections(wxArrayInt& aSelections) const
return 1;
}
*/
return 0;
}
// Get single selection, for single choice list items
int wxListBox::GetSelection() const
{
// TODO
return -1;
return MacGetSelection() ;
}
// Find string for position
wxString wxListBox::GetString(int N) const
{
// TODO
return wxString("");
}
void wxListBox::SetSize(int x, int y, int width, int height, int sizeFlags)
{
// TODO
if( wxApp::s_macDefaultEncodingIsPC )
{
return wxMacMakePCStringFromMac( m_stringArray[N] ) ;
}
else
return m_stringArray[N] ;
}
void wxListBox::InsertItems(int nItems, const wxString items[], int pos)
{
m_noItems += nItems;
for ( int i = 0 ; i < nItems ; i++ )
{
m_stringArray.Insert( items[i] , pos + i ) ;
m_dataArray.Insert( NULL , pos + i ) ;
MacInsert( pos + i , items[i] ) ;
}
// TODO
m_noItems += nItems;
}
void wxListBox::SetString(int N, const wxString& s)
{
// TODO
m_stringArray[N] = s ;
MacSet( N , s ) ;
}
int wxListBox::Number () const
@@ -204,7 +305,9 @@ wxString wxListBox::GetStringSelection () const
{
int sel = GetSelection ();
if (sel > -1)
return this->GetString (sel);
{
return GetString (sel);
}
else
return wxString("");
}
@@ -233,3 +336,182 @@ void wxListBox::Command (wxCommandEvent & event)
ProcessCommand (event);
}
// ============================================================================
// list box control implementation
// ============================================================================
void MacDrawStringCell(Rect *cellRect, Cell lCell, ListHandle theList, long refCon)
{
wxListBox* list;
// typecast our refCon
list = (wxListBox*)refCon;
MoveTo(cellRect->left + 4 , cellRect->top + 10 );
const wxString text = list->m_stringArray[lCell.v] ;
::TextFont( kFontIDMonaco ) ;
::TextSize( 9 );
::TextFace( 0 ) ;
DrawText(text, 0 , text.Length());
}
void wxListBox::MacDelete( int N )
{
ListHandle list ;
long result ;
Cell cell = { 0 , 0 } ;
UMAGetControlData( m_macControl , kControlNoPart , kControlListBoxListHandleTag , sizeof( ListHandle ) , (char*) &list , &result ) ;
LDelRow( 1 , N , list ) ;
}
void wxListBox::MacInsert( int n , const char * text)
{
Cell cell ;
cell.h = 0 ;
cell.v = n ;
LAddRow( 1 , cell.v , m_macList ) ;
}
void wxListBox::MacAppend( const char * text)
{
Cell cell = { 0 , 0 } ;
cell.v = (**m_macList).dataBounds.bottom ;
LAddRow( 1 , cell.v , m_macList ) ;
}
void wxListBox::MacClear()
{
LDelRow( (**m_macList).dataBounds.bottom , 0 , m_macList ) ;
}
void wxListBox::MacSetSelection( int n , bool select )
{
Cell cell = { 0 , 0 } ;
if ( LGetSelect( TRUE , &cell , m_macList ) )
{
LSetSelect( false , cell , m_macList ) ;
}
cell.v = n ;
LSetSelect( select , cell , m_macList ) ;
LAutoScroll( m_macList ) ;
}
bool wxListBox::MacIsSelected( int n ) const
{
Cell cell = { 0 , 0 } ;
cell.v = n ;
return LGetSelect( false , &cell , m_macList ) ;
}
void wxListBox::MacDestroy()
{
// DisposeExtLDEFInfo( m_macList ) ;
}
int wxListBox::MacGetSelection() const
{
Cell cell = { 0 , 0 } ;
if ( LGetSelect( true , &cell , m_macList ) )
return cell.v ;
else
return -1 ;
}
int wxListBox::MacGetSelections( wxArrayInt& aSelections ) const
{
int no_sel = 0 ;
aSelections.Empty();
Cell cell = { 0 , 0 } ;
cell.v = 0 ;
while ( LGetSelect( true , &cell , m_macList ) )
{
aSelections.Add( cell.v ) ;
no_sel++ ;
cell.v++ ;
}
return no_sel ;
}
void wxListBox::MacSet( int n , const char * text )
{
// our implementation does not store anything in the list
// so we just have to redraw
Cell cell = { 0 , 0 } ;
cell.v = n ;
LDraw( cell , m_macList ) ;
}
void wxListBox::MacScrollTo( int n )
{
// TODO implement scrolling
}
void wxListBox::OnSize( const wxSizeEvent &event)
{
Point pt = (**m_macList).cellSize ;
pt.h = m_width - 15 /* scrollbar */ - m_macHorizontalBorder * 2 ;
LCellSize( pt , m_macList ) ;
}
void wxListBox::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
{
Boolean wasDoubleClick = false ;
long result ;
UMAGetControlData( m_macControl , kControlNoPart , kControlListBoxDoubleClickTag , sizeof( wasDoubleClick ) , (char*) &wasDoubleClick , &result ) ;
if ( !wasDoubleClick )
{
MacDoClick() ;
}
else
{
MacDoDoubleClick() ;
}
}
void wxListBox::MacSetRedraw( bool doDraw )
{
LSetDrawingMode( doDraw , m_macList ) ;
}
void wxListBox::MacDoClick()
{
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
wxArrayInt aSelections;
int count = GetSelections(aSelections);
if ( count > 0 )
{
event.m_commandInt = aSelections[0] ;
event.m_clientData = GetClientData(event.m_commandInt);
wxString str(GetString(event.m_commandInt));
if (str != "")
event.m_commandString = copystring((char *)(const char *)str);
}
else
{
return ;
/*
event.m_commandInt = -1 ;
event.m_commandString = copystring("") ;
*/
}
event.SetEventObject( this );
ProcessCommand(event);
if (event.m_commandString)
delete[] event.m_commandString ;
}
void wxListBox::MacDoDoubleClick()
{
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, m_windowId);
event.SetEventObject( this );
GetEventHandler()->ProcessEvent(event) ;
}

View File

@@ -62,7 +62,6 @@ LIB_CPP_SRC=\
../common/variant.cpp \
../common/wxexpr.cpp \
../common/socket.cpp \
../common/sckint.cpp \
../common/sckaddr.cpp \
../common/sckipc.cpp \
../common/protocol.cpp \

View File

@@ -27,6 +27,8 @@
#include "wx/log.h"
#include "wx/utils.h"
#include "wx/mac/uma.h"
// other standard headers
// ----------------------
#include <string.h>
@@ -36,13 +38,146 @@ IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler)
IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxEvtHandler)
#endif
// the (popup) menu title has this special id
static const int idMenuTitle = -2;
static int formerHelpMenuItems = 0 ;
const short kwxMacMenuBarResource = 1 ;
const short kwxMacAppleMenuId = 1 ;
// ============================================================================
// implementation
// ============================================================================
//
// Helper Functions to get Mac Menus the way they should be ;-)
//
void wxMacCtoPString(const char* theCString, Str255 thePString);
// remove inappropriate characters, if useShortcuts is false, the ampersand will not auto-generate a mac menu-shortcut
static void wxMacBuildMenuString(StringPtr outMacItemText, char *outMacShortcutChar , short *outMacModifiers , const char *inItemName , bool useShortcuts )
{
char *p = (char *) &outMacItemText[1] ;
short macModifiers = 0 ;
char macShortCut = 0 ;
if ( useShortcuts && !wxApp::s_macSupportPCMenuShortcuts )
useShortcuts = false ;
// we have problems with a leading hypen - it will be taken as a separator
while ( *inItemName == '-' )
inItemName++ ;
while( *inItemName )
{
switch ( *inItemName )
{
// special characters for macintosh menus -> use some replacement
case ';' :
*p++ = ',' ;
break ;
case '^' :
*p++ = ' ' ;
break ;
case '!' :
*p++ = ' ' ;
break ;
case '<' :
*p++ = ' ' ;
break ;
case '/' :
*p++ = '|' ;
break ;
case '(' :
*p++ = '[' ;
break ;
case ')' :
*p++ = ']' ;
break ;
// shortcuts
case '&' :
{
++inItemName ;
if ( *inItemName )
{
*p++ = *inItemName ;
if ( useShortcuts )
macShortCut = *inItemName ;
}
else
--inItemName ;
}
break ;
// win-like accelerators
case '\t' :
{
++inItemName ;
while( *inItemName )
{
if (strncmp("Ctrl+", inItemName, 5) == 0)
{
inItemName = inItemName + 5;
macShortCut = *inItemName;
}
else if (strncmp("Alt+", inItemName, 4) == 0)
{
inItemName = inItemName + 4;
macModifiers |= kMenuOptionModifier ;
macShortCut = *inItemName ;
}
else if (strncmp("Shift+", inItemName, 6) == 0)
{
inItemName = inItemName + 6;
macModifiers |= kMenuShiftModifier ;
macShortCut = *inItemName ;
}
else if (strncmp("F", inItemName, 1) == 0)
{
inItemName += strlen( inItemName ) ;
// no function keys at the moment
// macModifiers |= kMenuShiftModifier ;
// macShortCut = *inItemName ;
}
else
{
break ;
}
}
if ( *inItemName == 0 )
--inItemName ;
}
break ;
default :
*p++ = *inItemName ;
}
++inItemName ;
}
outMacItemText[0] = (p - (char *)outMacItemText) - 1;
if ( outMacShortcutChar )
*outMacShortcutChar = macShortCut ;
if ( outMacModifiers )
*outMacModifiers = macModifiers ;
if ( macShortCut )
{
int pos = outMacItemText[0] ;
outMacItemText[++pos] = '/';
outMacItemText[++pos] = toupper( macShortCut );
outMacItemText[0] = pos ;
}
}
// Menus
// Construct a menu with optional title (then use append)
short wxMenu::s_macNextMenuId = 2 ;
wxMenu::wxMenu(const wxString& title, const wxFunction func)
{
m_title = title;
@@ -50,23 +185,27 @@ wxMenu::wxMenu(const wxString& title, const wxFunction func)
m_eventHandler = this;
m_noItems = 0;
m_menuBar = NULL;
m_pInvokingWindow = NULL ;
m_clientData = (void*) NULL;
if (m_title != "")
{
Append(-2, m_title) ;
Append(idMenuTitle, m_title) ;
AppendSeparator() ;
}
Callback(func);
// TODO create menu
Str255 label;
wxMacBuildMenuString( label, NULL , NULL , title , false );
m_macMenuId = s_macNextMenuId++;
wxCHECK_RET( s_macNextMenuId < 236 , "menu ids > 235 cannot be used for submenus on mac" );
m_macMenuHandle = ::NewMenu(m_macMenuId, label);
m_macMenuEnabled = true ;
}
// The wxWindow destructor will take care of deleting the submenus.
wxMenu::~wxMenu()
{
// TODO destroy menu and children
wxNode *node = m_menuItems.First();
while (node)
{
@@ -83,28 +222,78 @@ wxMenu::~wxMenu()
delete node;
node = next;
}
if (m_macMenuHandle)
::DisposeMenu(m_macMenuHandle);
}
void wxMenu::Break()
{
// TODO
// not available on the mac platform
}
// function appends a new item or submenu to the menu
void wxMenu::Append(wxMenuItem *pItem)
{
// TODO
wxCHECK_RET( pItem != NULL, "can't append NULL item to the menu" );
m_menuItems.Append(pItem);
if ( pItem->IsSeparator() )
{
MacAppendMenu(m_macMenuHandle, "\p-");
}
else
{
wxMenu *pSubMenu = pItem->GetSubMenu() ;
if ( pSubMenu != NULL )
{
Str255 label;
wxCHECK_RET( pSubMenu->m_macMenuHandle != NULL , "invalid submenu added");
pSubMenu->m_parent = this ;
wxMacBuildMenuString( label , NULL , NULL , pItem->GetName() ,false);
// hardcoded adding of the submenu combination for mac
int theEnd = label[0] + 1;
if (theEnd > 251)
theEnd = 251; // mac allows only 255 characters
label[theEnd++] = '/';
label[theEnd++] = hMenuCmd;
label[theEnd++] = '!';
label[theEnd++] = pSubMenu->m_macMenuId;
label[theEnd] = 0x00;
label[0] = theEnd;
if (wxMenuBar::s_macInstalledMenuBar == m_menuBar)
{
::InsertMenu( pSubMenu->m_macMenuHandle , -1 ) ;
}
::AppendMenu(m_macMenuHandle, label);
}
else
{
Str255 label ;
wxMacBuildMenuString( label , NULL , NULL , pItem->GetName(), pItem->GetId() == wxApp::s_macAboutMenuItemId);
if ( label[0] == 0 )
{
// we cannot add empty menus on mac
label[0] = 1 ;
label[1] = ' ' ;
}
::AppendMenu(m_macMenuHandle, label );
if ( pItem->GetId() == idMenuTitle )
{
UMADisableMenuItem( m_macMenuHandle , CountMItems( m_macMenuHandle ) ) ;
}
}
}
m_noItems++;
}
void wxMenu::AppendSeparator()
{
// TODO
Append(new wxMenuItem(this, ID_SEPARATOR));
}
@@ -136,12 +325,31 @@ void wxMenu::Delete(int id)
}
if (!node)
return;
return;
int index = pos + 1 ;
if (index < 1)
return;
wxMenu *pSubMenu = item->GetSubMenu();
if ( pSubMenu != NULL )
{
::DeleteMenuItem( m_macMenuHandle , index);
pSubMenu->m_parent = NULL;
// TODO: Why isn't subMenu deleted here???
// Will put this in for now. Assuming this is supposed
// to delete the menu, not just remove it.
item->DeleteSubMenu();
}
else
{
::DeleteMenuItem( m_macMenuHandle , index);
}
m_menuItems.DeleteNode(node);
// TODO shouldn't we do this ? <20>_m_noItems--;
delete item;
// TODO
}
void wxMenu::Enable(int Id, bool Flag)
@@ -178,8 +386,16 @@ bool wxMenu::Checked(int Id) const
void wxMenu::SetTitle(const wxString& label)
{
Str255 title ;
m_title = label ;
// TODO
wxMacBuildMenuString( title, NULL , NULL , label , false );
UMASetMenuTitle( m_macMenuHandle , title ) ;
if (wxMenuBar::s_macInstalledMenuBar == m_menuBar) // are we currently installed ?
{
::SetMenuBar( GetMenuBar() ) ;
::InvalMenuBar() ;
}
// TODO:for submenus -> their parent item text must be corrected
}
const wxString wxMenu::GetTitle() const
@@ -189,25 +405,33 @@ const wxString wxMenu::GetTitle() const
void wxMenu::SetLabel(int id, const wxString& label)
{
Str255 maclabel ;
int index ;
wxMenuItem *item = FindItemForId(id) ;
if (item==NULL)
return;
index = MacGetIndexFromItem( item ) ;
if (index < 1)
return;
if (item->GetSubMenu()==NULL)
{
// TODO
wxMacBuildMenuString( maclabel , NULL , NULL , label , false );
::SetMenuItemText( m_macMenuHandle , index , maclabel ) ;
}
else
{
// TODO
wxMacBuildMenuString( maclabel , NULL , NULL , label , false );
::SetMenuItemText( m_macMenuHandle , index , maclabel ) ;
}
item->SetName(label);
}
wxString wxMenu::GetLabel(int Id) const
{
// TODO
return wxString("") ;
wxMenuItem *pItem = FindItemForId(Id) ;
return pItem->GetName() ;
}
// Finds the item id matching the given string, -1 if not found.
@@ -295,21 +519,204 @@ void wxMenu::ProcessCommand(wxCommandEvent & event)
{
processed = GetEventHandler()->ProcessEvent(event);
}
/* TODO
// Try the window the menu was popped up from (and up
// through the hierarchy)
if ( !processed && GetInvokingWindow())
processed = GetInvokingWindow()->ProcessEvent(event);
*/
// Try the window the menu was popped up from (and up
// through the hierarchy)
if ( !processed && GetInvokingWindow())
processed = GetInvokingWindow()->GetEventHandler()->ProcessEvent(event);
}
bool wxWindow::PopupMenu(wxMenu *menu, int x, int y)
{
// TODO
return FALSE;
menu->SetInvokingWindow(this);
ClientToScreen( &x , &y ) ;
::InsertMenu( menu->m_macMenuHandle , -1 ) ;
long menuResult = ::PopUpMenuSelect(menu->m_macMenuHandle ,y,x, 0) ;
menu->MacMenuSelect( this , TickCount() , HiWord(menuResult) , LoWord(menuResult) ) ;
::DeleteMenu( menu->m_macMenuId ) ;
menu->SetInvokingWindow(NULL);
return TRUE;
}
// helper functions returning the mac menu position for a certain item, note that this is
// mac-wise 1 - based, i.e. the first item has index 1 whereas on MSWin it has pos 0
int wxMenu::MacGetIndexFromId( int id )
{
wxNode *node;
wxMenuItem *item;
int pos;
for (pos = 0, node = m_menuItems.First(); node; node = node->Next(), pos++)
{
item = (wxMenuItem *)node->Data();
if (item->GetId() == id)
break;
}
if (!node)
return 0;
return pos + 1 ;
}
int wxMenu::MacGetIndexFromItem( wxMenuItem *pItem )
{
wxNode *node;
int pos;
for (pos = 0, node = m_menuItems.First(); node; node = node->Next(), pos++)
{
if ((wxMenuItem *)node->Data() == pItem)
break;
}
if (!node)
return 0;
return pos + 1 ;
}
void wxMenu::MacEnableMenu( bool bDoEnable )
{
m_macMenuEnabled = bDoEnable ;
if ( bDoEnable )
UMAEnableMenuItem( m_macMenuHandle , 0 ) ;
else
UMADisableMenuItem( m_macMenuHandle , 0 ) ;
::DrawMenuBar() ;
}
bool wxMenu::MacMenuSelect( wxEvtHandler* handler, long when , int macMenuId, int macMenuItemNum )
{
int pos;
wxNode *node;
if ( m_macMenuId == macMenuId )
{
node = m_menuItems.Nth(macMenuItemNum-1);
if (node)
{
wxMenuItem *pItem = (wxMenuItem*)node->Data();
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, pItem->GetId());
event.m_timeStamp = when;
event.SetEventObject(handler);
event.SetInt( pItem->GetId() );
{
bool processed = false ;
// Try a callback
if (m_callback)
{
(void) (*(m_callback)) (*this, event);
processed = TRUE;
}
// Try the menu's event handler
if ( !processed && handler)
{
processed = handler->ProcessEvent(event);
}
// Try the window the menu was popped up from (and up
// through the hierarchy)
if ( !processed && GetInvokingWindow())
processed = GetInvokingWindow()->GetEventHandler()->ProcessEvent(event);
}
return true ;
}
}
else if ( macMenuId == kHMHelpMenuID )
{
int menuItem = formerHelpMenuItems ;
for (pos = 0, node = m_menuItems.First(); node; node = node->Next(), pos++)
{
wxMenuItem * pItem = (wxMenuItem *) node->Data() ;
wxMenu *pSubMenu = pItem->GetSubMenu() ;
if ( pSubMenu != NULL )
{
}
else
{
if ( pItem->GetId() != wxApp::s_macAboutMenuItemId )
++menuItem ;
if ( menuItem == macMenuItemNum )
{
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, pItem->GetId());
event.m_timeStamp = when;
event.SetEventObject(handler);
event.SetInt( pItem->GetId() );
{
bool processed = false ;
// Try a callback
if (m_callback)
{
(void) (*(m_callback)) (*this, event);
processed = TRUE;
}
// Try the menu's event handler
if ( !processed && handler)
{
processed = handler->ProcessEvent(event);
}
// Try the window the menu was popped up from (and up
// through the hierarchy)
if ( !processed && GetInvokingWindow())
processed = GetInvokingWindow()->GetEventHandler()->ProcessEvent(event);
}
return true ;
}
}
}
}
for (pos = 0, node = m_menuItems.First(); node; node = node->Next(), pos++)
{
wxMenuItem * pItem = (wxMenuItem *) node->Data() ;
wxMenu *pSubMenu = pItem->GetSubMenu() ;
if ( pSubMenu != NULL )
{
if ( pSubMenu->MacMenuSelect( handler , when , macMenuId , macMenuItemNum ) )
return true ;
}
}
return false ;
}
// Menu Bar
/*
Mac Implementation note :
The Mac has only one global menubar, so we attempt to install the currently
active menubar from a frame, we currently don't take into account mdi-frames
which would ask for menu-merging
Secondly there is no mac api for changing a menubar that is not the current
menubar, so we have to wait for preparing the actual menubar until the
wxMenubar is to be used
We can in subsequent versions use MacInstallMenuBar to provide some sort of
auto-merge for MDI in case this will be necessary
*/
wxMenuBar* wxMenuBar::s_macInstalledMenuBar = NULL ;
wxMenuBar::wxMenuBar()
{
m_eventHandler = this;
@@ -317,8 +724,6 @@ wxMenuBar::wxMenuBar()
m_menus = NULL;
m_titles = NULL;
m_menuBarFrame = NULL;
// TODO
}
wxMenuBar::wxMenuBar(int n, wxMenu *menus[], const wxString titles[])
@@ -329,14 +734,18 @@ wxMenuBar::wxMenuBar(int n, wxMenu *menus[], const wxString titles[])
m_titles = new wxString[n];
int i;
for ( i = 0; i < n; i++ )
m_titles[i] = titles[i];
m_titles[i] = titles[i];
m_menuBarFrame = NULL;
// TODO
}
wxMenuBar::~wxMenuBar()
{
if (s_macInstalledMenuBar == this)
{
::ClearMenuBar();
s_macInstalledMenuBar = NULL;
}
int i;
for (i = 0; i < m_menuCount; i++)
{
@@ -345,9 +754,95 @@ wxMenuBar::~wxMenuBar()
delete[] m_menus;
delete[] m_titles;
// TODO
}
void wxMenuBar::MacInstallMenuBar()
{
Handle menubar = ::GetNewMBar( kwxMacMenuBarResource ) ;
wxString message ;
wxCHECK_RET( menubar != NULL, "can't read MBAR resource" );
::SetMenuBar( menubar ) ;
::DisposeHandle( menubar ) ;
MenuHandle menu = ::GetMenuHandle( kwxMacAppleMenuId ) ;
::AppendResMenu(menu, 'DRVR');
for (int i = 0; i < m_menuCount; i++)
{
Str255 label;
wxNode *node;
wxMenuItem *item;
int pos ;
wxMenu* menu = m_menus[i] , *subMenu = NULL ;
if( m_titles[i] == "?" || m_titles[i] == wxApp::s_macHelpMenuTitleName )
{
MenuHandle mh = NULL ;
if ( HMGetHelpMenuHandle( &mh ) != noErr )
{
continue ;
}
if ( formerHelpMenuItems == 0 )
{
if( mh )
formerHelpMenuItems = CountMenuItems( mh ) ;
}
for (pos = 0 , node = menu->m_menuItems.First(); node; node = node->Next(), pos++)
{
item = (wxMenuItem *)node->Data();
subMenu = item->GetSubMenu() ;
if (subMenu)
{
// we don't support hierarchical menus in the help menu yet
}
else
{
Str255 label ;
wxMacBuildMenuString( label , NULL , NULL , item->GetName(), item->GetId() != wxApp::s_macAboutMenuItemId); // no shortcut in about menu
if ( label[0] == 0 )
{
// we cannot add empty menus on mac
label[0] = 1 ;
label[1] = ' ' ;
}
if ( item->GetId() == wxApp::s_macAboutMenuItemId )
{
::SetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , label );
// ::EnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
::EnableItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 );
}
else
{
if ( mh )
::AppendMenu(mh, label );
}
}
}
}
else
{
wxMacBuildMenuString( label, NULL , NULL , m_titles[i] , false );
UMASetMenuTitle( menu->m_macMenuHandle , label ) ;
for (pos = 0, node = menu->m_menuItems.First(); node; node = node->Next(), pos++)
{
item = (wxMenuItem *)node->Data();
subMenu = item->GetSubMenu() ;
if (subMenu)
{
::InsertMenu( subMenu->m_macMenuHandle , -1 ) ;
}
}
::InsertMenu(m_menus[i]->m_macMenuHandle, 0);
}
}
::DrawMenuBar() ;
s_macInstalledMenuBar = this;
}
// Must only be used AFTER menu has been attached to frame,
// otherwise use individual menus to enable/disable items
void wxMenuBar::Enable(int id, bool flag)
@@ -357,12 +852,12 @@ void wxMenuBar::Enable(int id, bool flag)
if (!item)
return;
// TODO
item->Enable( flag ) ;
}
void wxMenuBar::EnableTop(int pos, bool flag)
{
// TODO
m_menus[pos]->MacEnableMenu( flag ) ;
}
// Must only be used AFTER menu has been attached to frame,
@@ -377,7 +872,7 @@ void wxMenuBar::Check(int id, bool flag)
if (!item->IsCheckable())
return ;
// TODO
item->Check( flag ) ;
}
bool wxMenuBar::Checked(int id) const
@@ -387,8 +882,10 @@ bool wxMenuBar::Checked(int id) const
if (!item)
return FALSE;
// TODO
return FALSE;
if (!item->IsCheckable())
return FALSE ;
return item->IsChecked() ;
}
bool wxMenuBar::Enabled(int id) const
@@ -398,8 +895,23 @@ bool wxMenuBar::Enabled(int id) const
if (!item)
return FALSE;
// TODO
return FALSE ;
if ( !item->IsEnabled() )
return FALSE ;
if ( itemMenu->m_macMenuEnabled == false )
return FALSE ;
while( itemMenu->m_parent )
{
itemMenu = (wxMenu*) itemMenu->m_parent ;
if ( itemMenu->IsKindOf( CLASSINFO( wxMenu ) ) )
{
if ( itemMenu->m_macMenuEnabled == false )
return FALSE ;
}
}
return TRUE ;
}
@@ -411,7 +923,7 @@ void wxMenuBar::SetLabel(int id, const wxString& label)
if (!item)
return;
// TODO
itemMenu->SetLabel( id , label ) ;
}
wxString wxMenuBar::GetLabel(int id) const
@@ -422,31 +934,51 @@ wxString wxMenuBar::GetLabel(int id) const
if (!item)
return wxString("");
// TODO
return wxString("") ;
return itemMenu->GetLabel( id ) ;
}
void wxMenuBar::SetLabelTop(int pos, const wxString& label)
{
// TODO
m_menus[pos]->SetTitle( label ) ;
}
wxString wxMenuBar::GetLabelTop(int pos) const
{
// TODO
return wxString("");
return m_menus[pos]->GetTitle() ;
}
bool wxMenuBar::OnDelete(wxMenu *a_menu, int pos)
{
// TODO
return FALSE;
if (s_macInstalledMenuBar == this)
{
::DeleteMenu( a_menu->m_macMenuId /* m_menus[pos]->m_macMenuId */ ) ;
::InvalMenuBar() ;
return TRUE ;
}
else
{
return TRUE ;
}
}
bool wxMenuBar::OnAppend(wxMenu *a_menu, const char *title)
{
// TODO
return FALSE;
if (!a_menu->m_macMenuHandle)
return FALSE;
if (s_macInstalledMenuBar == this)
{
Str255 label;
wxMacBuildMenuString( label, NULL , NULL , title , false );
UMASetMenuTitle( a_menu->m_macMenuHandle , label ) ;
::InsertMenu( a_menu->m_macMenuHandle , 0 ) ;
::InvalMenuBar() ;
return TRUE ;
}
else
{
return TRUE ;
}
}
void wxMenuBar::Append (wxMenu * menu, const wxString& title)
@@ -477,7 +1009,8 @@ void wxMenuBar::Append (wxMenu * menu, const wxString& title)
m_menus[m_menuCount - 1] = (wxMenu *)menu;
m_titles[m_menuCount - 1] = title;
// TODO
((wxMenu *)menu)->m_menuBar = (wxMenuBar *) this;
((wxMenu *)menu)->SetParent(this);
}
void wxMenuBar::Delete(wxMenu * menu, int i)
@@ -568,4 +1101,43 @@ wxString wxMenuBar::GetHelpString (int Id) const
return wxString("");
}
void wxMenuBar::MacMenuSelect(wxEvtHandler* handler, long when , int macMenuId, int macMenuItemNum)
{
// first scan fast for direct commands, i.e. menus which have these commands directly in their own list
if ( macMenuId == kwxMacAppleMenuId && macMenuItemNum == 1 )
{
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, wxApp::s_macAboutMenuItemId );
event.m_timeStamp = when;
event.SetEventObject(handler);
event.SetInt( wxApp::s_macAboutMenuItemId );
handler->ProcessEvent(event);
}
else
{
for (int i = 0; i < m_menuCount; i++)
{
if ( m_menus[i]->m_macMenuId == macMenuId ||
( macMenuId == kHMHelpMenuID && ( m_titles[i] == "?" || m_titles[i] == wxApp::s_macHelpMenuTitleName ) )
)
{
if ( m_menus[i]->MacMenuSelect( handler , when , macMenuId , macMenuItemNum ) )
return ;
else
{
//TODO flag this as an error since it must contain the item
return ;
}
}
}
for (int i = 0; i < m_menuCount; i++)
{
if ( m_menus[i]->MacMenuSelect( handler , when , macMenuId , macMenuItemNum ) )
{
break ;
}
}
}
}

View File

@@ -16,6 +16,7 @@
#include "wx/menu.h"
#include "wx/menuitem.h"
#include <wx/mac/uma.h>
// ============================================================================
// implementation
// ============================================================================
@@ -49,6 +50,11 @@ wxMenuItem::wxMenuItem(wxMenu *pParentMenu, int id,
m_pSubMenu = pSubMenu;
m_idItem = id;
m_bEnabled = TRUE;
if ( m_strName == "E&xit" ||m_strName == "Exit" )
{
m_strName = "Quit\tCtrl+Q" ;
}
}
wxMenuItem::~wxMenuItem()
@@ -73,12 +79,35 @@ void wxMenuItem::DeleteSubMenu()
void wxMenuItem::Enable(bool bDoEnable)
{
if ( m_bEnabled != bDoEnable ) {
if ( m_pSubMenu == NULL ) { // normal menu item
// TODO
if ( m_pSubMenu == NULL )
{
// normal menu item
if ( m_pParentMenu->m_macMenuHandle )
{
int index = m_pParentMenu->MacGetIndexFromItem( this ) ;
if ( index >= 1 )
{
if ( bDoEnable )
UMAEnableMenuItem( m_pParentMenu->m_macMenuHandle , index ) ;
else
UMADisableMenuItem( m_pParentMenu->m_macMenuHandle , index ) ;
}
}
}
else // submenu
else
{
// TODO
// submenu
if ( m_pParentMenu->m_macMenuHandle )
{
int index = m_pParentMenu->MacGetIndexFromItem( this ) ;
if ( index >= 1 )
{
if ( bDoEnable )
UMAEnableMenuItem( m_pParentMenu->m_macMenuHandle , index ) ;
else
UMADisableMenuItem( m_pParentMenu->m_macMenuHandle , index ) ;
}
}
}
m_bEnabled = bDoEnable;
@@ -89,7 +118,19 @@ void wxMenuItem::Check(bool bDoCheck)
{
wxCHECK_RET( IsCheckable(), "only checkable items may be checked" );
if ( m_bChecked != bDoCheck ) {
// TODO
if ( m_bChecked != bDoCheck )
{
m_bChecked = bDoCheck;
if ( m_pParentMenu->m_macMenuHandle )
{
int index = m_pParentMenu->MacGetIndexFromItem( this ) ;
if ( index >= 1 )
{
if ( bDoCheck )
::SetItemMark( m_pParentMenu->m_macMenuHandle , index , 0x12 ) ; // checkmark
else
::SetItemMark( m_pParentMenu->m_macMenuHandle , index , 0 ) ; // no mark
}
}
}
}

View File

@@ -13,46 +13,118 @@
#pragma implementation "metafile.h"
#endif
#include "wx/object.h"
#include "wx/string.h"
#include "wx/dc.h"
#include "wx/stubs/metafile.h"
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/setup.h"
#endif
#if wxUSE_METAFILE
#ifndef WX_PRECOMP
#include "wx/utils.h"
#include "wx/app.h"
#endif
#include "wx/metafile.h"
#include "wx/clipbrd.h"
#include <stdio.h>
#include <string.h>
extern bool wxClipboardIsOpen;
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxMetaFile, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxMetaFileDC, wxDC)
IMPLEMENT_DYNAMIC_CLASS(wxMetafile, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxMetafileDC, wxDC)
#endif
/*
* Metafiles
* Currently, the only purpose for making a metafile is to put
* it on the clipboard.
*/
wxMetafileRefData::wxMetafileRefData(void)
{
m_metafile = 0;
}
wxMetafileRefData::~wxMetafileRefData(void)
{
if (m_metafile)
{
KillPicture( m_metafile ) ;
m_metafile = 0;
}
}
wxMetaFile::wxMetaFile(const wxString& file)
{
// TODO
m_refData = new wxMetafileRefData;
M_METAFILEDATA->m_metafile = 0;
wxASSERT_MSG( file.IsEmpty() , "no file based metafile support yet") ;
/*
if (!file.IsNull() && (file.Cmp("") == 0))
M_METAFILEDATA->m_metafile = (WXHANDLE) GetMetaFile(file);
*/
}
wxMetaFile::~wxMetaFile()
{
// TODO
}
bool wxMetaFile::SetClipboard(int width, int height)
{
if (!m_refData)
return FALSE;
/*
bool alreadyOpen=wxClipboardOpen();
if (!alreadyOpen)
{
wxOpenClipboard();
if (!wxEmptyClipboard()) return FALSE;
}
bool success = wxSetClipboardData(wxDF_METAFILE,this, width,height);
bool success = wxSetClipboardData(wxDF_METAFILE, this, width,height);
if (!alreadyOpen) wxCloseClipboard();
return (bool) success;
*/
return TRUE ;
}
bool wxMetaFile::Play(wxDC *dc)
{
// TODO
if (!m_refData)
return FALSE;
if (!dc->Ok() )
return FALSE;
dc->MacVerifySetup() ;
{
PicHandle pict = GetHMETAFILE() ;
DrawPicture( pict , &(**pict).picFrame ) ;
}
/*
if (!m_refData)
return FALSE;
dc->BeginDrawing();
if (dc->GetHDC() && M_METAFILEDATA->m_metafile)
PlayMetaFile((HDC) dc->GetHDC(), (HMETAFILE) M_METAFILEDATA->m_metafile);
dc->EndDrawing();
*/
return TRUE;
}
/*
@@ -64,176 +136,55 @@ bool wxMetaFile::Play(wxDC *dc)
// *DO* give origin/extent arguments to wxMakeMetaFilePlaceable.
wxMetaFileDC::wxMetaFileDC(const wxString& file)
{
// TODO
m_metaFile = NULL;
m_minX = 10000;
m_minY = 10000;
m_maxX = -10000;
m_maxY = -10000;
wxASSERT_MSG( file.IsEmpty() , "no file based metafile support yet") ;
m_metaFile = new wxMetaFile("") ;
Rect r={0,0,100,100} ;
m_metaFile->SetHMETAFILE( OpenPicture( &r ) ) ;
::GetPort( &m_macPort ) ;
m_ok = TRUE ;
SetMapMode(wxMM_TEXT);
}
// New constructor that takes origin and extent. If you use this, don't
// give origin/extent arguments to wxMakeMetaFilePlaceable.
wxMetaFileDC::wxMetaFileDC(const wxString& file, int xext, int yext, int xorg, int yorg)
{
// TODO
m_minX = 10000;
m_minY = 10000;
m_maxX = -10000;
m_maxY = -10000;
wxASSERT_MSG( file.IsEmpty() , "no file based metafile support yet") ;
m_metaFile = new wxMetaFile("") ;
Rect r={yorg,xorg,yorg+yext,xorg+xext} ;
m_metaFile->SetHMETAFILE( OpenPicture( &r ) ) ;
::GetPort( &m_macPort ) ;
m_ok = TRUE ;
SetMapMode(wxMM_TEXT);
}
wxMetaFileDC::~wxMetaFileDC()
{
}
void wxMetaFileDC::GetTextExtent(const wxString& string, float *x, float *y,
float *descent, float *externalLeading, wxFont *theFont, bool use16bit)
{
// TODO
}
wxMetaFile *wxMetaFileDC::Close()
{
// TODO
return NULL;
ClosePicture() ;
return m_metaFile;
}
void wxMetaFileDC::SetMapMode(int mode)
{
// TODO
}
#if 0
#ifdef __WIN32__
struct RECT32
{
short left;
short top;
short right;
short bottom;
};
struct mfPLACEABLEHEADER {
DWORD key;
short hmf;
RECT32 bbox;
WORD inch;
DWORD reserved;
WORD checksum;
};
#else
struct mfPLACEABLEHEADER {
DWORD key;
HANDLE hmf;
RECT bbox;
WORD inch;
DWORD reserved;
WORD checksum;
};
#endif
/*
* Pass filename of existing non-placeable metafile, and bounding box.
* Adds a placeable metafile header, sets the mapping mode to anisotropic,
* and sets the window origin and extent to mimic the wxMM_TEXT mapping mode.
*
*/
bool wxMakeMetaFilePlaceable(const wxString& filename, float scale)
{
return wxMakeMetaFilePlaceable(filename, 0, 0, 0, 0, scale, FALSE);
}
bool wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale, bool useOriginAndExtent)
{
// I'm not sure if this is the correct way of suggesting a scale
// to the client application, but it's the only way I can find.
int unitsPerInch = (int)(576/scale);
mfPLACEABLEHEADER header;
header.key = 0x9AC6CDD7L;
header.hmf = 0;
header.bbox.left = (int)(x1);
header.bbox.top = (int)(y1);
header.bbox.right = (int)(x2);
header.bbox.bottom = (int)(y2);
header.inch = unitsPerInch;
header.reserved = 0;
// Calculate checksum
WORD *p;
mfPLACEABLEHEADER *pMFHead = &header;
for (p =(WORD *)pMFHead,pMFHead -> checksum = 0;
p < (WORD *)&pMFHead ->checksum; ++p)
pMFHead ->checksum ^= *p;
FILE *fd = fopen((char *)(const char *)filename, "rb");
if (!fd) return FALSE;
char tempFileBuf[256];
wxGetTempFileName("mf", tempFileBuf);
FILE *fHandle = fopen(tempFileBuf, "wb");
if (!fHandle)
return FALSE;
fwrite((void *)&header, sizeof(unsigned char), sizeof(mfPLACEABLEHEADER), fHandle);
// Calculate origin and extent
int originX = x1;
int originY = y1;
int extentX = x2 - x1;
int extentY = (y2 - y1);
// Read metafile header and write
METAHEADER metaHeader;
fread((void *)&metaHeader, sizeof(unsigned char), sizeof(metaHeader), fd);
if (useOriginAndExtent)
metaHeader.mtSize += 15;
else
metaHeader.mtSize += 5;
fwrite((void *)&metaHeader, sizeof(unsigned char), sizeof(metaHeader), fHandle);
// Write SetMapMode, SetWindowOrigin and SetWindowExt records
char modeBuffer[8];
char originBuffer[10];
char extentBuffer[10];
METARECORD *modeRecord = (METARECORD *)&modeBuffer;
METARECORD *originRecord = (METARECORD *)&originBuffer;
METARECORD *extentRecord = (METARECORD *)&extentBuffer;
modeRecord->rdSize = 4;
modeRecord->rdFunction = META_SETMAPMODE;
modeRecord->rdParm[0] = wxMM_ANISOTROPIC;
originRecord->rdSize = 5;
originRecord->rdFunction = META_SETWINDOWORG;
originRecord->rdParm[0] = originY;
originRecord->rdParm[1] = originX;
extentRecord->rdSize = 5;
extentRecord->rdFunction = META_SETWINDOWEXT;
extentRecord->rdParm[0] = extentY;
extentRecord->rdParm[1] = extentX;
fwrite((void *)modeBuffer, sizeof(char), 8, fHandle);
if (useOriginAndExtent)
{
fwrite((void *)originBuffer, sizeof(char), 10, fHandle);
fwrite((void *)extentBuffer, sizeof(char), 10, fHandle);
}
int ch = -2;
while (ch != EOF)
{
ch = getc(fd);
if (ch != EOF)
{
putc(ch, fHandle);
}
}
fclose(fHandle);
fclose(fd);
wxRemoveFile(filename);
wxCopyFile(tempFileBuf, filename);
wxRemoveFile(tempFileBuf);
return TRUE;
}
#endif

View File

@@ -14,11 +14,47 @@
#endif
#include "wx/msgdlg.h"
#include "wx/mac/uma.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_CLASS(wxMessageDialog, wxDialog)
#endif
#define kMacOKAlertResourceID 128
#define kMacYesNoAlertResourceID 129
#define kMacYesNoCancelAlertResourceID 130
#define kMacNoYesAlertResourceID 131
#define kMacNoYesCancelAlertResourceID 132
short language = 0 ;
void wxMacConvertNewlines( const char *source , char * destination )
{
const char *s = source ;
char *d = destination ;
while( *s )
{
switch( *s )
{
case 0x0a :
*d++ = 0x0d ;
++s ;
break ;
case 0x0d :
*d++ = 0x0d ;
++s ;
if ( *s == 0x0a )
++s ;
break ;
default :
*d++ = *s++ ;
break ;
}
}
*d = 0 ;
}
wxMessageDialog::wxMessageDialog(wxWindow *parent, const wxString& message, const wxString& caption,
long style, const wxPoint& pos)
{
@@ -30,7 +66,226 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent, const wxString& message, cons
int wxMessageDialog::ShowModal()
{
// TODO
return wxID_CANCEL;
int resultbutton = wxID_CANCEL ;
short result ;
Str255 pascalTitle ;
Str255 pascalText ;
strcpy( (char*) pascalTitle , m_caption ) ;
c2pstr( (char*) pascalTitle ) ;
strcpy( (char*) pascalText , m_message ) ;
wxMacConvertNewlines( (char*)pascalText ,(char*) pascalText) ;
c2pstr( (char*) pascalText ) ;
if ( !UMAHasAppearance() )
{
int resourceID ;
if (m_dialogStyle & wxYES_NO)
{
if (m_dialogStyle & wxCANCEL)
resourceID = kMacYesNoCancelAlertResourceID;
else
resourceID = kMacYesNoAlertResourceID + language * 10 ;
}
else if (m_dialogStyle & wxOK)
{
if (m_dialogStyle & wxCANCEL)
resourceID = kMacOKAlertResourceID; // wrong
else
resourceID = kMacOKAlertResourceID;
}
else
{
return resultbutton ;
}
/*
if (hWnd)
msStyle |= MB_APPLMODAL;
else
msStyle |= MB_TASKMODAL;
*/
ParamText( pascalTitle , pascalText , NULL , NULL ) ;
if (m_dialogStyle & wxICON_EXCLAMATION)
result = Alert( resourceID , NULL ) ;
else if (m_dialogStyle & wxICON_HAND)
result = StopAlert( resourceID , NULL ) ;
else if (m_dialogStyle & wxICON_INFORMATION)
result = NoteAlert( resourceID , NULL ) ;
else if (m_dialogStyle & wxICON_QUESTION)
result = CautionAlert( resourceID , NULL ) ;
else
result = Alert( resourceID , NULL ) ;
resultbutton = result ;
if (m_dialogStyle & wxYES_NO)
{
if (m_dialogStyle & wxCANCEL)
{
switch( result )
{
case 1 :
resultbutton = wxID_YES ;
break ;
case 2 :
resultbutton = wxID_NO ;
break ;
case 3 :
resultbutton = wxID_CANCEL ;
break ;
}
}
else
{
switch( result )
{
case 1 :
resultbutton = wxID_YES ;
break ;
case 2 :
resultbutton = wxID_NO ;
break ;
case 3 :
break ;
}
}
}
}
else
{
AlertStdAlertParamRec param;
param.movable = true;
param.filterProc = NULL ;
if (m_dialogStyle & wxYES_NO)
{
if (m_dialogStyle & wxCANCEL)
{
param.defaultText = "\pYes" ;
param.cancelText = (StringPtr) kAlertDefaultCancelText;
param.otherText = "\pNo";
param.helpButton = false ;
param.defaultButton = kAlertStdAlertOKButton;
param.cancelButton = kAlertStdAlertCancelButton;
}
else
{
param.defaultText = "\pYes" ;
param.cancelText = NULL;
param.otherText = "\pNo";
param.helpButton = false ;
param.defaultButton = kAlertStdAlertOKButton;
param.cancelButton = 0;
}
}
else if (m_dialogStyle & wxOK)
{
if (m_dialogStyle & wxCANCEL)
{
// thats a cancel missing
param.defaultText = (StringPtr) kAlertDefaultOKText ;
param.cancelText = NULL;
param.otherText = NULL;
param.helpButton = false ;
param.defaultButton = kAlertStdAlertOKButton;
param.cancelButton = 0;
}
else
{
param.defaultText = (StringPtr) kAlertDefaultOKText ;
param.cancelText = NULL;
param.otherText = NULL;
param.helpButton = false ;
param.defaultButton = kAlertStdAlertOKButton;
param.cancelButton = 0;
}
}
else
{
return resultbutton ;
}
param.position = 0;
if (m_dialogStyle & wxICON_EXCLAMATION)
StandardAlert( kAlertNoteAlert, pascalTitle, pascalText, &param, &result );
else if (m_dialogStyle & wxICON_HAND)
StandardAlert( kAlertStopAlert, pascalTitle, pascalText, &param, &result );
else if (m_dialogStyle & wxICON_INFORMATION)
StandardAlert( kAlertNoteAlert, pascalTitle, pascalText, &param, &result );
else if (m_dialogStyle & wxICON_QUESTION)
StandardAlert( kAlertCautionAlert, pascalTitle, pascalText, &param, &result );
else
StandardAlert( kAlertPlainAlert, pascalTitle, pascalText, &param, &result );
if (m_dialogStyle & wxOK)
{
if (m_dialogStyle & wxCANCEL)
{
//TODO add Cancelbutton
switch( result )
{
case 1 :
resultbutton = wxID_OK ;
break ;
case 2 :
break ;
case 3 :
break ;
}
}
else
{
switch( result )
{
case 1 :
resultbutton = wxID_OK ;
break ;
case 2 :
break ;
case 3 :
break ;
}
}
}
else if (m_dialogStyle & wxYES_NO)
{
if (m_dialogStyle & wxCANCEL)
{
switch( result )
{
case 1 :
resultbutton = wxID_YES ;
break ;
case 2 :
resultbutton = wxID_CANCEL ;
break ;
case 3 :
resultbutton = wxID_NO ;
break ;
}
}
else
{
switch( result )
{
case 1 :
resultbutton = wxID_YES ;
break ;
case 2 :
break ;
case 3 :
resultbutton = wxID_NO ;
break ;
}
}
}
}
return resultbutton ;
}

Some files were not shown because too many files have changed in this diff Show More