Tidied space and tabs in wxMac files

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19397 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2003-02-28 23:48:13 +00:00
parent 7de24929eb
commit e40298d54e
202 changed files with 17354 additions and 17176 deletions

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GAUGE_H_

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GDIOBJ_H_
@@ -21,8 +21,8 @@
class WXDLLEXPORT wxGDIRefData: public wxObjectRefData {
public:
inline wxGDIRefData()
{
}
{
}
};
#define M_GDIDATA ((wxGDIRefData *)m_refData)

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(__APPLE__)
@@ -92,17 +92,17 @@ class WXDLLEXPORT wxGLCanvas: public wxWindow
wxGLCanvas( wxWindow *parent, const wxGLContext *shared = (wxGLContext *)NULL,
wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "GLCanvas",
int *attribList = (int*) NULL, const wxPalette& palette = wxNullPalette );
int *attribList = (int*) NULL, const wxPalette& palette = wxNullPalette );
wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared = (wxGLCanvas *)NULL, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0,
const wxString& name = "GLCanvas", int *attribList = 0, const wxPalette& palette = wxNullPalette );
const wxString& name = "GLCanvas", int *attribList = 0, const wxPalette& palette = wxNullPalette );
~wxGLCanvas();
bool Create(wxWindow *parent, const wxGLContext *shared, wxWindowID id,
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
int *attribList, const wxPalette& palette);
int *attribList, const wxPalette& palette);
void SetCurrent();
void SetColour(const char *colour);
@@ -115,9 +115,9 @@ class WXDLLEXPORT wxGLCanvas: public wxWindow
// You shouldn't call glViewport yourself either (use SetViewport if you must reset it.)
void OnSize(wxSizeEvent& event);
virtual void MacSuperChangedPosition() ;
virtual void MacTopLevelWindowChangedPosition() ;
void MacUpdateView() ;
virtual void MacSuperChangedPosition() ;
virtual void MacTopLevelWindowChangedPosition() ;
void MacUpdateView() ;
inline wxGLContext* GetContext() const { return m_glContext; }

View File

@@ -54,8 +54,8 @@ struct _GSocket
struct _GAddress
{
UInt32 m_host ;
UInt16 m_port ;
UInt32 m_host ;
UInt16 m_port ;
GAddressType m_family;
GSocketError m_error;
};

View File

@@ -7,7 +7,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_HELPXXXX_H_

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ICON_H_
@@ -41,7 +41,7 @@ public:
bool LoadFile(const wxString& name, wxBitmapType flags /* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
int desiredWidth /* = -1 */ , int desiredHeight = -1);
bool LoadFile(const wxString& name ,wxBitmapType flags = wxBITMAP_TYPE_ICON_RESOURCE )
{ return LoadFile( name , flags , -1 , -1 ) ; }
{ 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; }
@@ -60,9 +60,9 @@ class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler
public:
inline wxICONFileHandler()
{
m_name = "ICO icon file";
m_extension = "ico";
m_type = wxBITMAP_TYPE_ICO;
m_name = "ICO icon file";
m_extension = "ico";
m_type = wxBITMAP_TYPE_ICO;
};
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
@@ -76,9 +76,9 @@ class WXDLLEXPORT wxICONResourceHandler: public wxBitmapHandler
public:
inline wxICONResourceHandler()
{
m_name = "ICON resource";
m_extension = "";
m_type = wxBITMAP_TYPE_ICON_RESOURCE;
m_name = "ICON resource";
m_extension = "";
m_type = wxBITMAP_TYPE_ICON_RESOURCE;
};
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,

View File

@@ -8,7 +8,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_IMAGLIST_H_

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_JOYSTICK_H_

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@@ -94,7 +94,7 @@ public:
virtual void* DoGetItemClientData(int n) const;
virtual void DoSetItemClientObject(int n, wxClientData* clientData);
virtual wxClientData* DoGetItemClientObject(int n) const;
virtual void DoSetSize(int x, int y,int width, int height,int sizeFlags = wxSIZE_AUTO ) ;
virtual void DoSetSize(int x, int y,int width, int height,int sizeFlags = wxSIZE_AUTO ) ;
// wxCheckListBox support
#if wxUSE_OWNER_DRAWN
@@ -112,7 +112,7 @@ public:
virtual void SetupColours();
virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
virtual bool MacCanFocus() const { return true ; }
virtual bool MacCanFocus() const { return true ; }
void OnChar(wxKeyEvent& event);
void* m_macList ;
@@ -145,8 +145,8 @@ protected:
int m_noItems;
int m_selected;
wxString m_typeIn ;
long m_lastTypeIn ;
wxString m_typeIn ;
long m_lastTypeIn ;
virtual wxSize DoGetBestSize() const;

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_LISTCTRL_H_

View File

@@ -8,7 +8,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MDI_H_

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MENU_H_
@@ -57,9 +57,9 @@ public:
// implementation only from now on
// -------------------------------
int MacGetIndexFromId( int id ) ;
int MacGetIndexFromItem( wxMenuItem *pItem ) ;
void MacEnableMenu( bool bDoEnable ) ;
int MacGetIndexFromId( int id ) ;
int MacGetIndexFromItem( wxMenuItem *pItem ) ;
void MacEnableMenu( bool bDoEnable ) ;
// semi-private accessors
// get the window which contains this menu
@@ -67,7 +67,7 @@ public:
// get the menu handle
WXHMENU GetHMenu() const { return m_hMenu; }
short MacGetMenuId() { return m_macMenuId ; }
short MacGetMenuId() { return m_macMenuId ; }
private:
// common part of all ctors
@@ -88,9 +88,9 @@ private:
// the menu handle of this menu
WXHMENU m_hMenu;
short m_macMenuId;
short m_macMenuId;
static short s_macNextMenuId ;
static short s_macNextMenuId ;
DECLARE_DYNAMIC_CLASS(wxMenu)
};
@@ -146,11 +146,11 @@ public:
// attach to a frame
void Attach(wxFrame *frame);
// clear the invoking window for all menus and submenus
void UnsetInvokingWindow() ;
// clear the invoking window for all menus and submenus
void UnsetInvokingWindow() ;
// set the invoking window for all menus and submenus
void SetInvokingWindow( wxFrame* frame ) ;
// set the invoking window for all menus and submenus
void SetInvokingWindow( wxFrame* frame ) ;
// if the menubar is modified, the display is not updated automatically,
// call this function to update it (m_menuBarFrame should be !NULL)
@@ -171,7 +171,7 @@ protected:
wxArrayString m_titles;
private:
static wxMenuBar* s_macInstalledMenuBar ;
static wxMenuBar* s_macInstalledMenuBar ;
DECLARE_DYNAMIC_CLASS(wxMenuBar)
};

View File

@@ -46,10 +46,10 @@ public:
virtual void SetBitmap(const wxBitmap& bitmap) ;
virtual const wxBitmap& GetBitmap() const { return m_bitmap; }
// update the os specific representation
void UpdateItemBitmap() ;
void UpdateItemText() ;
void UpdateItemStatus() ;
// update the os specific representation
void UpdateItemBitmap() ;
void UpdateItemText() ;
void UpdateItemStatus() ;
// mark item as belonging to the given radio group
void SetAsRadioGroupStart();

View File

@@ -8,7 +8,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////

View File

@@ -71,7 +71,7 @@ public:
// the first extension found, index 1 for the second and so on
void Init(wxMimeTypesManagerImpl *manager, size_t index)
{ m_manager = manager; m_index.Add(index); }
{ m_manager = manager; m_index.Add(index); }
// initialize us with our file type name
void SetFileType(const wxString& strFileType)
@@ -98,10 +98,10 @@ public:
// remove the record for this file type
// probably a mistake to come here, use wxMimeTypesManager.Unassociate (ft) instead
bool Unassociate(wxFileType *ft)
{
return m_manager->Unassociate(ft);
}
{
return m_manager->Unassociate(ft);
}
// set an arbitrary command, ask confirmation if it already exists and
// overwriteprompt is TRUE
bool SetCommand(const wxString& cmd, const wxString& verb, bool overwriteprompt = TRUE);

View File

@@ -8,7 +8,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MINIFRAM_H_

View File

@@ -7,7 +7,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSGBOXDLG_H_

View File

@@ -5,7 +5,7 @@
// Modified by:
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_NOTEBOOK_H_
@@ -135,7 +135,7 @@ public:
virtual void Command(wxCommandEvent& event);
protected:
virtual wxNotebookPage *DoRemovePage(int page) ;
virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
// common part of all ctors
void Init();

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PALETTE_H_

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PEN_H_

View File

@@ -6,7 +6,7 @@
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Microsoft, Julian Smart
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(__APPLE__)
@@ -22,9 +22,9 @@ class WXDLLEXPORT wxPNGFileHandler: public wxBitmapHandler
public:
inline wxPNGFileHandler(void)
{
m_name = "PNG bitmap file";
m_extension = "bmp";
m_type = wxBITMAP_TYPE_PNG;
m_name = "PNG bitmap file";
m_extension = "bmp";
m_type = wxBITMAP_TYPE_PNG;
};
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,

View File

@@ -1,9 +1,9 @@
/*
* File: pngread.h
* Purpose: PNG file reader
* Author: Alejandro Aguilar Sierra/Julian Smart
* Created: 1995
* Copyright: (c) 1995, Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
* File: pngread.h
* Purpose: PNG file reader
* Author: Alejandro Aguilar Sierra/Julian Smart
* Created: 1995
* Copyright: (c) 1995, Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
*
*
*/
@@ -25,30 +25,30 @@ typedef byte * ImagePointerType;
typedef struct
{
byte red;
byte green;
byte red;
byte green;
byte blue;
} rgb_color_struct;
#define COLORTYPE_PALETTE 1
#define COLORTYPE_COLOR 2
#define COLORTYPE_ALPHA 4
#define COLORTYPE_PALETTE 1
#define COLORTYPE_COLOR 2
#define COLORTYPE_ALPHA 4
class wxPNGReader
{
protected:
int filetype;
char filename[255];
ImagePointerType RawImage; // Image data
ImagePointerType RawImage; // Image data
int Width, Height; // Dimensions
int Depth; // (bits x pixel)
int ColorType; // Bit 1 = Palette used
// Bit 2 = Color used
// Bit 3 = Alpha used
int Width, Height; // Dimensions
int Depth; // (bits x pixel)
int ColorType; // Bit 1 = Palette used
// Bit 2 = Color used
// Bit 3 = Alpha used
long EfeWidth; // Efective Width
long EfeWidth; // Efective Width
void *lpbi;
int bgindex;
@@ -98,9 +98,9 @@ public:
class wxPNGReaderIter
{
protected:
int Itx, Ity; // Counters
int Itx, Ity; // Counters
int Stepx, Stepy;
ImagePointerType IterImage; // Image pointer
ImagePointerType IterImage; // Image pointer
wxPNGReader *ima;
public:
// Constructors
@@ -146,7 +146,7 @@ inline
wxPNGReaderIter::wxPNGReaderIter(wxPNGReader *imax): ima(imax)
{
if (ima)
IterImage = ima->RawImage;
IterImage = ima->RawImage;
Itx = Ity = 0;
Stepx = Stepy = 0;
}
@@ -161,9 +161,9 @@ inline
bool wxPNGReaderIter::ItOK ()
{
if (ima)
return ima->Inside(Itx, Ity);
return ima->Inside(Itx, Ity);
else
return FALSE;
return FALSE;
}
@@ -209,7 +209,7 @@ inline void wxPNGReaderIter::SetRow(byte *buf, int n)
// Here should be bcopy or memcpy
//_fmemcpy(IterImage, (void far *)buf, n);
if (n<0)
n = ima->GetWidth();
n = ima->GetWidth();
for (int i=0; i<n; i++) IterImage[i] = buf[i];
}
@@ -227,45 +227,45 @@ inline ImagePointerType wxPNGReaderIter::GetRow()
inline bool wxPNGReaderIter::NextByte()
{
if (++Itx < ima->EfeWidth)
return 1;
return 1;
else
if (++Ity < ima->Height)
{
IterImage += ima->EfeWidth;
Itx = 0;
return 1;
} else
return 0;
if (++Ity < ima->Height)
{
IterImage += ima->EfeWidth;
Itx = 0;
return 1;
} else
return 0;
}
inline bool wxPNGReaderIter::PrevByte()
{
if (--Itx >= 0)
return 1;
return 1;
else
if (--Ity >= 0)
{
IterImage -= ima->EfeWidth;
Itx = 0;
return 1;
} else
return 0;
if (--Ity >= 0)
{
IterImage -= ima->EfeWidth;
Itx = 0;
return 1;
} else
return 0;
}
inline bool wxPNGReaderIter::NextStep()
{
Itx += Stepx;
if (Itx < ima->EfeWidth)
return 1;
return 1;
else {
Ity += Stepy;
if (Ity < ima->Height)
{
IterImage += ima->EfeWidth;
Itx = 0;
return 1;
} else
return 0;
Ity += Stepy;
if (Ity < ima->Height)
{
IterImage += ima->EfeWidth;
Itx = 0;
return 1;
} else
return 0;
}
}
@@ -273,16 +273,16 @@ inline bool wxPNGReaderIter::PrevStep()
{
Itx -= Stepx;
if (Itx >= 0)
return 1;
else {
Ity -= Stepy;
if (Ity >= 0 && Ity < ima->Height)
{
IterImage -= ima->EfeWidth;
Itx = 0;
return 1;
} else
return 0;
return 1;
else {
Ity -= Stepy;
if (Ity >= 0 && Ity < ima->Height)
{
IterImage -= ima->EfeWidth;
Itx = 0;
return 1;
} else
return 0;
}
}

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PRINT_H_

View File

@@ -8,7 +8,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PRINTDLG_H_

View File

@@ -6,7 +6,7 @@
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PRINTWIN_H_

View File

@@ -8,7 +8,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PRIVATE_H_
@@ -50,14 +50,14 @@ public:
GrafPtr GetCurrentPort() { return m_currentPort ; }
private:
GrafPtr m_currentPort ;
GrafPtr m_oldPort ;
RgnHandle m_clip ;
GrafPtr m_currentPort ;
GrafPtr m_oldPort ;
RgnHandle m_clip ;
ThemeDrawingState m_drawingState ;
short m_textFont ;
short m_textSize ;
short m_textStyle ;
short m_textMode ;
short m_textFont ;
short m_textSize ;
short m_textStyle ;
short m_textMode ;
} ;
class WXDLLEXPORT wxMacPortSetter
@@ -123,12 +123,12 @@ WXDLLEXPORT wxString wxMacFindFolder(short vRefNum,
OSType folderType,
Boolean createFolder);
GWorldPtr wxMacCreateGWorld( int width , int height , int depth ) ;
void wxMacDestroyGWorld( GWorldPtr gw ) ;
PicHandle wxMacCreatePict( GWorldPtr gw , GWorldPtr mask = NULL ) ;
GWorldPtr wxMacCreateGWorld( int width , int height , int depth ) ;
void wxMacDestroyGWorld( GWorldPtr gw ) ;
PicHandle wxMacCreatePict( GWorldPtr gw , GWorldPtr mask = NULL ) ;
CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth , short iconSize ) ;
void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) ;
CTabHandle wxMacCreateColorTable( int numColors ) ;
void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) ;
CTabHandle wxMacCreateColorTable( int numColors ) ;
void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType = 0 ) ;
#define MAC_WXCOLORREF(a) (*((RGBColor*)&(a)))
@@ -165,7 +165,7 @@ inline wxString wxMacMakeStringFromMacString( const char* from )
// converts this c string into a wxString with pc 2 mac encoding if s_macDefaultEncodingIsPC
inline wxString wxMacMakeStringFromMacString( const wxString& from )
{ return wxApp::s_macDefaultEncodingIsPC ?
wxMacMakeStringFromMacString( from.c_str() , true ) : from ; }
wxMacMakeStringFromMacString( from.c_str() , true ) : from ; }
//
// Pascal Strings

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_RADIOBOX_H_
@@ -23,65 +23,65 @@ class WXDLLEXPORT wxRadioButton ;
class WXDLLEXPORT wxRadioBox: public wxControl, public wxRadioBoxBase
{
DECLARE_DYNAMIC_CLASS(wxRadioBox)
DECLARE_DYNAMIC_CLASS(wxRadioBox)
public:
// Constructors & destructor
wxRadioBox();
inline wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title,
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();
bool Create(wxWindow *parent, wxWindowID id, const wxString& title,
{
Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name);
}
~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);
// Specific functions (in wxWindows2 reference)
virtual void SetSelection(int item);
virtual int GetSelection() const;
inline virtual int GetCount() const { return m_noItems; } ;
virtual void SetSelection(int item);
virtual int GetSelection() const;
virtual wxString GetString(int item) const;
virtual void SetString(int item, const wxString& label) ;
virtual void Enable(int item, bool enable);
virtual void Show(int item, bool show) ;
inline virtual int GetCount() const { return m_noItems; } ;
virtual wxString GetString(int item) const;
virtual void SetString(int item, const wxString& label) ;
virtual void Enable(int item, bool enable);
virtual void Show(int item, bool show) ;
virtual int GetColumnCount() const ;
virtual int GetRowCount() const ;
virtual bool Enable(bool enable = TRUE);
virtual wxString GetLabel() const;
virtual void SetLabel(const wxString& label) ;
virtual bool Show(bool show = TRUE);
virtual bool Enable(bool enable = TRUE);
virtual wxString GetLabel() const;
virtual void SetLabel(const wxString& label) ;
virtual bool Show(bool show = TRUE);
// Other external functions
void Command(wxCommandEvent& event);
void SetFocus();
void Command(wxCommandEvent& event);
void SetFocus();
// Other variable access functions
inline int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
inline int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
void OnRadioButton( wxCommandEvent& event ) ;
void OnRadioButton( wxCommandEvent& event ) ;
protected:
wxRadioButton *m_radioButtonCycle;
int m_majorDim ;
int m_noItems;
int m_noRowsOrCols;
wxRadioButton *m_radioButtonCycle;
int m_majorDim ;
int m_noItems;
int m_noRowsOrCols;
// Internal functions
virtual wxSize DoGetBestSize() const ;
virtual void DoSetSize(int x, int y,
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO);

View File

@@ -6,7 +6,7 @@
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_RADIOBUT_H_
@@ -44,7 +44,7 @@ public:
// implementation
virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart );
virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart );
void Command(wxCommandEvent& event);
wxRadioButton *AddInCycle(wxRadioButton *cycle);
inline wxRadioButton *NextInCycle() {return m_cycle;}

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_REGION_H_
@@ -24,7 +24,7 @@ class WXDLLEXPORT wxRect;
class WXDLLEXPORT wxPoint;
enum wxRegionContain {
wxOutRegion = 0, wxPartRegion = 1, wxInRegion = 2
wxOutRegion = 0, wxPartRegion = 1, wxInRegion = 2
};
// So far, for internal use only
@@ -38,7 +38,7 @@ wxRGN_XOR // Creates the union of two combined regions except for any
class WXDLLEXPORT wxRegion : public wxGDIObject {
DECLARE_DYNAMIC_CLASS(wxRegion);
friend class WXDLLEXPORT wxRegionIterator;
friend class WXDLLEXPORT wxRegionIterator;
public:
wxRegion(long x, long y, long w, long h);
wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
@@ -155,4 +155,4 @@ private:
};
#endif
// _WX_REGION_H_
// _WX_REGION_H_

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SCROLBAR_H_
@@ -57,7 +57,7 @@ public:
bool refresh = TRUE);
void Command(wxCommandEvent& event);
virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
protected:
int m_pageSize;

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SETUP_H_
@@ -855,7 +855,7 @@
// that use the connection) should support forward only scrolling of cursors,
// or both forward and backward support for backward scrolling cursors is
// dependent on the data source as well as the ODBC driver being used.
#define wxODBC_FWD_ONLY_CURSORS 1
#define wxODBC_FWD_ONLY_CURSORS 1
// Default is 0. Set to 1 to use the deprecated classes, enum types, function,
// member variables. With a setting of 1, full backward compatability with the

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SLIDER_H_
@@ -87,12 +87,12 @@ public:
virtual void DoMoveWindow(int x, int y, int w, int h);
void Command(wxCommandEvent& event);
void MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
virtual void MacUpdateDimensions() ;
void MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
virtual void MacUpdateDimensions() ;
wxStaticText* m_macMinimumStatic ;
wxStaticText* m_macMaximumStatic ;
wxStaticText* m_macValueStatic ;
wxStaticText* m_macMinimumStatic ;
wxStaticText* m_macMaximumStatic ;
wxStaticText* m_macValueStatic ;
int m_rangeMin;
int m_rangeMax;

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SPINBUTT_H_

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_STATBMP_H_
@@ -50,8 +50,8 @@ class WXDLLEXPORT wxStaticBitmap: public wxStaticBitmapBase
wxBitmap GetBitmap() const { return m_bitmap; }
wxIcon GetIcon() const
{
// icons and bitmaps are really the same thing in wxMac
return (const wxIcon &)m_bitmap;
// icons and bitmaps are really the same thing in wxMac
return (const wxIcon &)m_bitmap;
}
void SetIcon(const wxIcon& icon) { SetBitmap( (const wxBitmap &)icon ) ; }
@@ -61,7 +61,7 @@ class WXDLLEXPORT wxStaticBitmap: public wxStaticBitmapBase
protected:
wxBitmap m_bitmap;
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
};
#endif

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_STATBOX_H_

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_STATTEXT_H_
@@ -53,7 +53,7 @@ class WXDLLEXPORT wxStaticText: public wxStaticTextBase
virtual wxSize DoGetBestSize() const ;
virtual bool AcceptsFocus() const { return FALSE; }
private :
wxString m_label ;
wxString m_label ;
DECLARE_EVENT_TABLE()
};

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_TABCTRL_H_

View File

@@ -1,13 +1,13 @@
/////////////////////////////////////////////////////////////////////////
// File: taskbar.h
// Purpose: Defines wxTaskBarIcon class for manipulating icons on the
// Purpose: Defines wxTaskBarIcon class for manipulating icons on the
// task bar. Optional.
// Author: Stefan Csomor
// Modified by:
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c)
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////
#ifndef _WX_TASKBAR_H_
@@ -23,8 +23,8 @@
class wxTaskBarIcon: public wxObject
{
public:
wxTaskBarIcon();
virtual ~wxTaskBarIcon();
wxTaskBarIcon();
virtual ~wxTaskBarIcon();
// Accessors

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_TEXTCTRL_H_
@@ -151,11 +151,11 @@ public:
void OnUpdateUndo(wxUpdateUIEvent& event);
void OnUpdateRedo(wxUpdateUIEvent& event);
virtual bool MacCanFocus() const { return true ; }
virtual bool MacCanFocus() const { return true ; }
virtual bool MacSetupCursor( const wxPoint& pt ) ;
virtual void MacSuperShown( bool show ) ;
virtual bool Show(bool show = TRUE) ;
virtual void MacSuperShown( bool show ) ;
virtual bool Show(bool show = TRUE) ;
protected:
virtual wxSize DoGetBestSize() const;

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_TIMER_H_
@@ -26,8 +26,8 @@ struct MacTimerInfo ;
class WXDLLEXPORT wxTimer: public wxTimerBase
{
public:
wxTimer() { Init(); }
wxTimer(wxEvtHandler *owner, int id = -1) : wxTimerBase(owner, id) { Init(); }
wxTimer() { Init(); }
wxTimer(wxEvtHandler *owner, int id = -1) : wxTimerBase(owner, id) { Init(); }
~wxTimer();
virtual bool Start(int milliseconds = -1,
@@ -38,7 +38,7 @@ public:
MacTimerInfo* m_info;
protected :
void Init();
void Init();
private:
DECLARE_ABSTRACT_CLASS(wxTimer)

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_TOOLBAR_H_
@@ -61,11 +61,11 @@ class WXDLLEXPORT wxToolBar: public wxToolBarBase
// Add all the buttons
virtual void MacHandleControlClick( WXWidget control , short controlpart ) ;
virtual wxString MacGetToolTipString( wxPoint &where ) ;
void OnPaint(wxPaintEvent& event) ;
void OnMouse(wxMouseEvent& event) ;
virtual void MacSuperChangedPosition() ;
virtual void MacHandleControlClick( WXWidget control , short controlpart ) ;
virtual wxString MacGetToolTipString( wxPoint &where ) ;
void OnPaint(wxPaintEvent& event) ;
void OnMouse(wxMouseEvent& event) ;
virtual void MacSuperChangedPosition() ;
protected:
// common part of all ctors
void Init();
@@ -88,9 +88,9 @@ protected:
const wxString& longHelp);
virtual wxToolBarToolBase *CreateTool(wxControl *control);
wxArrayPtrVoid m_macToolHandles ;
wxArrayPtrVoid m_macToolHandles ;
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
};
#endif // wxUSE_TOOLBAR

View File

@@ -93,7 +93,7 @@ public:
short MacGetWindowBackgroundTheme() const { return m_macWindowBackgroundTheme ; }
#if TARGET_CARBON
WXEVENTHANDLERREF MacGetEventHandler() { return m_macEventHandler ; }
WXEVENTHANDLERREF MacGetEventHandler() { return m_macEventHandler ; }
#endif
protected:
// common part of all ctors
@@ -116,7 +116,7 @@ protected:
static WXWindow s_macWindowInUpdate ;
private :
#if TARGET_CARBON
WXEVENTHANDLERREF m_macEventHandler ;
WXEVENTHANDLERREF m_macEventHandler ;
#endif
};

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_TREECTRL_H_

View File

@@ -6,7 +6,7 @@
// Created: 03/02/99
// RCS-ID: $Id:
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef H_UMA
@@ -31,59 +31,59 @@ bool UMAGetProcessModeDoesActivateOnFGSwitch() ;
// menu manager
MenuRef UMANewMenu( SInt16 id , const wxString& title ) ;
void UMASetMenuTitle( MenuRef menu , const wxString& title ) ;
UInt32 UMAMenuEvent( EventRecord *inEvent ) ;
void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex item , bool enable ) ;
MenuRef UMANewMenu( SInt16 id , const wxString& title ) ;
void UMASetMenuTitle( MenuRef menu , const wxString& title ) ;
UInt32 UMAMenuEvent( EventRecord *inEvent ) ;
void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex item , bool enable ) ;
void UMAAppendSubMenuItem( MenuRef menu , const wxString& title , SInt16 submenuid ) ;
void UMAInsertSubMenuItem( MenuRef menu , const wxString& title , MenuItemIndex item , SInt16 submenuid ) ;
void UMAAppendMenuItem( MenuRef menu , const wxString& title , wxAcceleratorEntry *entry = NULL ) ;
void UMAInsertMenuItem( MenuRef menu , const wxString& title , MenuItemIndex item , wxAcceleratorEntry *entry = NULL ) ;
void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , wxAcceleratorEntry *entry ) ;
void UMAAppendSubMenuItem( MenuRef menu , const wxString& title , SInt16 submenuid ) ;
void UMAInsertSubMenuItem( MenuRef menu , const wxString& title , MenuItemIndex item , SInt16 submenuid ) ;
void UMAAppendMenuItem( MenuRef menu , const wxString& title , wxAcceleratorEntry *entry = NULL ) ;
void UMAInsertMenuItem( MenuRef menu , const wxString& title , MenuItemIndex item , wxAcceleratorEntry *entry = NULL ) ;
void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , wxAcceleratorEntry *entry ) ;
void UMASetMenuItemText( MenuRef menu, MenuItemIndex item, const wxString& title ) ;
void UMASetMenuItemText( MenuRef menu, MenuItemIndex item, const wxString& title ) ;
// quickdraw
void UMAShowWatchCursor() ;
void UMAShowArrowCursor() ;
void UMAShowWatchCursor() ;
void UMAShowArrowCursor() ;
OSStatus UMAPrOpen(void *macPrintSession) ;
OSStatus UMAPrClose(void *macPrintSession) ;
OSStatus UMAPrOpen(void *macPrintSession) ;
OSStatus UMAPrClose(void *macPrintSession) ;
// window manager
GrafPtr UMAGetWindowPort( WindowRef inWindowRef ) ;
void UMADisposeWindow( WindowRef inWindowRef ) ;
void UMASetWTitleC( WindowRef inWindowRef , const char *title ) ;
void UMAGetWTitleC( WindowRef inWindowRef , char *title ) ;
GrafPtr UMAGetWindowPort( WindowRef inWindowRef ) ;
void UMADisposeWindow( WindowRef inWindowRef ) ;
void UMASetWTitleC( WindowRef inWindowRef , const char *title ) ;
void UMAGetWTitleC( WindowRef inWindowRef , char *title ) ;
void UMADrawGrowIcon( WindowRef inWindowRef ) ;
void UMAShowHide( WindowRef inWindowRef , Boolean show) ;
void UMADrawGrowIcon( WindowRef inWindowRef ) ;
void UMAShowHide( WindowRef inWindowRef , Boolean show) ;
// appearance manager
void UMADrawControl( ControlHandle inControl ) ;
void UMADrawControl( ControlHandle inControl ) ;
void UMAEnableControl( ControlHandle inControl ) ;
void UMADisableControl( ControlHandle inControl ) ;
void UMAActivateControl( ControlHandle inControl ) ;
void UMADeactivateControl( ControlHandle inControl ) ;
// ControlPartCode hiliteState) ;
void UMAShowControl (ControlHandle theControl) ;
void UMAHideControl (ControlHandle theControl);
void UMAActivateControl (ControlHandle inControl);
void UMADeactivateControl (ControlHandle inControl);
void UMAEnableControl( ControlHandle inControl ) ;
void UMADisableControl( ControlHandle inControl ) ;
void UMAActivateControl( ControlHandle inControl ) ;
void UMADeactivateControl( ControlHandle inControl ) ;
// ControlPartCode hiliteState) ;
void UMAShowControl (ControlHandle theControl) ;
void UMAHideControl (ControlHandle theControl);
void UMAActivateControl (ControlHandle inControl);
void UMADeactivateControl (ControlHandle inControl);
void UMAMoveControl( ControlHandle inControl , short x , short y ) ;
void UMASizeControl( ControlHandle inControl , short x , short y ) ;
// control hierarchy
// keyboard focus
OSErr UMASetKeyboardFocus (WindowPtr inWindow,
ControlHandle inControl,
ControlFocusPart inPart) ;
OSErr UMASetKeyboardFocus (WindowPtr inWindow,
ControlHandle inControl,
ControlFocusPart inPart) ;
// events
@@ -91,8 +91,8 @@ void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn ) ;
OSErr UMAGetRootControl( WindowPtr inWindow , ControlHandle *outControl ) ;
// handling control data
bool UMAIsWindowFloating( WindowRef inWindow ) ;
bool UMAIsWindowModal( WindowRef inWindow ) ;
bool UMAIsWindowFloating( WindowRef inWindow ) ;
bool UMAIsWindowModal( WindowRef inWindow ) ;
void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate ) ;

View File

@@ -7,7 +7,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_WAVE_H_

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_WINDOW_H_
@@ -38,7 +38,7 @@ class WXDLLEXPORT wxWindowMac: public wxWindowBase
friend class wxPaintDC;
public:
wxWindowMac()
: m_macBackgroundBrush()
, m_macVisibleRegion()
@@ -155,7 +155,7 @@ public:
void MacRootWindowToClient( int *x , int *y ) const ;
void MacWindowToRootWindow( int *x , int *y ) const ;
void MacRootWindowToWindow( int *x , int *y ) const ;
virtual wxString MacGetToolTipString( wxPoint &where ) ;
// simple accessors
@@ -163,7 +163,7 @@ public:
// WXHWND GetHWND() const { return m_hWnd; }
// void SetHWND(WXHWND hWnd) { m_hWnd = hWnd; }
virtual WXWidget GetHandle() const { return (WXWidget) NULL ; }
virtual WXWidget GetHandle() const { return (WXWidget) NULL ; }
bool GetUseCtl3D() const { return m_useCtl3D; }
bool GetTransparentBackground() const { return m_backgroundTransparent; }
@@ -171,7 +171,7 @@ public:
// event handlers
// --------------
void OnSetFocus(wxFocusEvent& event) ;
void OnSetFocus(wxFocusEvent& event) ;
void OnNcPaint(wxNcPaintEvent& event);
void OnEraseBackground(wxEraseEvent& event);
void OnIdle(wxIdleEvent& event);
@@ -233,7 +233,7 @@ public:
static long MacRemoveBordersFromStyle( long style ) ;
virtual void MacSuperChangedPosition() ;
// the absolute coordinates of this item within the toplevel window may have changed
virtual void MacUpdateDimensions() {}
virtual void MacUpdateDimensions() {}
// the absolute coortinates of this window's root have changed
virtual void MacTopLevelWindowChangedPosition() ;
virtual void MacSuperShown( bool show ) ;

View File

@@ -289,21 +289,21 @@ void wxApp::MacNewFile()
#if TARGET_CARBON
static const EventTypeSpec eventList[] =
{
{ kEventClassCommand, kEventProcessCommand } ,
{ kEventClassCommand, kEventCommandUpdateStatus } ,
{ kEventClassApplication , kEventAppActivated } ,
{ kEventClassApplication , kEventAppDeactivated } ,
// handling the quit event is not recommended by apple
// rather using the quit apple event - which we do
{ kEventClassAppleEvent , kEventAppleEvent } ,
{ kEventClassMouse , kEventMouseDown } ,
{ 'WXMC' , 'WXMC' }
} ;
static const EventTypeSpec eventList[] =
{
{ kEventClassCommand, kEventProcessCommand } ,
{ kEventClassCommand, kEventCommandUpdateStatus } ,
{ kEventClassApplication , kEventAppActivated } ,
{ kEventClassApplication , kEventAppDeactivated } ,
// handling the quit event is not recommended by apple
// rather using the quit apple event - which we do
{ kEventClassAppleEvent , kEventAppleEvent } ,
{ kEventClassMouse , kEventMouseDown } ,
{ 'WXMC' , 'WXMC' }
} ;
static pascal OSStatus MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
{
@@ -323,23 +323,23 @@ static pascal OSStatus MouseEventHandler( EventHandlerCallRef handler , EventRef
switch( GetEventKind(event) )
{
case kEventMouseDown :
{
Point point ;
WindowRef window ;
GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL,
sizeof( Point ), NULL, &point );
short windowPart = ::FindWindow(point, &window);
case kEventMouseDown :
{
Point point ;
WindowRef window ;
GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL,
sizeof( Point ), NULL, &point );
short windowPart = ::FindWindow(point, &window);
if ( windowPart == inMenuBar )
{
MenuSelect( point ) ;
result = noErr ;
}
}
break ;
}
if ( windowPart == inMenuBar )
{
MenuSelect( point ) ;
result = noErr ;
}
}
break ;
}
return result ;
}
@@ -348,15 +348,15 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR
{
OSStatus result = eventNotHandledErr ;
HICommand command ;
GetEventParameter( event, kEventParamDirectObject, typeHICommand, NULL,
sizeof( HICommand ), NULL, &command );
HICommand command ;
GetEventParameter( event, kEventParamDirectObject, typeHICommand, NULL,
sizeof( HICommand ), NULL, &command );
MenuCommand id = command.commandID ;
if ( id == kHICommandPreferences )
id = wxApp::s_macPreferencesMenuItemId ;
MenuCommand id = command.commandID ;
if ( id == kHICommandPreferences )
id = wxApp::s_macPreferencesMenuItemId ;
wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar() ;
wxMenu* menu = NULL ;
wxMenuItem* item = NULL ;
@@ -365,28 +365,28 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR
item = mbar->FindItem( id , &menu ) ;
if ( item == NULL || menu == NULL || mbar == NULL )
return result ;
switch( GetEventKind( event ) )
{
case kEventProcessCommand :
{
if (item->IsCheckable())
{
item->Check( !item->IsChecked() ) ;
}
menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
result = noErr ;
}
break ;
case kEventCommandUpdateStatus:
// eventually trigger an updateui round
result = noErr ;
break ;
default :
break ;
}
return result ;
switch( GetEventKind( event ) )
{
case kEventProcessCommand :
{
if (item->IsCheckable())
{
item->Check( !item->IsChecked() ) ;
}
menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
result = noErr ;
}
break ;
case kEventCommandUpdateStatus:
// eventually trigger an updateui round
result = noErr ;
break ;
default :
break ;
}
return result ;
}
@@ -394,23 +394,23 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR
static pascal OSStatus ApplicationEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
{
OSStatus result = eventNotHandledErr ;
switch ( GetEventKind( event ) )
{
case kEventAppActivated :
{
wxTheApp->MacResume( true ) ;
result = noErr ;
}
break ;
case kEventAppDeactivated :
{
wxTheApp->MacSuspend( true ) ;
result = noErr ;
}
break ;
default :
break ;
}
switch ( GetEventKind( event ) )
{
case kEventAppActivated :
{
wxTheApp->MacResume( true ) ;
result = noErr ;
}
break ;
case kEventAppDeactivated :
{
wxTheApp->MacSuspend( true ) ;
result = noErr ;
}
break ;
default :
break ;
}
return result ;
}
@@ -419,27 +419,27 @@ pascal OSStatus wxAppEventHandler( EventHandlerCallRef handler , EventRef event
OSStatus result = eventNotHandledErr ;
switch( GetEventClass( event ) )
{
case kEventClassCommand :
result = CommandEventHandler( handler , event , data ) ;
break ;
case kEventClassApplication :
result = ApplicationEventHandler( handler , event , data ) ;
break ;
case kEventClassMenu :
result = MenuEventHandler( handler , event , data ) ;
break ;
case kEventClassMouse :
result = MouseEventHandler( handler , event , data ) ;
break ;
case kEventClassAppleEvent :
{
EventRecord rec ;
wxMacConvertEventToRecord( event , &rec ) ;
result = AEProcessAppleEvent( &rec ) ;
}
break ;
default :
break ;
case kEventClassCommand :
result = CommandEventHandler( handler , event , data ) ;
break ;
case kEventClassApplication :
result = ApplicationEventHandler( handler , event , data ) ;
break ;
case kEventClassMenu :
result = MenuEventHandler( handler , event , data ) ;
break ;
case kEventClassMouse :
result = MouseEventHandler( handler , event , data ) ;
break ;
case kEventClassAppleEvent :
{
EventRecord rec ;
wxMacConvertEventToRecord( event , &rec ) ;
result = AEProcessAppleEvent( &rec ) ;
}
break ;
default :
break ;
}
return result ;
@@ -532,7 +532,7 @@ bool wxApp::Initialize()
#ifndef __DARWIN__
// now avoid exceptions thrown for new (bad_alloc)
// FIXME CS for some changes outside wxMac does not compile anymore
// FIXME CS for some changes outside wxMac does not compile anymore
#if 0
std::__throws_bad_alloc = 0 ;
#endif
@@ -593,17 +593,17 @@ bool wxApp::Initialize()
bool wxApp::OnInitGui()
{
if( !wxAppBase::OnInitGui() )
return false ;
#if TARGET_CARBON
InstallStandardEventHandler( GetApplicationEventTarget() ) ;
InstallApplicationEventHandler(
GetwxAppEventHandlerUPP(),
GetEventTypeCount(eventList), eventList, wxTheApp, &((EventHandlerRef)wxTheApp->m_macEventHandler));
if( !wxAppBase::OnInitGui() )
return false ;
#if TARGET_CARBON
InstallStandardEventHandler( GetApplicationEventTarget() ) ;
InstallApplicationEventHandler(
GetwxAppEventHandlerUPP(),
GetEventTypeCount(eventList), eventList, wxTheApp, &((EventHandlerRef)wxTheApp->m_macEventHandler));
#endif
#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
AEInstallEventHandler( kCoreEventClass , kAEOpenDocuments ,
NewAEEventHandlerUPP(AEHandleODoc) ,
@@ -632,7 +632,7 @@ bool wxApp::OnInitGui()
0 , FALSE ) ;
#endif
return TRUE ;
return TRUE ;
}
void wxApp::CleanUp()
@@ -879,7 +879,7 @@ void wxStAppResource::CloseSharedLibraryResource()
// the __wxinitialize and __wxterminate must be used
extern "C" {
void __sinit(void); /* (generated by linker) */
void __sinit(void); /* (generated by linker) */
pascal OSErr __initialize(const CFragInitBlock *theInitBlock);
pascal void __terminate(void);
}
@@ -1149,14 +1149,14 @@ bool wxApp::Initialized()
int wxApp::MainLoop()
{
m_keepGoing = TRUE;
m_keepGoing = TRUE;
while (m_keepGoing)
{
MacDoOneEvent() ;
}
while (m_keepGoing)
{
MacDoOneEvent() ;
}
return 0;
return 0;
}
// Returns TRUE if more time is needed.
@@ -1171,18 +1171,18 @@ bool wxApp::ProcessIdle()
void wxApp::ExitMainLoop()
{
m_keepGoing = FALSE;
m_keepGoing = FALSE;
}
// Is a message/event pending?
bool wxApp::Pending()
{
#if TARGET_CARBON
return GetNumEventsInQueue( GetMainEventQueue() ) > 0 ;
return GetNumEventsInQueue( GetMainEventQueue() ) > 0 ;
#else
EventRecord event ;
return EventAvail( everyEvent , &event ) ;
return EventAvail( everyEvent , &event ) ;
#endif
}
@@ -1336,39 +1336,39 @@ bool wxApp::Yield(bool onlyIfNeeded)
#if wxUSE_THREADS
YieldToAnyThread() ;
#endif
// by definition yield should handle all non-processed events
// by definition yield should handle all non-processed events
#if TARGET_CARBON
EventRef theEvent;
EventRef theEvent;
OSStatus status = noErr ;
do
{
s_inReceiveEvent = true ;
status = ReceiveNextEvent(0, NULL,kEventDurationNoWait,true,&theEvent) ;
s_inReceiveEvent = false ;
if ( status == eventLoopTimedOutErr )
{
// make sure next time the event loop will trigger idle events
sleepTime = kEventDurationNoWait ;
}
else if ( status == eventLoopQuitErr )
{
// according to QA1061 this may also occur when a WakeUp Process
// is executed
}
else
{
MacHandleOneEvent( theEvent ) ;
ReleaseEvent(theEvent);
}
} while( status == noErr ) ;
OSStatus status = noErr ;
do
{
s_inReceiveEvent = true ;
status = ReceiveNextEvent(0, NULL,kEventDurationNoWait,true,&theEvent) ;
s_inReceiveEvent = false ;
if ( status == eventLoopTimedOutErr )
{
// make sure next time the event loop will trigger idle events
sleepTime = kEventDurationNoWait ;
}
else if ( status == eventLoopQuitErr )
{
// according to QA1061 this may also occur when a WakeUp Process
// is executed
}
else
{
MacHandleOneEvent( theEvent ) ;
ReleaseEvent(theEvent);
}
} while( status == noErr ) ;
#else
EventRecord event ;
// having a larger value here leads to large performance slowdowns
// so we cannot give background apps more processor time here
// we do so however having a large sleep value in the main event loop
// having a larger value here leads to large performance slowdowns
// so we cannot give background apps more processor time here
// we do so however having a large sleep value in the main event loop
sleepTime = 0 ;
while ( !IsExiting() && WaitNextEvent(everyEvent, &event,sleepTime, (RgnHandle) wxApp::s_macCursorRgn))
@@ -1449,32 +1449,32 @@ void wxApp::MacConvertPublicToPrivateScrap()
void wxApp::MacDoOneEvent()
{
#if TARGET_CARBON
EventRef theEvent;
EventRef theEvent;
s_inReceiveEvent = true ;
OSStatus status = ReceiveNextEvent(0, NULL,sleepTime,true,&theEvent) ;
s_inReceiveEvent = false ;
if ( status == eventLoopTimedOutErr )
{
s_inReceiveEvent = true ;
OSStatus status = ReceiveNextEvent(0, NULL,sleepTime,true,&theEvent) ;
s_inReceiveEvent = false ;
if ( status == eventLoopTimedOutErr )
{
if ( wxTheApp->ProcessIdle() )
sleepTime = kEventDurationNoWait ;
sleepTime = kEventDurationNoWait ;
else
sleepTime = kEventDurationForever ;
}
else if ( status == eventLoopQuitErr )
{
// according to QA1061 this may also occur when a WakeUp Process
// is executed
}
else
{
MacHandleOneEvent( theEvent ) ;
ReleaseEvent(theEvent);
}
sleepTime = kEventDurationForever ;
}
else if ( status == eventLoopQuitErr )
{
// according to QA1061 this may also occur when a WakeUp Process
// is executed
}
else
{
MacHandleOneEvent( theEvent ) ;
ReleaseEvent(theEvent);
}
#else
EventRecord event ;
EventRecord event ;
EventMask eventMask = everyEvent ;
EventMask eventMask = everyEvent ;
if (WaitNextEvent(eventMask, &event, sleepTime, (RgnHandle) s_macCursorRgn))
{
@@ -1490,9 +1490,9 @@ void wxApp::MacDoOneEvent()
::IdleControls( window ) ;
if ( wxTheApp->ProcessIdle() )
sleepTime = 0 ;
sleepTime = 0 ;
else
sleepTime = GetCaretTime() / 2 ;
sleepTime = GetCaretTime() / 2 ;
}
if ( event.what != kHighLevelEvent )
SetRectRgn( (RgnHandle) s_macCursorRgn , event.where.h , event.where.v , event.where.h + 1 , event.where.v + 1 ) ;
@@ -1506,10 +1506,10 @@ void wxApp::MacDoOneEvent()
void wxApp::MacHandleOneEvent( WXEVENTREF evr )
{
#if TARGET_CARBON
EventTargetRef theTarget;
theTarget = GetEventDispatcherTarget();
EventTargetRef theTarget;
theTarget = GetEventDispatcherTarget();
m_macCurrentEvent = evr ;
SendEventToEventTarget ((EventRef) evr , theTarget);
SendEventToEventTarget ((EventRef) evr , theTarget);
#else
EventRecord* ev = (EventRecord*) evr ;
m_macCurrentEvent = ev ;
@@ -1784,15 +1784,15 @@ void wxApp::MacHandleMouseUpEvent( WXEVENTREF evr )
WindowRef window;
short windowPart = inNoWindow ;
if ( wxTheApp->s_captureWindow )
{
window = (WindowRef) s_captureWindow->MacGetRootWindow() ;
windowPart = inContent ;
}
else
{
windowPart = ::FindWindow(ev->where, &window) ;
}
if ( wxTheApp->s_captureWindow )
{
window = (WindowRef) s_captureWindow->MacGetRootWindow() ;
windowPart = inContent ;
}
else
{
windowPart = ::FindWindow(ev->where, &window) ;
}
switch (windowPart)
{
@@ -1990,14 +1990,14 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi
keycode = short(keyInfo & keyCodeMask) >> 8 ;
}
long keyval = wxMacTranslateKey(keychar, keycode) ;
long realkeyval = keyval ;
if ( keyval == keychar )
{
// we are not on a special character combo -> pass the real os event-value to EVT_CHAR, but not to EVT_KEY (make upper first)
realkeyval = short(keymessage & charCodeMask) ;
keyval = wxToupper( keyval ) ;
}
long realkeyval = keyval ;
if ( keyval == keychar )
{
// we are not on a special character combo -> pass the real os event-value to EVT_CHAR, but not to EVT_KEY (make upper first)
realkeyval = short(keymessage & charCodeMask) ;
keyval = wxToupper( keyval ) ;
}
wxKeyEvent event(wxEVT_KEY_DOWN);
bool handled = false ;
event.m_shiftDown = modifiers & shiftKey;
@@ -2120,10 +2120,10 @@ bool wxApp::MacSendKeyUpEvent( wxWindow* focus , long keymessage , long modifier
}
long keyval = wxMacTranslateKey(keychar, keycode) ;
if ( keyval == keychar )
{
keyval = wxToupper( keyval ) ;
}
if ( keyval == keychar )
{
keyval = wxToupper( keyval ) ;
}
bool handled = false ;
wxKeyEvent event(wxEVT_KEY_UP);
@@ -2248,15 +2248,15 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
wxWindow* currentMouseWindow = NULL ;
if (s_captureWindow )
{
currentMouseWindow = s_captureWindow ;
}
else
{
wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
&currentMouseWindow ) ;
}
if (s_captureWindow )
{
currentMouseWindow = s_captureWindow ;
}
else
{
wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
&currentMouseWindow ) ;
}
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
{
@@ -2299,16 +2299,16 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
short windowPart = inNoWindow ;
if ( s_captureWindow )
{
window = (WindowRef) s_captureWindow->MacGetRootWindow() ;
windowPart = inContent ;
}
else
{
windowPart = ::FindWindow(ev->where, &window);
}
if ( s_captureWindow )
{
window = (WindowRef) s_captureWindow->MacGetRootWindow() ;
windowPart = inContent ;
}
else
{
windowPart = ::FindWindow(ev->where, &window);
}
switch (windowPart)
{
case inContent :
@@ -2358,8 +2358,8 @@ void wxApp::MacHandleMenuCommand( wxUint32 id )
{
item->Check( !item->IsChecked() ) ;
}
menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
}
#if !TARGET_CARBON
@@ -2384,7 +2384,7 @@ void wxApp::MacHandleMenuSelect( int macMenuId , int macMenuItemNum )
{
MenuCommand id ;
GetMenuItemCommandID( GetMenuHandle(macMenuId) , macMenuItemNum , &id ) ;
MacHandleMenuCommand( id ) ;
MacHandleMenuCommand( id ) ;
}
HiliteMenu(0);
}

View File

@@ -218,8 +218,8 @@ CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth ,
if ( mask )
{
Rect r ;
GetPortBounds( image , &r ) ;
Rect r ;
GetPortBounds( image , &r ) ;
LockPixels(GetGWorldPixMap(mask) ) ;
CopyBits(GetPortBitMapForCopyBits(mask) ,
&(**icon).iconBMap , &r , &r, srcCopy , nil ) ;
@@ -229,8 +229,8 @@ CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth ,
}
else
{
Rect r ;
GetPortBounds( image , &r ) ;
Rect r ;
GetPortBounds( image , &r ) ;
LockPixels(GetGWorldPixMap(image));
CopyBits(GetPortBitMapForCopyBits(image) ,
&(**icon).iconBMap , &r , &r, srcCopy , nil ) ;
@@ -275,7 +275,7 @@ PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask)
if ( clipRgn )
GetRegionBounds( clipRgn , &portRect ) ;
else
GetPortBounds( wp , &portRect ) ;
GetPortBounds( wp , &portRect ) ;
pict = OpenPicture(&portRect);
if(pict)
{
@@ -283,7 +283,7 @@ PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask)
RGBBackColor( &white ) ;
if ( clipRgn )
SetClip( clipRgn ) ;
SetClip( clipRgn ) ;
LockPixels( GetGWorldPixMap( wp ) ) ;
CopyBits(GetPortBitMapForCopyBits(wp),
@@ -296,7 +296,7 @@ PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask)
}
SetGWorld( origPort , origDev ) ;
if ( clipRgn )
DisposeRgn( clipRgn ) ;
DisposeRgn( clipRgn ) ;
return pict;
}
@@ -335,19 +335,19 @@ void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bi
info->contentType = kControlContentPictHandle ;
if ( bitmap.GetMask() )
{
info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , MAC_WXHBITMAP(bitmap.GetMask()->GetMaskBitmap() ) ) ;
info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , MAC_WXHBITMAP(bitmap.GetMask()->GetMaskBitmap() ) ) ;
}
else
{
info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , NULL ) ;
info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , NULL ) ;
}
}
}
else if ( bmap->m_bitmapType == kMacBitmapTypeIcon )
{
info->contentType = kControlContentCIconHandle ;
info->u.cIconHandle = MAC_WXHICON(bmap->m_hIcon) ;
}
else if ( bmap->m_bitmapType == kMacBitmapTypeIcon )
{
info->contentType = kControlContentCIconHandle ;
info->u.cIconHandle = MAC_WXHICON(bmap->m_hIcon) ;
}
}
}
@@ -369,46 +369,46 @@ wxBitmapRefData::wxBitmapRefData()
// TODO move this to a public function of Bitmap Ref
static void DisposeBitmapRefData(wxBitmapRefData *data)
{
if ( !data )
return ;
switch (data->m_bitmapType)
{
case kMacBitmapTypePict :
{
if ( data->m_hPict )
{
KillPicture( MAC_WXHMETAFILE( data->m_hPict ) ) ;
data->m_hPict = NULL ;
}
}
break ;
case kMacBitmapTypeGrafWorld :
{
if ( data->m_hBitmap )
{
wxMacDestroyGWorld( MAC_WXHBITMAP(data->m_hBitmap) ) ;
data->m_hBitmap = NULL ;
}
}
break ;
case kMacBitmapTypeIcon :
if ( data->m_hIcon )
{
DisposeCIcon( MAC_WXHICON(data->m_hIcon) ) ;
data->m_hIcon = NULL ;
}
default :
// unkown type ?
break ;
}
if ( !data )
return ;
switch (data->m_bitmapType)
{
case kMacBitmapTypePict :
{
if ( data->m_hPict )
{
KillPicture( MAC_WXHMETAFILE( data->m_hPict ) ) ;
data->m_hPict = NULL ;
}
}
break ;
case kMacBitmapTypeGrafWorld :
{
if ( data->m_hBitmap )
{
wxMacDestroyGWorld( MAC_WXHBITMAP(data->m_hBitmap) ) ;
data->m_hBitmap = NULL ;
}
}
break ;
case kMacBitmapTypeIcon :
if ( data->m_hIcon )
{
DisposeCIcon( MAC_WXHICON(data->m_hIcon) ) ;
data->m_hIcon = NULL ;
}
default :
// unkown type ?
break ;
}
if (data->m_bitmapMask)
{
delete data->m_bitmapMask;
data->m_bitmapMask = NULL;
}
if (data->m_bitmapMask)
{
delete data->m_bitmapMask;
data->m_bitmapMask = NULL;
}
}
wxBitmapRefData::~wxBitmapRefData()
@@ -642,8 +642,8 @@ void wxBitmap::SetHBITMAP(WXHBITMAP bmp)
{
if (!M_BITMAPDATA)
m_refData = new wxBitmapRefData;
else
DisposeBitmapRefData( M_BITMAPDATA ) ;
else
DisposeBitmapRefData( M_BITMAPDATA ) ;
M_BITMAPDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
M_BITMAPDATA->m_hBitmap = bmp ;
@@ -654,8 +654,8 @@ void wxBitmap::SetHICON(WXHICON ico)
{
if (!M_BITMAPDATA)
m_refData = new wxBitmapRefData;
else
DisposeBitmapRefData( M_BITMAPDATA ) ;
else
DisposeBitmapRefData( M_BITMAPDATA ) ;
M_BITMAPDATA->m_bitmapType = kMacBitmapTypeIcon ;
M_BITMAPDATA->m_hIcon = ico ;
@@ -666,8 +666,8 @@ void wxBitmap::SetPict(WXHMETAFILE pict)
{
if (!M_BITMAPDATA)
m_refData = new wxBitmapRefData;
else
DisposeBitmapRefData( M_BITMAPDATA ) ;
else
DisposeBitmapRefData( M_BITMAPDATA ) ;
M_BITMAPDATA->m_bitmapType = kMacBitmapTypePict ;
M_BITMAPDATA->m_hPict = pict ;
@@ -820,26 +820,26 @@ wxImage wxBitmap::ConvertToImage() const
GetGWorld( &origPort, &origDevice );
if ( GetBitmapType() != kMacBitmapTypeGrafWorld )
{
tempPort = wxMacCreateGWorld( width , height , -1) ;
tempPort = wxMacCreateGWorld( width , height , -1) ;
}
else
{
tempPort = (GWorldPtr) GetHBITMAP() ;
}
LockPixels(GetGWorldPixMap(tempPort));
SetGWorld( tempPort, NULL);
if ( GetBitmapType() == kMacBitmapTypePict || GetBitmapType() == kMacBitmapTypeIcon )
{
tempPort = (GWorldPtr) GetHBITMAP() ;
}
LockPixels(GetGWorldPixMap(tempPort));
SetGWorld( tempPort, NULL);
if ( GetBitmapType() == kMacBitmapTypePict || GetBitmapType() == kMacBitmapTypeIcon )
{
Rect bitmaprect = { 0 , 0 , height, width };
if ( GetBitmapType() == kMacBitmapTypeIcon )
{
::PlotCIconHandle( &bitmaprect , atNone , ttNone , MAC_WXHICON(GetHICON()) ) ;
maskRgn = NewRgn() ;
BitMapToRegion( maskRgn , &(**(MAC_WXHICON(GetHICON()))).iconMask ) ;
if ( GetBitmapType() == kMacBitmapTypeIcon )
{
::PlotCIconHandle( &bitmaprect , atNone , ttNone , MAC_WXHICON(GetHICON()) ) ;
maskRgn = NewRgn() ;
BitMapToRegion( maskRgn , &(**(MAC_WXHICON(GetHICON()))).iconMask ) ;
}
else
::DrawPicture( (PicHandle) GetPict(), &bitmaprect ) ;
}
else
::DrawPicture( (PicHandle) GetPict(), &bitmaprect ) ;
}
// Copy data into image
index = 0;
for (int yy = 0; yy < height; yy++)
@@ -854,28 +854,28 @@ wxImage wxBitmap::ConvertToImage() const
data[index + 1] = g;
data[index + 2] = b;
if ( maskRgn )
{
Point pt ;
pt.h = xx ;
pt.v = yy ;
if ( !PtInRgn( pt , maskRgn ) )
{
{
Point pt ;
pt.h = xx ;
pt.v = yy ;
if ( !PtInRgn( pt , maskRgn ) )
{
data[index ] = mask_r;
data[index + 1] = mask_g;
data[index + 2] = mask_b;
}
}
}
else
{
if (mask)
{
if (mask->PointMasked(xx,yy))
{
data[index ] = mask_r;
data[index + 1] = mask_g;
data[index + 2] = mask_b;
}
}
if (mask)
{
if (mask->PointMasked(xx,yy))
{
data[index ] = mask_r;
data[index + 1] = mask_g;
data[index + 2] = mask_b;
}
}
}
index += 3;
}
@@ -891,11 +891,11 @@ wxImage wxBitmap::ConvertToImage() const
SetGWorld(origPort, origDevice);
if ( GetBitmapType() != kMacBitmapTypeGrafWorld )
{
wxMacDestroyGWorld( tempPort ) ;
wxMacDestroyGWorld( tempPort ) ;
}
if ( maskRgn )
{
DisposeRgn( maskRgn ) ;
DisposeRgn( maskRgn ) ;
}
return image;
@@ -1038,33 +1038,33 @@ WXHBITMAP wxBitmap::GetHBITMAP() const
WXHMETAFILE wxBitmap::GetPict( bool *created ) const
{
wxCHECK_MSG( Ok(), NULL, wxT("invalid bitmap") );
wxCHECK_MSG( Ok(), NULL, wxT("invalid bitmap") );
PicHandle picture = NULL ; // This is the returned picture
if ( created )
(*created) = false ;
// If bitmap already in Pict format return pointer
if(M_BITMAPDATA->m_bitmapType == kMacBitmapTypePict) {
return M_BITMAPDATA->m_hPict;
}
else if(M_BITMAPDATA->m_bitmapType != kMacBitmapTypeGrafWorld) {
// Invalid bitmap
return NULL;
}
else
{
if ( GetMask() )
{
picture = wxMacCreatePict( MAC_WXHBITMAP(M_BITMAPDATA->m_hBitmap) , MAC_WXHBITMAP(GetMask()->GetMaskBitmap() ) ) ;
}
else
{
picture = wxMacCreatePict( MAC_WXHBITMAP(M_BITMAPDATA->m_hBitmap) , NULL ) ;
}
if ( created && picture )
(*created) = true ;
PicHandle picture = NULL ; // This is the returned picture
if ( created )
(*created) = false ;
// If bitmap already in Pict format return pointer
if(M_BITMAPDATA->m_bitmapType == kMacBitmapTypePict) {
return M_BITMAPDATA->m_hPict;
}
return picture ;
else if(M_BITMAPDATA->m_bitmapType != kMacBitmapTypeGrafWorld) {
// Invalid bitmap
return NULL;
}
else
{
if ( GetMask() )
{
picture = wxMacCreatePict( MAC_WXHBITMAP(M_BITMAPDATA->m_hBitmap) , MAC_WXHBITMAP(GetMask()->GetMaskBitmap() ) ) ;
}
else
{
picture = wxMacCreatePict( MAC_WXHBITMAP(M_BITMAPDATA->m_hBitmap) , NULL ) ;
}
if ( created && picture )
(*created) = true ;
}
return picture ;
}
/*

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -45,35 +45,35 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
m_windowId = id;
if ( width == -1 && bitmap.Ok())
width = bitmap.GetWidth() + 2*m_marginX;
width = bitmap.GetWidth() + 2*m_marginX;
if ( height == -1 && bitmap.Ok())
height = bitmap.GetHeight() + 2*m_marginY;
height = bitmap.GetHeight() + 2*m_marginY;
Rect bounds ;
Str255 title ;
Rect bounds ;
Str255 title ;
m_bmpNormal = bitmap;
wxBitmapRefData * bmap = NULL ;
if ( m_bmpNormal.Ok() )
bmap = (wxBitmapRefData*) ( m_bmpNormal.GetRefData()) ;
MacPreControlCreate( parent , id , "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
wxBitmapRefData * bmap = NULL ;
if ( m_bmpNormal.Ok() )
bmap = (wxBitmapRefData*) ( m_bmpNormal.GetRefData()) ;
MacPreControlCreate( parent , id , "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 ,
kControlBehaviorOffsetContents +
( bmap && bmap->m_bitmapType == kMacBitmapTypeIcon ?
kControlContentCIconHandle : kControlContentPictHandle ) , 0,
(( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ;
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
ControlButtonContentInfo info ;
wxMacCreateBitmapButton( &info , m_bmpNormal ) ;
if ( info.contentType != kControlNoContent )
{
::SetControlData( (ControlHandle) m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 ,
kControlBehaviorOffsetContents +
( bmap && bmap->m_bitmapType == kMacBitmapTypeIcon ?
kControlContentCIconHandle : kControlContentPictHandle ) , 0,
(( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ;
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
ControlButtonContentInfo info ;
wxMacCreateBitmapButton( &info , m_bmpNormal ) ;
if ( info.contentType != kControlNoContent )
{
::SetControlData( (ControlHandle) m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
}
MacPostControlCreate() ;
MacPostControlCreate() ;
return TRUE;
}

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -112,17 +112,17 @@ wxBrush::wxBrush(ThemeBrush macThemeBrush )
}
void wxBrush::Unshare()
{
// Don't change shared data
if (!m_refData)
// Don't change shared data
if (!m_refData)
{
m_refData = new wxBrushRefData();
}
m_refData = new wxBrushRefData();
}
else
{
wxBrushRefData* ref = new wxBrushRefData(*(wxBrushRefData*)m_refData);
UnRef();
m_refData = ref;
}
wxBrushRefData* ref = new wxBrushRefData(*(wxBrushRefData*)m_refData);
UnRef();
m_refData = ref;
}
}
void wxBrush::SetColour(const wxColour& col)
@@ -203,25 +203,27 @@ unsigned long wxBrush::GetMacThemeBackground( WXRECTPTR extent) const
}
}
short wxBrush::GetMacTheme() const
short wxBrush::GetMacTheme() const
{
return (M_BRUSHDATA ? ( M_BRUSHDATA->m_macBrushKind == kwxMacBrushTheme ? M_BRUSHDATA->m_macThemeBrush : kThemeBrushBlack) : kThemeBrushBlack);
};
return (M_BRUSHDATA ? ( M_BRUSHDATA->m_macBrushKind == kwxMacBrushTheme ? M_BRUSHDATA->m_macThemeBrush : kThemeBrushBlack) : kThemeBrushBlack);
}
wxColour& wxBrush::GetColour() const
{ return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour); };
{
return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour);
}
int wxBrush::GetStyle() const
{
return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0);
};
return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0);
}
wxBitmap *wxBrush::GetStipple() const
{
return (M_BRUSHDATA ? & M_BRUSHDATA->m_stipple : 0);
};
return (M_BRUSHDATA ? & M_BRUSHDATA->m_stipple : 0);
}
wxMacBrushKind wxBrush::MacGetBrushKind() const
{
return (M_BRUSHDATA ? M_BRUSHDATA->m_macBrushKind : kwxMacBrushColour);
};
return (M_BRUSHDATA ? M_BRUSHDATA->m_macBrushKind : kwxMacBrushColour);
}

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -34,23 +34,23 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
const wxValidator& validator,
const wxString& name)
{
Rect bounds ;
Str255 title ;
Rect bounds ;
Str255 title ;
if ( UMAHasAquaLayout() )
{
m_macHorizontalBorder = kMacOSXHorizontalBorder;
m_macVerticalBorder = kMacOSXVerticalBorder;
}
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
kControlPushButtonProc , (long) this ) ;
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
MacPostControlCreate() ;
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
kControlPushButtonProc , (long) this ) ;
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
MacPostControlCreate() ;
return TRUE;
}
@@ -65,19 +65,19 @@ void wxButton::SetDefault()
parent->SetDefaultItem(this);
}
Boolean inData;
if ( btnOldDefault && btnOldDefault->m_macControl )
{
inData = 0;
::SetControlData( (ControlHandle) btnOldDefault->m_macControl , kControlButtonPart ,
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
}
if ( (ControlHandle) m_macControl )
{
inData = 1;
::SetControlData( (ControlHandle) m_macControl , kControlButtonPart ,
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
}
Boolean inData;
if ( btnOldDefault && btnOldDefault->m_macControl )
{
inData = 0;
::SetControlData( (ControlHandle) btnOldDefault->m_macControl , kControlButtonPart ,
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
}
if ( (ControlHandle) m_macControl )
{
inData = 1;
::SetControlData( (ControlHandle) m_macControl , kControlButtonPart ,
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
}
}
wxSize wxButton::DoGetBestSize() const
@@ -85,7 +85,7 @@ wxSize wxButton::DoGetBestSize() const
wxSize sz = GetDefaultSize() ;
int wBtn = m_label.Length() * 8 + 12 + 2 * kMacOSXHorizontalBorder ;
if (wBtn > sz.x) sz.x = wBtn;
return sz ;
@@ -94,7 +94,7 @@ wxSize wxButton::DoGetBestSize() const
wxSize wxButton::GetDefaultSize()
{
int wBtn = 70 ;
int hBtn = 20 ;
int hBtn = 20 ;
if ( UMAHasAquaLayout() )
{

View File

@@ -289,21 +289,21 @@ void wxApp::MacNewFile()
#if TARGET_CARBON
static const EventTypeSpec eventList[] =
{
{ kEventClassCommand, kEventProcessCommand } ,
{ kEventClassCommand, kEventCommandUpdateStatus } ,
{ kEventClassApplication , kEventAppActivated } ,
{ kEventClassApplication , kEventAppDeactivated } ,
// handling the quit event is not recommended by apple
// rather using the quit apple event - which we do
{ kEventClassAppleEvent , kEventAppleEvent } ,
{ kEventClassMouse , kEventMouseDown } ,
{ 'WXMC' , 'WXMC' }
} ;
static const EventTypeSpec eventList[] =
{
{ kEventClassCommand, kEventProcessCommand } ,
{ kEventClassCommand, kEventCommandUpdateStatus } ,
{ kEventClassApplication , kEventAppActivated } ,
{ kEventClassApplication , kEventAppDeactivated } ,
// handling the quit event is not recommended by apple
// rather using the quit apple event - which we do
{ kEventClassAppleEvent , kEventAppleEvent } ,
{ kEventClassMouse , kEventMouseDown } ,
{ 'WXMC' , 'WXMC' }
} ;
static pascal OSStatus MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
{
@@ -323,23 +323,23 @@ static pascal OSStatus MouseEventHandler( EventHandlerCallRef handler , EventRef
switch( GetEventKind(event) )
{
case kEventMouseDown :
{
Point point ;
WindowRef window ;
GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL,
sizeof( Point ), NULL, &point );
short windowPart = ::FindWindow(point, &window);
case kEventMouseDown :
{
Point point ;
WindowRef window ;
GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL,
sizeof( Point ), NULL, &point );
short windowPart = ::FindWindow(point, &window);
if ( windowPart == inMenuBar )
{
MenuSelect( point ) ;
result = noErr ;
}
}
break ;
}
if ( windowPart == inMenuBar )
{
MenuSelect( point ) ;
result = noErr ;
}
}
break ;
}
return result ;
}
@@ -348,15 +348,15 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR
{
OSStatus result = eventNotHandledErr ;
HICommand command ;
GetEventParameter( event, kEventParamDirectObject, typeHICommand, NULL,
sizeof( HICommand ), NULL, &command );
HICommand command ;
GetEventParameter( event, kEventParamDirectObject, typeHICommand, NULL,
sizeof( HICommand ), NULL, &command );
MenuCommand id = command.commandID ;
if ( id == kHICommandPreferences )
id = wxApp::s_macPreferencesMenuItemId ;
MenuCommand id = command.commandID ;
if ( id == kHICommandPreferences )
id = wxApp::s_macPreferencesMenuItemId ;
wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar() ;
wxMenu* menu = NULL ;
wxMenuItem* item = NULL ;
@@ -365,28 +365,28 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR
item = mbar->FindItem( id , &menu ) ;
if ( item == NULL || menu == NULL || mbar == NULL )
return result ;
switch( GetEventKind( event ) )
{
case kEventProcessCommand :
{
if (item->IsCheckable())
{
item->Check( !item->IsChecked() ) ;
}
menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
result = noErr ;
}
break ;
case kEventCommandUpdateStatus:
// eventually trigger an updateui round
result = noErr ;
break ;
default :
break ;
}
return result ;
switch( GetEventKind( event ) )
{
case kEventProcessCommand :
{
if (item->IsCheckable())
{
item->Check( !item->IsChecked() ) ;
}
menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
result = noErr ;
}
break ;
case kEventCommandUpdateStatus:
// eventually trigger an updateui round
result = noErr ;
break ;
default :
break ;
}
return result ;
}
@@ -394,23 +394,23 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR
static pascal OSStatus ApplicationEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
{
OSStatus result = eventNotHandledErr ;
switch ( GetEventKind( event ) )
{
case kEventAppActivated :
{
wxTheApp->MacResume( true ) ;
result = noErr ;
}
break ;
case kEventAppDeactivated :
{
wxTheApp->MacSuspend( true ) ;
result = noErr ;
}
break ;
default :
break ;
}
switch ( GetEventKind( event ) )
{
case kEventAppActivated :
{
wxTheApp->MacResume( true ) ;
result = noErr ;
}
break ;
case kEventAppDeactivated :
{
wxTheApp->MacSuspend( true ) ;
result = noErr ;
}
break ;
default :
break ;
}
return result ;
}
@@ -419,27 +419,27 @@ pascal OSStatus wxAppEventHandler( EventHandlerCallRef handler , EventRef event
OSStatus result = eventNotHandledErr ;
switch( GetEventClass( event ) )
{
case kEventClassCommand :
result = CommandEventHandler( handler , event , data ) ;
break ;
case kEventClassApplication :
result = ApplicationEventHandler( handler , event , data ) ;
break ;
case kEventClassMenu :
result = MenuEventHandler( handler , event , data ) ;
break ;
case kEventClassMouse :
result = MouseEventHandler( handler , event , data ) ;
break ;
case kEventClassAppleEvent :
{
EventRecord rec ;
wxMacConvertEventToRecord( event , &rec ) ;
result = AEProcessAppleEvent( &rec ) ;
}
break ;
default :
break ;
case kEventClassCommand :
result = CommandEventHandler( handler , event , data ) ;
break ;
case kEventClassApplication :
result = ApplicationEventHandler( handler , event , data ) ;
break ;
case kEventClassMenu :
result = MenuEventHandler( handler , event , data ) ;
break ;
case kEventClassMouse :
result = MouseEventHandler( handler , event , data ) ;
break ;
case kEventClassAppleEvent :
{
EventRecord rec ;
wxMacConvertEventToRecord( event , &rec ) ;
result = AEProcessAppleEvent( &rec ) ;
}
break ;
default :
break ;
}
return result ;
@@ -532,7 +532,7 @@ bool wxApp::Initialize()
#ifndef __DARWIN__
// now avoid exceptions thrown for new (bad_alloc)
// FIXME CS for some changes outside wxMac does not compile anymore
// FIXME CS for some changes outside wxMac does not compile anymore
#if 0
std::__throws_bad_alloc = 0 ;
#endif
@@ -593,17 +593,17 @@ bool wxApp::Initialize()
bool wxApp::OnInitGui()
{
if( !wxAppBase::OnInitGui() )
return false ;
#if TARGET_CARBON
InstallStandardEventHandler( GetApplicationEventTarget() ) ;
InstallApplicationEventHandler(
GetwxAppEventHandlerUPP(),
GetEventTypeCount(eventList), eventList, wxTheApp, &((EventHandlerRef)wxTheApp->m_macEventHandler));
if( !wxAppBase::OnInitGui() )
return false ;
#if TARGET_CARBON
InstallStandardEventHandler( GetApplicationEventTarget() ) ;
InstallApplicationEventHandler(
GetwxAppEventHandlerUPP(),
GetEventTypeCount(eventList), eventList, wxTheApp, &((EventHandlerRef)wxTheApp->m_macEventHandler));
#endif
#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
AEInstallEventHandler( kCoreEventClass , kAEOpenDocuments ,
NewAEEventHandlerUPP(AEHandleODoc) ,
@@ -632,7 +632,7 @@ bool wxApp::OnInitGui()
0 , FALSE ) ;
#endif
return TRUE ;
return TRUE ;
}
void wxApp::CleanUp()
@@ -879,7 +879,7 @@ void wxStAppResource::CloseSharedLibraryResource()
// the __wxinitialize and __wxterminate must be used
extern "C" {
void __sinit(void); /* (generated by linker) */
void __sinit(void); /* (generated by linker) */
pascal OSErr __initialize(const CFragInitBlock *theInitBlock);
pascal void __terminate(void);
}
@@ -1149,14 +1149,14 @@ bool wxApp::Initialized()
int wxApp::MainLoop()
{
m_keepGoing = TRUE;
m_keepGoing = TRUE;
while (m_keepGoing)
{
MacDoOneEvent() ;
}
while (m_keepGoing)
{
MacDoOneEvent() ;
}
return 0;
return 0;
}
// Returns TRUE if more time is needed.
@@ -1171,18 +1171,18 @@ bool wxApp::ProcessIdle()
void wxApp::ExitMainLoop()
{
m_keepGoing = FALSE;
m_keepGoing = FALSE;
}
// Is a message/event pending?
bool wxApp::Pending()
{
#if TARGET_CARBON
return GetNumEventsInQueue( GetMainEventQueue() ) > 0 ;
return GetNumEventsInQueue( GetMainEventQueue() ) > 0 ;
#else
EventRecord event ;
return EventAvail( everyEvent , &event ) ;
return EventAvail( everyEvent , &event ) ;
#endif
}
@@ -1336,39 +1336,39 @@ bool wxApp::Yield(bool onlyIfNeeded)
#if wxUSE_THREADS
YieldToAnyThread() ;
#endif
// by definition yield should handle all non-processed events
// by definition yield should handle all non-processed events
#if TARGET_CARBON
EventRef theEvent;
EventRef theEvent;
OSStatus status = noErr ;
do
{
s_inReceiveEvent = true ;
status = ReceiveNextEvent(0, NULL,kEventDurationNoWait,true,&theEvent) ;
s_inReceiveEvent = false ;
if ( status == eventLoopTimedOutErr )
{
// make sure next time the event loop will trigger idle events
sleepTime = kEventDurationNoWait ;
}
else if ( status == eventLoopQuitErr )
{
// according to QA1061 this may also occur when a WakeUp Process
// is executed
}
else
{
MacHandleOneEvent( theEvent ) ;
ReleaseEvent(theEvent);
}
} while( status == noErr ) ;
OSStatus status = noErr ;
do
{
s_inReceiveEvent = true ;
status = ReceiveNextEvent(0, NULL,kEventDurationNoWait,true,&theEvent) ;
s_inReceiveEvent = false ;
if ( status == eventLoopTimedOutErr )
{
// make sure next time the event loop will trigger idle events
sleepTime = kEventDurationNoWait ;
}
else if ( status == eventLoopQuitErr )
{
// according to QA1061 this may also occur when a WakeUp Process
// is executed
}
else
{
MacHandleOneEvent( theEvent ) ;
ReleaseEvent(theEvent);
}
} while( status == noErr ) ;
#else
EventRecord event ;
// having a larger value here leads to large performance slowdowns
// so we cannot give background apps more processor time here
// we do so however having a large sleep value in the main event loop
// having a larger value here leads to large performance slowdowns
// so we cannot give background apps more processor time here
// we do so however having a large sleep value in the main event loop
sleepTime = 0 ;
while ( !IsExiting() && WaitNextEvent(everyEvent, &event,sleepTime, (RgnHandle) wxApp::s_macCursorRgn))
@@ -1449,32 +1449,32 @@ void wxApp::MacConvertPublicToPrivateScrap()
void wxApp::MacDoOneEvent()
{
#if TARGET_CARBON
EventRef theEvent;
EventRef theEvent;
s_inReceiveEvent = true ;
OSStatus status = ReceiveNextEvent(0, NULL,sleepTime,true,&theEvent) ;
s_inReceiveEvent = false ;
if ( status == eventLoopTimedOutErr )
{
s_inReceiveEvent = true ;
OSStatus status = ReceiveNextEvent(0, NULL,sleepTime,true,&theEvent) ;
s_inReceiveEvent = false ;
if ( status == eventLoopTimedOutErr )
{
if ( wxTheApp->ProcessIdle() )
sleepTime = kEventDurationNoWait ;
sleepTime = kEventDurationNoWait ;
else
sleepTime = kEventDurationForever ;
}
else if ( status == eventLoopQuitErr )
{
// according to QA1061 this may also occur when a WakeUp Process
// is executed
}
else
{
MacHandleOneEvent( theEvent ) ;
ReleaseEvent(theEvent);
}
sleepTime = kEventDurationForever ;
}
else if ( status == eventLoopQuitErr )
{
// according to QA1061 this may also occur when a WakeUp Process
// is executed
}
else
{
MacHandleOneEvent( theEvent ) ;
ReleaseEvent(theEvent);
}
#else
EventRecord event ;
EventRecord event ;
EventMask eventMask = everyEvent ;
EventMask eventMask = everyEvent ;
if (WaitNextEvent(eventMask, &event, sleepTime, (RgnHandle) s_macCursorRgn))
{
@@ -1490,9 +1490,9 @@ void wxApp::MacDoOneEvent()
::IdleControls( window ) ;
if ( wxTheApp->ProcessIdle() )
sleepTime = 0 ;
sleepTime = 0 ;
else
sleepTime = GetCaretTime() / 2 ;
sleepTime = GetCaretTime() / 2 ;
}
if ( event.what != kHighLevelEvent )
SetRectRgn( (RgnHandle) s_macCursorRgn , event.where.h , event.where.v , event.where.h + 1 , event.where.v + 1 ) ;
@@ -1506,10 +1506,10 @@ void wxApp::MacDoOneEvent()
void wxApp::MacHandleOneEvent( WXEVENTREF evr )
{
#if TARGET_CARBON
EventTargetRef theTarget;
theTarget = GetEventDispatcherTarget();
EventTargetRef theTarget;
theTarget = GetEventDispatcherTarget();
m_macCurrentEvent = evr ;
SendEventToEventTarget ((EventRef) evr , theTarget);
SendEventToEventTarget ((EventRef) evr , theTarget);
#else
EventRecord* ev = (EventRecord*) evr ;
m_macCurrentEvent = ev ;
@@ -1784,15 +1784,15 @@ void wxApp::MacHandleMouseUpEvent( WXEVENTREF evr )
WindowRef window;
short windowPart = inNoWindow ;
if ( wxTheApp->s_captureWindow )
{
window = (WindowRef) s_captureWindow->MacGetRootWindow() ;
windowPart = inContent ;
}
else
{
windowPart = ::FindWindow(ev->where, &window) ;
}
if ( wxTheApp->s_captureWindow )
{
window = (WindowRef) s_captureWindow->MacGetRootWindow() ;
windowPart = inContent ;
}
else
{
windowPart = ::FindWindow(ev->where, &window) ;
}
switch (windowPart)
{
@@ -1990,14 +1990,14 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi
keycode = short(keyInfo & keyCodeMask) >> 8 ;
}
long keyval = wxMacTranslateKey(keychar, keycode) ;
long realkeyval = keyval ;
if ( keyval == keychar )
{
// we are not on a special character combo -> pass the real os event-value to EVT_CHAR, but not to EVT_KEY (make upper first)
realkeyval = short(keymessage & charCodeMask) ;
keyval = wxToupper( keyval ) ;
}
long realkeyval = keyval ;
if ( keyval == keychar )
{
// we are not on a special character combo -> pass the real os event-value to EVT_CHAR, but not to EVT_KEY (make upper first)
realkeyval = short(keymessage & charCodeMask) ;
keyval = wxToupper( keyval ) ;
}
wxKeyEvent event(wxEVT_KEY_DOWN);
bool handled = false ;
event.m_shiftDown = modifiers & shiftKey;
@@ -2120,10 +2120,10 @@ bool wxApp::MacSendKeyUpEvent( wxWindow* focus , long keymessage , long modifier
}
long keyval = wxMacTranslateKey(keychar, keycode) ;
if ( keyval == keychar )
{
keyval = wxToupper( keyval ) ;
}
if ( keyval == keychar )
{
keyval = wxToupper( keyval ) ;
}
bool handled = false ;
wxKeyEvent event(wxEVT_KEY_UP);
@@ -2248,15 +2248,15 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
wxWindow* currentMouseWindow = NULL ;
if (s_captureWindow )
{
currentMouseWindow = s_captureWindow ;
}
else
{
wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
&currentMouseWindow ) ;
}
if (s_captureWindow )
{
currentMouseWindow = s_captureWindow ;
}
else
{
wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
&currentMouseWindow ) ;
}
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
{
@@ -2299,16 +2299,16 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
short windowPart = inNoWindow ;
if ( s_captureWindow )
{
window = (WindowRef) s_captureWindow->MacGetRootWindow() ;
windowPart = inContent ;
}
else
{
windowPart = ::FindWindow(ev->where, &window);
}
if ( s_captureWindow )
{
window = (WindowRef) s_captureWindow->MacGetRootWindow() ;
windowPart = inContent ;
}
else
{
windowPart = ::FindWindow(ev->where, &window);
}
switch (windowPart)
{
case inContent :
@@ -2358,8 +2358,8 @@ void wxApp::MacHandleMenuCommand( wxUint32 id )
{
item->Check( !item->IsChecked() ) ;
}
menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
}
#if !TARGET_CARBON
@@ -2384,7 +2384,7 @@ void wxApp::MacHandleMenuSelect( int macMenuId , int macMenuItemNum )
{
MenuCommand id ;
GetMenuItemCommandID( GetMenuHandle(macMenuId) , macMenuItemNum , &id ) ;
MacHandleMenuCommand( id ) ;
MacHandleMenuCommand( id ) ;
}
HiliteMenu(0);
}

View File

@@ -218,8 +218,8 @@ CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth ,
if ( mask )
{
Rect r ;
GetPortBounds( image , &r ) ;
Rect r ;
GetPortBounds( image , &r ) ;
LockPixels(GetGWorldPixMap(mask) ) ;
CopyBits(GetPortBitMapForCopyBits(mask) ,
&(**icon).iconBMap , &r , &r, srcCopy , nil ) ;
@@ -229,8 +229,8 @@ CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth ,
}
else
{
Rect r ;
GetPortBounds( image , &r ) ;
Rect r ;
GetPortBounds( image , &r ) ;
LockPixels(GetGWorldPixMap(image));
CopyBits(GetPortBitMapForCopyBits(image) ,
&(**icon).iconBMap , &r , &r, srcCopy , nil ) ;
@@ -275,7 +275,7 @@ PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask)
if ( clipRgn )
GetRegionBounds( clipRgn , &portRect ) ;
else
GetPortBounds( wp , &portRect ) ;
GetPortBounds( wp , &portRect ) ;
pict = OpenPicture(&portRect);
if(pict)
{
@@ -283,7 +283,7 @@ PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask)
RGBBackColor( &white ) ;
if ( clipRgn )
SetClip( clipRgn ) ;
SetClip( clipRgn ) ;
LockPixels( GetGWorldPixMap( wp ) ) ;
CopyBits(GetPortBitMapForCopyBits(wp),
@@ -296,7 +296,7 @@ PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask)
}
SetGWorld( origPort , origDev ) ;
if ( clipRgn )
DisposeRgn( clipRgn ) ;
DisposeRgn( clipRgn ) ;
return pict;
}
@@ -335,19 +335,19 @@ void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bi
info->contentType = kControlContentPictHandle ;
if ( bitmap.GetMask() )
{
info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , MAC_WXHBITMAP(bitmap.GetMask()->GetMaskBitmap() ) ) ;
info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , MAC_WXHBITMAP(bitmap.GetMask()->GetMaskBitmap() ) ) ;
}
else
{
info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , NULL ) ;
info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , NULL ) ;
}
}
}
else if ( bmap->m_bitmapType == kMacBitmapTypeIcon )
{
info->contentType = kControlContentCIconHandle ;
info->u.cIconHandle = MAC_WXHICON(bmap->m_hIcon) ;
}
else if ( bmap->m_bitmapType == kMacBitmapTypeIcon )
{
info->contentType = kControlContentCIconHandle ;
info->u.cIconHandle = MAC_WXHICON(bmap->m_hIcon) ;
}
}
}
@@ -369,46 +369,46 @@ wxBitmapRefData::wxBitmapRefData()
// TODO move this to a public function of Bitmap Ref
static void DisposeBitmapRefData(wxBitmapRefData *data)
{
if ( !data )
return ;
switch (data->m_bitmapType)
{
case kMacBitmapTypePict :
{
if ( data->m_hPict )
{
KillPicture( MAC_WXHMETAFILE( data->m_hPict ) ) ;
data->m_hPict = NULL ;
}
}
break ;
case kMacBitmapTypeGrafWorld :
{
if ( data->m_hBitmap )
{
wxMacDestroyGWorld( MAC_WXHBITMAP(data->m_hBitmap) ) ;
data->m_hBitmap = NULL ;
}
}
break ;
case kMacBitmapTypeIcon :
if ( data->m_hIcon )
{
DisposeCIcon( MAC_WXHICON(data->m_hIcon) ) ;
data->m_hIcon = NULL ;
}
default :
// unkown type ?
break ;
}
if ( !data )
return ;
switch (data->m_bitmapType)
{
case kMacBitmapTypePict :
{
if ( data->m_hPict )
{
KillPicture( MAC_WXHMETAFILE( data->m_hPict ) ) ;
data->m_hPict = NULL ;
}
}
break ;
case kMacBitmapTypeGrafWorld :
{
if ( data->m_hBitmap )
{
wxMacDestroyGWorld( MAC_WXHBITMAP(data->m_hBitmap) ) ;
data->m_hBitmap = NULL ;
}
}
break ;
case kMacBitmapTypeIcon :
if ( data->m_hIcon )
{
DisposeCIcon( MAC_WXHICON(data->m_hIcon) ) ;
data->m_hIcon = NULL ;
}
default :
// unkown type ?
break ;
}
if (data->m_bitmapMask)
{
delete data->m_bitmapMask;
data->m_bitmapMask = NULL;
}
if (data->m_bitmapMask)
{
delete data->m_bitmapMask;
data->m_bitmapMask = NULL;
}
}
wxBitmapRefData::~wxBitmapRefData()
@@ -642,8 +642,8 @@ void wxBitmap::SetHBITMAP(WXHBITMAP bmp)
{
if (!M_BITMAPDATA)
m_refData = new wxBitmapRefData;
else
DisposeBitmapRefData( M_BITMAPDATA ) ;
else
DisposeBitmapRefData( M_BITMAPDATA ) ;
M_BITMAPDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
M_BITMAPDATA->m_hBitmap = bmp ;
@@ -654,8 +654,8 @@ void wxBitmap::SetHICON(WXHICON ico)
{
if (!M_BITMAPDATA)
m_refData = new wxBitmapRefData;
else
DisposeBitmapRefData( M_BITMAPDATA ) ;
else
DisposeBitmapRefData( M_BITMAPDATA ) ;
M_BITMAPDATA->m_bitmapType = kMacBitmapTypeIcon ;
M_BITMAPDATA->m_hIcon = ico ;
@@ -666,8 +666,8 @@ void wxBitmap::SetPict(WXHMETAFILE pict)
{
if (!M_BITMAPDATA)
m_refData = new wxBitmapRefData;
else
DisposeBitmapRefData( M_BITMAPDATA ) ;
else
DisposeBitmapRefData( M_BITMAPDATA ) ;
M_BITMAPDATA->m_bitmapType = kMacBitmapTypePict ;
M_BITMAPDATA->m_hPict = pict ;
@@ -820,26 +820,26 @@ wxImage wxBitmap::ConvertToImage() const
GetGWorld( &origPort, &origDevice );
if ( GetBitmapType() != kMacBitmapTypeGrafWorld )
{
tempPort = wxMacCreateGWorld( width , height , -1) ;
tempPort = wxMacCreateGWorld( width , height , -1) ;
}
else
{
tempPort = (GWorldPtr) GetHBITMAP() ;
}
LockPixels(GetGWorldPixMap(tempPort));
SetGWorld( tempPort, NULL);
if ( GetBitmapType() == kMacBitmapTypePict || GetBitmapType() == kMacBitmapTypeIcon )
{
tempPort = (GWorldPtr) GetHBITMAP() ;
}
LockPixels(GetGWorldPixMap(tempPort));
SetGWorld( tempPort, NULL);
if ( GetBitmapType() == kMacBitmapTypePict || GetBitmapType() == kMacBitmapTypeIcon )
{
Rect bitmaprect = { 0 , 0 , height, width };
if ( GetBitmapType() == kMacBitmapTypeIcon )
{
::PlotCIconHandle( &bitmaprect , atNone , ttNone , MAC_WXHICON(GetHICON()) ) ;
maskRgn = NewRgn() ;
BitMapToRegion( maskRgn , &(**(MAC_WXHICON(GetHICON()))).iconMask ) ;
if ( GetBitmapType() == kMacBitmapTypeIcon )
{
::PlotCIconHandle( &bitmaprect , atNone , ttNone , MAC_WXHICON(GetHICON()) ) ;
maskRgn = NewRgn() ;
BitMapToRegion( maskRgn , &(**(MAC_WXHICON(GetHICON()))).iconMask ) ;
}
else
::DrawPicture( (PicHandle) GetPict(), &bitmaprect ) ;
}
else
::DrawPicture( (PicHandle) GetPict(), &bitmaprect ) ;
}
// Copy data into image
index = 0;
for (int yy = 0; yy < height; yy++)
@@ -854,28 +854,28 @@ wxImage wxBitmap::ConvertToImage() const
data[index + 1] = g;
data[index + 2] = b;
if ( maskRgn )
{
Point pt ;
pt.h = xx ;
pt.v = yy ;
if ( !PtInRgn( pt , maskRgn ) )
{
{
Point pt ;
pt.h = xx ;
pt.v = yy ;
if ( !PtInRgn( pt , maskRgn ) )
{
data[index ] = mask_r;
data[index + 1] = mask_g;
data[index + 2] = mask_b;
}
}
}
else
{
if (mask)
{
if (mask->PointMasked(xx,yy))
{
data[index ] = mask_r;
data[index + 1] = mask_g;
data[index + 2] = mask_b;
}
}
if (mask)
{
if (mask->PointMasked(xx,yy))
{
data[index ] = mask_r;
data[index + 1] = mask_g;
data[index + 2] = mask_b;
}
}
}
index += 3;
}
@@ -891,11 +891,11 @@ wxImage wxBitmap::ConvertToImage() const
SetGWorld(origPort, origDevice);
if ( GetBitmapType() != kMacBitmapTypeGrafWorld )
{
wxMacDestroyGWorld( tempPort ) ;
wxMacDestroyGWorld( tempPort ) ;
}
if ( maskRgn )
{
DisposeRgn( maskRgn ) ;
DisposeRgn( maskRgn ) ;
}
return image;
@@ -1038,33 +1038,33 @@ WXHBITMAP wxBitmap::GetHBITMAP() const
WXHMETAFILE wxBitmap::GetPict( bool *created ) const
{
wxCHECK_MSG( Ok(), NULL, wxT("invalid bitmap") );
wxCHECK_MSG( Ok(), NULL, wxT("invalid bitmap") );
PicHandle picture = NULL ; // This is the returned picture
if ( created )
(*created) = false ;
// If bitmap already in Pict format return pointer
if(M_BITMAPDATA->m_bitmapType == kMacBitmapTypePict) {
return M_BITMAPDATA->m_hPict;
}
else if(M_BITMAPDATA->m_bitmapType != kMacBitmapTypeGrafWorld) {
// Invalid bitmap
return NULL;
}
else
{
if ( GetMask() )
{
picture = wxMacCreatePict( MAC_WXHBITMAP(M_BITMAPDATA->m_hBitmap) , MAC_WXHBITMAP(GetMask()->GetMaskBitmap() ) ) ;
}
else
{
picture = wxMacCreatePict( MAC_WXHBITMAP(M_BITMAPDATA->m_hBitmap) , NULL ) ;
}
if ( created && picture )
(*created) = true ;
PicHandle picture = NULL ; // This is the returned picture
if ( created )
(*created) = false ;
// If bitmap already in Pict format return pointer
if(M_BITMAPDATA->m_bitmapType == kMacBitmapTypePict) {
return M_BITMAPDATA->m_hPict;
}
return picture ;
else if(M_BITMAPDATA->m_bitmapType != kMacBitmapTypeGrafWorld) {
// Invalid bitmap
return NULL;
}
else
{
if ( GetMask() )
{
picture = wxMacCreatePict( MAC_WXHBITMAP(M_BITMAPDATA->m_hBitmap) , MAC_WXHBITMAP(GetMask()->GetMaskBitmap() ) ) ;
}
else
{
picture = wxMacCreatePict( MAC_WXHBITMAP(M_BITMAPDATA->m_hBitmap) , NULL ) ;
}
if ( created && picture )
(*created) = true ;
}
return picture ;
}
/*

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -45,35 +45,35 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
m_windowId = id;
if ( width == -1 && bitmap.Ok())
width = bitmap.GetWidth() + 2*m_marginX;
width = bitmap.GetWidth() + 2*m_marginX;
if ( height == -1 && bitmap.Ok())
height = bitmap.GetHeight() + 2*m_marginY;
height = bitmap.GetHeight() + 2*m_marginY;
Rect bounds ;
Str255 title ;
Rect bounds ;
Str255 title ;
m_bmpNormal = bitmap;
wxBitmapRefData * bmap = NULL ;
if ( m_bmpNormal.Ok() )
bmap = (wxBitmapRefData*) ( m_bmpNormal.GetRefData()) ;
MacPreControlCreate( parent , id , "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
wxBitmapRefData * bmap = NULL ;
if ( m_bmpNormal.Ok() )
bmap = (wxBitmapRefData*) ( m_bmpNormal.GetRefData()) ;
MacPreControlCreate( parent , id , "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 ,
kControlBehaviorOffsetContents +
( bmap && bmap->m_bitmapType == kMacBitmapTypeIcon ?
kControlContentCIconHandle : kControlContentPictHandle ) , 0,
(( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ;
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
ControlButtonContentInfo info ;
wxMacCreateBitmapButton( &info , m_bmpNormal ) ;
if ( info.contentType != kControlNoContent )
{
::SetControlData( (ControlHandle) m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 ,
kControlBehaviorOffsetContents +
( bmap && bmap->m_bitmapType == kMacBitmapTypeIcon ?
kControlContentCIconHandle : kControlContentPictHandle ) , 0,
(( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ;
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
ControlButtonContentInfo info ;
wxMacCreateBitmapButton( &info , m_bmpNormal ) ;
if ( info.contentType != kControlNoContent )
{
::SetControlData( (ControlHandle) m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
}
MacPostControlCreate() ;
MacPostControlCreate() ;
return TRUE;
}

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -112,17 +112,17 @@ wxBrush::wxBrush(ThemeBrush macThemeBrush )
}
void wxBrush::Unshare()
{
// Don't change shared data
if (!m_refData)
// Don't change shared data
if (!m_refData)
{
m_refData = new wxBrushRefData();
}
m_refData = new wxBrushRefData();
}
else
{
wxBrushRefData* ref = new wxBrushRefData(*(wxBrushRefData*)m_refData);
UnRef();
m_refData = ref;
}
wxBrushRefData* ref = new wxBrushRefData(*(wxBrushRefData*)m_refData);
UnRef();
m_refData = ref;
}
}
void wxBrush::SetColour(const wxColour& col)
@@ -203,25 +203,27 @@ unsigned long wxBrush::GetMacThemeBackground( WXRECTPTR extent) const
}
}
short wxBrush::GetMacTheme() const
short wxBrush::GetMacTheme() const
{
return (M_BRUSHDATA ? ( M_BRUSHDATA->m_macBrushKind == kwxMacBrushTheme ? M_BRUSHDATA->m_macThemeBrush : kThemeBrushBlack) : kThemeBrushBlack);
};
return (M_BRUSHDATA ? ( M_BRUSHDATA->m_macBrushKind == kwxMacBrushTheme ? M_BRUSHDATA->m_macThemeBrush : kThemeBrushBlack) : kThemeBrushBlack);
}
wxColour& wxBrush::GetColour() const
{ return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour); };
{
return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour);
}
int wxBrush::GetStyle() const
{
return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0);
};
return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0);
}
wxBitmap *wxBrush::GetStipple() const
{
return (M_BRUSHDATA ? & M_BRUSHDATA->m_stipple : 0);
};
return (M_BRUSHDATA ? & M_BRUSHDATA->m_stipple : 0);
}
wxMacBrushKind wxBrush::MacGetBrushKind() const
{
return (M_BRUSHDATA ? M_BRUSHDATA->m_macBrushKind : kwxMacBrushColour);
};
return (M_BRUSHDATA ? M_BRUSHDATA->m_macBrushKind : kwxMacBrushColour);
}

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -34,23 +34,23 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
const wxValidator& validator,
const wxString& name)
{
Rect bounds ;
Str255 title ;
Rect bounds ;
Str255 title ;
if ( UMAHasAquaLayout() )
{
m_macHorizontalBorder = kMacOSXHorizontalBorder;
m_macVerticalBorder = kMacOSXVerticalBorder;
}
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
kControlPushButtonProc , (long) this ) ;
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
MacPostControlCreate() ;
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
kControlPushButtonProc , (long) this ) ;
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
MacPostControlCreate() ;
return TRUE;
}
@@ -65,19 +65,19 @@ void wxButton::SetDefault()
parent->SetDefaultItem(this);
}
Boolean inData;
if ( btnOldDefault && btnOldDefault->m_macControl )
{
inData = 0;
::SetControlData( (ControlHandle) btnOldDefault->m_macControl , kControlButtonPart ,
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
}
if ( (ControlHandle) m_macControl )
{
inData = 1;
::SetControlData( (ControlHandle) m_macControl , kControlButtonPart ,
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
}
Boolean inData;
if ( btnOldDefault && btnOldDefault->m_macControl )
{
inData = 0;
::SetControlData( (ControlHandle) btnOldDefault->m_macControl , kControlButtonPart ,
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
}
if ( (ControlHandle) m_macControl )
{
inData = 1;
::SetControlData( (ControlHandle) m_macControl , kControlButtonPart ,
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
}
}
wxSize wxButton::DoGetBestSize() const
@@ -85,7 +85,7 @@ wxSize wxButton::DoGetBestSize() const
wxSize sz = GetDefaultSize() ;
int wBtn = m_label.Length() * 8 + 12 + 2 * kMacOSXHorizontalBorder ;
if (wBtn > sz.x) sz.x = wBtn;
return sz ;
@@ -94,7 +94,7 @@ wxSize wxButton::DoGetBestSize() const
wxSize wxButton::GetDefaultSize()
{
int wBtn = 70 ;
int hBtn = 20 ;
int hBtn = 20 ;
if ( UMAHasAquaLayout() )
{

View File

@@ -6,7 +6,7 @@
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -31,15 +31,15 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
const wxValidator& validator,
const wxString& name)
{
Rect bounds ;
Str255 title ;
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
Rect bounds ;
Str255 title ;
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
kControlCheckBoxProc , (long) this ) ;
MacPostControlCreate() ;
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
kControlCheckBoxProc , (long) this ) ;
MacPostControlCreate() ;
return TRUE;
}
@@ -63,7 +63,7 @@ void wxCheckBox::Command (wxCommandEvent & event)
void wxCheckBox::MacHandleControlClick( WXWidget WXUNUSED(control), wxInt16 WXUNUSED(controlpart) )
{
SetValue( !GetValue() ) ;
SetValue( !GetValue() ) ;
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId );
event.SetInt(GetValue());
event.SetEventObject(this);

View File

@@ -73,9 +73,9 @@ static pascal void wxMacCheckListDefinition( short message, Boolean isSelected,
RgnHandle savedClipRegion;
SInt32 savedPenMode;
wxCheckListBox* list;
GetPort(&savePort);
SetPort((**listHandle).port);
grafPtr = (**listHandle).port ;
GetPort(&savePort);
SetPort((**listHandle).port);
grafPtr = (**listHandle).port ;
// typecast our refCon
list = (wxCheckListBox*) GetControlReference( (ControlHandle) GetListRefCon(listHandle) );
@@ -102,13 +102,13 @@ static pascal void wxMacCheckListDefinition( short message, Boolean isSelected,
ClipRect( drawRect );
EraseRect( drawRect );
wxFontRefData * font = (wxFontRefData*) (list->GetFont().GetRefData()) ;
wxFontRefData * font = (wxFontRefData*) (list->GetFont().GetRefData()) ;
if ( font )
{
::TextFont( font->m_macFontNum ) ;
::TextSize( font->m_macFontSize) ;
::TextFace( font->m_macFontStyle ) ;
if ( font )
{
::TextFont( font->m_macFontNum ) ;
::TextSize( font->m_macFontSize) ;
::TextFace( font->m_macFontStyle ) ;
}
ThemeButtonDrawInfo info ;
@@ -123,11 +123,11 @@ static pascal void wxMacCheckListDefinition( short message, Boolean isSelected,
checkRect.right = checkRect.left + list->m_checkBoxWidth ;
checkRect.bottom = checkRect.top + list->m_checkBoxHeight ;
DrawThemeButton(&checkRect,kThemeCheckBox,
&info,NULL,NULL, NULL,0);
MoveTo(drawRect->left + 2 + list->m_checkBoxWidth+2, drawRect->top + list->m_TextBaseLineOffset );
DrawText(text, 0 , text.Length());
&info,NULL,NULL, NULL,0);
MoveTo(drawRect->left + 2 + list->m_checkBoxWidth+2, drawRect->top + list->m_TextBaseLineOffset );
DrawText(text, 0 , text.Length());
// If the cell is hilited, do the hilite now. Paint the cell contents with the
// appropriate QuickDraw transform mode.
@@ -142,8 +142,8 @@ static pascal void wxMacCheckListDefinition( short message, Boolean isSelected,
SetClip( savedClipRegion );
DisposeRgn( savedClipRegion );
}
break;
}
break;
case lHiliteMsg:
// Hilite or unhilite the cell. Paint the cell contents with the
@@ -194,7 +194,7 @@ bool wxCheckListBox::Create(wxWindow *parent,
GetThemeMetric(kThemeMetricCheckBoxWidth,(long *)&m_checkBoxWidth);
GetThemeMetric(kThemeMetricCheckBoxHeight,&h);
#endif
wxFontRefData * font = (wxFontRefData*) (GetFont().GetRefData()) ;
wxFontRefData * font = (wxFontRefData*) (GetFont().GetRefData()) ;
FontInfo finfo;
FetchFontInfo(font->m_macFontNum,short(font->m_macFontSize),font->m_macFontStyle,&finfo);
@@ -202,12 +202,12 @@ bool wxCheckListBox::Create(wxWindow *parent,
m_TextBaseLineOffset= finfo.leading+finfo.ascent;
m_checkBoxHeight= finfo.leading+finfo.ascent+finfo.descent;
if (m_checkBoxHeight<h)
{
m_TextBaseLineOffset+= (h-m_checkBoxHeight)/2;
m_checkBoxHeight= h;
}
if (m_checkBoxHeight<h)
{
m_TextBaseLineOffset+= (h-m_checkBoxHeight)/2;
m_checkBoxHeight= h;
}
Rect bounds ;
Str255 title ;
@@ -376,55 +376,55 @@ END_EVENT_TABLE()
void wxCheckListBox::OnChar(wxKeyEvent& event)
{
if ( event.GetKeyCode() == WXK_SPACE )
{
int index = GetSelection() ;
if ( index >= 0 )
if ( event.GetKeyCode() == WXK_SPACE )
{
Check(index, !IsChecked(index) ) ;
wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId());
event.SetInt(index);
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
int index = GetSelection() ;
if ( index >= 0 )
{
Check(index, !IsChecked(index) ) ;
wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId());
event.SetInt(index);
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
}
}
}
else
event.Skip();
else
event.Skip();
}
void wxCheckListBox::OnLeftClick(wxMouseEvent& event)
{
// clicking on the item selects it, clicking on the checkmark toggles
if ( event.GetX() <= 20 /*check width*/ ) {
int lineheight ;
int topcell ;
// clicking on the item selects it, clicking on the checkmark toggles
if ( event.GetX() <= 20 /*check width*/ ) {
int lineheight ;
int topcell ;
#if TARGET_CARBON
Point pt ;
GetListCellSize( (ListHandle)m_macList , &pt ) ;
lineheight = pt.v ;
ListBounds visible ;
GetListVisibleCells( (ListHandle)m_macList , &visible ) ;
topcell = visible.top ;
Point pt ;
GetListCellSize( (ListHandle)m_macList , &pt ) ;
lineheight = pt.v ;
ListBounds visible ;
GetListVisibleCells( (ListHandle)m_macList , &visible ) ;
topcell = visible.top ;
#else
lineheight = (**(ListHandle)m_macList).cellSize.v ;
topcell = (**(ListHandle)m_macList).visible.top ;
lineheight = (**(ListHandle)m_macList).cellSize.v ;
topcell = (**(ListHandle)m_macList).visible.top ;
#endif
size_t nItem = ((size_t)event.GetY()) / lineheight + topcell ;
if ( nItem < (size_t)m_noItems )
{
Check(nItem, !IsChecked(nItem) ) ;
wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId());
event.SetInt(nItem);
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
size_t nItem = ((size_t)event.GetY()) / lineheight + topcell ;
if ( nItem < (size_t)m_noItems )
{
Check(nItem, !IsChecked(nItem) ) ;
wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId());
event.SetInt(nItem);
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
}
//else: it's not an error, just click outside of client zone
}
else {
// implement default behaviour: clicking on the item selects it
event.Skip();
}
//else: it's not an error, just click outside of client zone
}
else {
// implement default behaviour: clicking on the item selects it
event.Skip();
}
}
#endif // wxUSE_CHECKLISTBOX

View File

@@ -6,19 +6,24 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "choice.h"
#endif
#include "wx/defs.h"
#include "wx/choice.h"
#include "wx/menu.h"
#include "wx/mac/uma.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl)
#endif
extern MenuHandle NewUniqueMenu() ;
wxChoice::~wxChoice()
{
if ( HasClientObjectData() )
@@ -30,49 +35,52 @@ wxChoice::~wxChoice()
}
// DeleteMenu( m_macPopUpMenuId ) ;
// DisposeMenu( m_macPopUpMenuHandle ) ;
// DisposeMenu( m_macPopUpMenuHandle ) ;
}
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)
{
Rect bounds ;
Str255 title ;
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , -12345 , 0 ,
kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ;
m_macPopUpMenuHandle = NewUniqueMenu() ;
SetControlData( (ControlHandle) m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
SetControl32BitMinimum( (ControlHandle) m_macControl , 0 ) ;
SetControl32BitMaximum( (ControlHandle) m_macControl , 0) ;
if ( n > 0 )
SetControl32BitValue( (ControlHandle) m_macControl , 1 ) ;
MacPostControlCreate() ;
Rect bounds ;
Str255 title ;
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , -12345 , 0 ,
kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ;
m_macPopUpMenuHandle = NewUniqueMenu() ;
SetControlData( (ControlHandle) m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
SetControl32BitMinimum( (ControlHandle) m_macControl , 0 ) ;
SetControl32BitMaximum( (ControlHandle) m_macControl , 0) ;
if ( n > 0 )
SetControl32BitValue( (ControlHandle) m_macControl , 1 ) ;
MacPostControlCreate() ;
for ( int i = 0; i < n; i++ )
{
Append(choices[i]);
}
return TRUE;
return TRUE;
}
// ----------------------------------------------------------------------------
// adding/deleting items to/from the list
// ----------------------------------------------------------------------------
int wxChoice::DoAppend(const wxString& item)
{
UMAAppendMenuItem(MAC_WXHMENU( m_macPopUpMenuHandle ) , item);
m_strings.Add( item ) ;
m_datas.Add( NULL ) ;
int index = m_strings.GetCount() - 1 ;
DoSetItemClientData( index , NULL ) ;
SetControl32BitMaximum( (ControlHandle) m_macControl , GetCount()) ;
return index ;
UMAAppendMenuItem(MAC_WXHMENU( m_macPopUpMenuHandle ) , item);
m_strings.Add( item ) ;
m_datas.Add( NULL ) ;
int index = m_strings.GetCount() - 1 ;
DoSetItemClientData( index , NULL ) ;
SetControl32BitMaximum( (ControlHandle) m_macControl , GetCount()) ;
return index ;
}
void wxChoice::Delete(int n)
{
wxCHECK_RET( n < GetCount(), wxT("invalid item index in wxChoice::Delete") );
@@ -83,19 +91,21 @@ void wxChoice::Delete(int n)
::DeleteMenuItem( MAC_WXHMENU(m_macPopUpMenuHandle) , n + 1) ;
m_strings.Remove( n ) ;
m_datas.RemoveAt( n ) ;
SetControl32BitMaximum( (ControlHandle) m_macControl , GetCount()) ;
SetControl32BitMaximum( (ControlHandle) m_macControl , GetCount()) ;
}
void wxChoice::Clear()
{
FreeData();
for ( int i = 0 ; i < GetCount() ; i++ )
{
::DeleteMenuItem( MAC_WXHMENU(m_macPopUpMenuHandle) , 1 ) ;
::DeleteMenuItem( MAC_WXHMENU(m_macPopUpMenuHandle) , 1 ) ;
}
m_strings.Empty() ;
m_datas.Empty() ;
SetControl32BitMaximum( (ControlHandle) m_macControl , 0 ) ;
}
void wxChoice::FreeData()
{
if ( HasClientObjectData() )
@@ -107,6 +117,7 @@ void wxChoice::FreeData()
}
}
}
// ----------------------------------------------------------------------------
// selection
// ----------------------------------------------------------------------------
@@ -114,26 +125,31 @@ int wxChoice::GetSelection() const
{
return GetControl32BitValue( (ControlHandle) m_macControl ) -1 ;
}
void wxChoice::SetSelection(int n)
{
SetControl32BitValue( (ControlHandle) m_macControl , n + 1 ) ;
}
// ----------------------------------------------------------------------------
// string list functions
// ----------------------------------------------------------------------------
int wxChoice::GetCount() const
{
return m_strings.GetCount() ;
}
int wxChoice::FindString(const wxString& s) const
{
for( int i = 0 ; i < GetCount() ; i++ )
{
if ( GetString( i ).IsSameAs(s, FALSE) )
return i ;
if ( GetString( i ).IsSameAs(s, FALSE) )
return i ;
}
return wxNOT_FOUND ;
}
void wxChoice::SetString(int n, const wxString& s)
{
wxFAIL_MSG(wxT("wxChoice::SetString() not yet implemented"));
@@ -145,7 +161,7 @@ void wxChoice::SetString(int n, const wxString& s)
wxString wxChoice::GetString(int n) const
{
return m_strings[n] ;
return m_strings[n] ;
}
// ----------------------------------------------------------------------------
// client data
@@ -154,23 +170,27 @@ void wxChoice::DoSetItemClientData( int n, void* clientData )
{
wxCHECK_RET( n >= 0 && (size_t)n < m_datas.GetCount(),
"invalid index in wxChoice::SetClientData" );
m_datas[n] = (char*) clientData ;
}
void *wxChoice::DoGetItemClientData(int n) const
{
wxCHECK_MSG( n >= 0 && (size_t)n < m_datas.GetCount(), NULL,
"invalid index in wxChoice::GetClientData" );
return (void *)m_datas[n];
}
void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData )
{
DoSetItemClientData(n, clientData);
}
wxClientData* wxChoice::DoGetItemClientObject( int n ) const
{
return (wxClientData *)DoGetItemClientData(n);
}
void wxChoice::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
{
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId );
@@ -188,6 +208,7 @@ void wxChoice::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
ProcessCommand(event);
}
}
wxSize wxChoice::DoGetBestSize() const
{
int lbWidth = 100; // some defaults
@@ -198,35 +219,35 @@ wxSize wxChoice::DoGetBestSize() const
GetThemeMetric(kThemeMetricPopupButtonHeight , &metric );
lbHeight = metric ;
#endif
{
wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ;
Rect drawRect ;
wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
if ( font )
{
::TextFont( font->m_macFontNum ) ;
::TextSize( short(font->m_macFontSize) ) ;
::TextFace( font->m_macFontStyle ) ;
}
else
{
::TextFont( kFontIDMonaco ) ;
::TextSize( 9 );
::TextFace( 0 ) ;
}
// Find the widest line
for(int i = 0; i < GetCount(); i++) {
wxString str(GetString(i));
wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
lbWidth = wxMax(lbWidth, wLine);
}
// Add room for the popup arrow
lbWidth += 2 * lbHeight ;
// And just a bit more
int cy = 12 ;
int cx = ::TextWidth( "X" , 0 , 1 ) ;
lbWidth += cx ;
}
{
wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ;
Rect drawRect ;
wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
if ( font )
{
::TextFont( font->m_macFontNum ) ;
::TextSize( short(font->m_macFontSize) ) ;
::TextFace( font->m_macFontStyle ) ;
}
else
{
::TextFont( kFontIDMonaco ) ;
::TextSize( 9 );
::TextFace( 0 ) ;
}
// Find the widest line
for(int i = 0; i < GetCount(); i++) {
wxString str(GetString(i));
wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
lbWidth = wxMax(lbWidth, wLine);
}
// Add room for the popup arrow
lbWidth += 2 * lbHeight ;
// And just a bit more
int cy = 12 ;
int cx = ::TextWidth( "X" , 0 , 1 ) ;
lbWidth += cx ;
}
return wxSize(lbWidth, lbHeight);
}

View File

@@ -44,27 +44,27 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
#else
OSStatus err = noErr ;
#endif
void * data = NULL ;
Size byteCount;
void * data = NULL ;
Size byteCount;
switch (dataFormat.GetType())
{
case wxDF_OEMTEXT:
dataFormat = wxDF_TEXT;
// fall through
case wxDF_TEXT:
break;
case wxDF_BITMAP :
case wxDF_METAFILE :
break ;
default:
{
wxLogError(_("Unsupported clipboard format."));
return NULL;
}
case wxDF_OEMTEXT:
dataFormat = wxDF_TEXT;
// fall through
case wxDF_TEXT:
break;
case wxDF_BITMAP :
case wxDF_METAFILE :
break ;
default:
{
wxLogError(_("Unsupported clipboard format."));
return NULL;
}
}
#if TARGET_CARBON
ScrapRef scrapRef;
@@ -77,21 +77,21 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
{
if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
{
if ( dataFormat.GetType() == wxDF_TEXT )
byteCount++ ;
if ( dataFormat.GetType() == wxDF_TEXT )
byteCount++ ;
data = new char[ byteCount ] ;
if (( err = GetScrapFlavorData( scrapRef, dataFormat.GetFormatId(), &byteCount , data )) == noErr )
{
*len = byteCount ;
if ( dataFormat.GetType() == wxDF_TEXT )
((char*)data)[byteCount] = 0 ;
}
else
{
delete[] ((char *)data) ;
data = NULL ;
}
data = new char[ byteCount ] ;
if (( err = GetScrapFlavorData( scrapRef, dataFormat.GetFormatId(), &byteCount , data )) == noErr )
{
*len = byteCount ;
if ( dataFormat.GetType() == wxDF_TEXT )
((char*)data)[byteCount] = 0 ;
}
else
{
delete[] ((char *)data) ;
data = NULL ;
}
}
}
}
@@ -104,28 +104,28 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
HUnlock( datahandle ) ;
if ( GetHandleSize( datahandle ) > 0 )
{
byteCount = GetHandleSize( datahandle ) ;
if ( dataFormat.GetType() == wxDF_TEXT )
data = new char[ byteCount + 1] ;
else
data = new char[ byteCount ] ;
memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
if ( dataFormat.GetType() == wxDF_TEXT )
((char*)data)[byteCount] = 0 ;
*len = byteCount ;
byteCount = GetHandleSize( datahandle ) ;
if ( dataFormat.GetType() == wxDF_TEXT )
data = new char[ byteCount + 1] ;
else
data = new char[ byteCount ] ;
memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
if ( dataFormat.GetType() == wxDF_TEXT )
((char*)data)[byteCount] = 0 ;
*len = byteCount ;
}
DisposeHandle( datahandle ) ;
#endif
if ( err )
{
wxLogSysError(_("Failed to get clipboard data."));
return NULL ;
}
if ( dataFormat.GetType() == wxDF_TEXT && wxApp::s_macDefaultEncodingIsPC )
{
wxMacConvertToPC((char*)data,(char*)data,byteCount) ;
wxMacConvertToPC((char*)data,(char*)data,byteCount) ;
}
return data;
}
@@ -139,8 +139,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject)
wxClipboard::wxClipboard()
{
m_open = false ;
m_data = NULL ;
m_open = false ;
m_data = NULL ;
}
wxClipboard::~wxClipboard()
@@ -250,30 +250,30 @@ bool wxClipboard::AddData( wxDataObject *data )
#if wxUSE_DRAG_AND_DROP
case wxDF_METAFILE:
{
wxMetafileDataObject* metaFileDataObject =
wxMetafileDataObject* metaFileDataObject =
(wxMetafileDataObject*) data;
wxMetafile metaFile = metaFileDataObject->GetMetafile();
PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
HLock( (Handle) pict ) ;
err = UMAPutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
HUnlock( (Handle) pict ) ;
wxMetafile metaFile = metaFileDataObject->GetMetafile();
PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
HLock( (Handle) pict ) ;
err = UMAPutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
HUnlock( (Handle) pict ) ;
}
break ;
#endif
case wxDF_BITMAP:
case wxDF_DIB:
{
bool created = false ;
PicHandle pict = NULL ;
wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data ;
pict = (PicHandle) bitmapDataObject->GetBitmap().GetPict( &created ) ;
bool created = false ;
PicHandle pict = NULL ;
wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data ;
pict = (PicHandle) bitmapDataObject->GetBitmap().GetPict( &created ) ;
HLock( (Handle) pict ) ;
err = UMAPutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
HUnlock( (Handle) pict ) ;
if ( created )
KillPicture( pict ) ;
HLock( (Handle) pict ) ;
err = UMAPutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
HUnlock( (Handle) pict ) ;
if ( created )
KillPicture( pict ) ;
}
default:
break ;
@@ -388,7 +388,7 @@ bool wxClipboard::GetData( wxDataObject& data )
transferred = true ;
}
}
break ;
break ;
default :
break ;

View File

@@ -7,7 +7,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -50,20 +50,20 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data)
int wxColourDialog::ShowModal()
{
Point where ;
RGBColor currentColor = *((RGBColor*)m_colourData.dataColour.GetPixel()) , newColor ;
where.h = where.v = -1;
Point where ;
RGBColor currentColor = *((RGBColor*)m_colourData.dataColour.GetPixel()) , newColor ;
where.h = where.v = -1;
if (GetColor( where, "\pSelect a new palette color.", &currentColor, &newColor ))
{
m_colourData.dataColour.Set( (WXCOLORREF*) &newColor ) ;
return wxID_OK;
}
else
{
return wxID_CANCEL;
}
if (GetColor( where, "\pSelect a new palette color.", &currentColor, &newColor ))
{
m_colourData.dataColour.Set( (WXCOLORREF*) &newColor ) ;
return wxID_OK;
}
else
{
return wxID_CANCEL;
}
return wxID_CANCEL;
}

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -28,17 +28,17 @@ static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green
static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green )
{
RGBColor* col = (RGBColor*) color ;
col->red = (red << 8) + red;
col->blue = (blue << 8) + blue;
col->green = (green << 8) + 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;
wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
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)
@@ -48,7 +48,7 @@ wxColour::wxColour (unsigned char r, unsigned char g, unsigned char b)
m_blue = b;
m_isInit = TRUE;
wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
}
wxColour::wxColour (const wxColour& col)
@@ -74,14 +74,14 @@ wxColour::wxColour (const wxColour* col)
wxColour& wxColour::operator =(const wxColour& col)
{
m_red = col.m_red;
m_green = col.m_green;
m_blue = col.m_blue;
m_isInit = col.m_isInit;
memcpy( &m_pixel , &col.m_pixel , 6 ) ;
return *this;
m_red = col.m_red;
m_green = col.m_green;
m_blue = col.m_blue;
m_isInit = col.m_isInit;
memcpy( &m_pixel , &col.m_pixel , 6 ) ;
return *this;
}
void wxColour::InitFromName(const wxString& col)
@@ -102,7 +102,7 @@ void wxColour::InitFromName(const wxString& col)
m_isInit = FALSE;
}
wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
}
wxColour::~wxColour ()
@@ -116,7 +116,7 @@ void wxColour::Set (unsigned char r, unsigned char g, unsigned char b)
m_blue = b;
m_isInit = TRUE;
wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
}
void wxColour::Set( const WXCOLORREF* color )

View File

@@ -96,7 +96,7 @@ protected:
wxWindow *parent = GetParent();
while( parent && !parent->IsTopLevel() && parent->GetDefaultItem() == NULL ) {
parent = parent->GetParent() ;
parent = parent->GetParent() ;
}
if ( parent && parent->GetDefaultItem() )
{
@@ -314,9 +314,9 @@ void wxComboBox::SetValue(const wxString& value)
int s = FindString (value);
if (s == wxNOT_FOUND && !HasFlag(wxCB_READONLY) )
{
m_choice->Append(value) ;
m_choice->Append(value) ;
}
SetStringSelection( value ) ;
SetStringSelection( value ) ;
}
// Clipboard operations

View File

@@ -89,54 +89,54 @@ ControlDefUPP wxMacControlActionUPP = NULL ;
pascal SInt32 wxMacControlDefinition(SInt16 varCode, ControlRef theControl, ControlDefProcMessage message, SInt32 param)
{
wxControl* wx = (wxControl*) wxFindControlFromMacControl( theControl ) ;
if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
{
if( message == drawCntl )
{
wxMacWindowClipper clip( wx ) ;
return InvokeControlDefUPP( varCode , theControl , message , param , (ControlDefUPP) wx->MacGetControlAction() ) ;
}
else
return InvokeControlDefUPP( varCode , theControl , message , param , (ControlDefUPP) wx->MacGetControlAction() ) ;
}
return NULL ;
wxControl* wx = (wxControl*) wxFindControlFromMacControl( theControl ) ;
if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
{
if( message == drawCntl )
{
wxMacWindowClipper clip( wx ) ;
return InvokeControlDefUPP( varCode , theControl , message , param , (ControlDefUPP) wx->MacGetControlAction() ) ;
}
else
return InvokeControlDefUPP( varCode , theControl , message , param , (ControlDefUPP) wx->MacGetControlAction() ) ;
}
return NULL ;
}
pascal OSStatus wxMacSetupControlBackground( ControlRef iControl , SInt16 iMessage , SInt16 iDepth , Boolean iIsColor )
{
OSStatus status = noErr ;
switch( iMessage )
{
case kControlMsgSetUpBackground :
{
wxControl* wx = (wxControl*) GetControlReference( iControl ) ;
if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
{
wxDC::MacSetupBackgroundForCurrentPort( wx->MacGetBackgroundBrush() ) ;
OSStatus status = noErr ;
switch( iMessage )
{
case kControlMsgSetUpBackground :
{
wxControl* wx = (wxControl*) GetControlReference( iControl ) ;
if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
{
wxDC::MacSetupBackgroundForCurrentPort( wx->MacGetBackgroundBrush() ) ;
#if TARGET_CARBON
// under classic this would lead to partial redraws
RgnHandle clip = NewRgn() ;
int x = 0 , y = 0;
// under classic this would lead to partial redraws
RgnHandle clip = NewRgn() ;
int x = 0 , y = 0;
wx->MacWindowToRootWindow( &x,&y ) ;
CopyRgn( (RgnHandle) wx->MacGetVisibleRegion(false).GetWXHRGN() , clip ) ;
OffsetRgn( clip , x , y ) ;
SetClip( clip ) ;
DisposeRgn( clip ) ;
wx->MacWindowToRootWindow( &x,&y ) ;
CopyRgn( (RgnHandle) wx->MacGetVisibleRegion(false).GetWXHRGN() , clip ) ;
OffsetRgn( clip , x , y ) ;
SetClip( clip ) ;
DisposeRgn( clip ) ;
#endif
}
else
{
status = paramErr ;
}
}
break ;
default :
status = paramErr ;
break ;
}
return status ;
}
else
{
status = paramErr ;
}
}
break ;
default :
status = paramErr ;
break ;
}
return status ;
}
wxControl::wxControl()
@@ -389,14 +389,14 @@ void wxControl::MacPostControlCreate()
m_macControlIsShown = true ;
wxAssociateControlWithMacControl( (ControlHandle) m_macControl , this ) ;
if ( wxMacSetupControlBackgroundUPP == NULL )
{
wxMacSetupControlBackgroundUPP = NewControlColorUPP( wxMacSetupControlBackground ) ;
}
if ( wxMacControlActionUPP == NULL )
{
wxMacControlActionUPP = NewControlDefUPP( wxMacControlDefinition ) ;
}
if ( wxMacSetupControlBackgroundUPP == NULL )
{
wxMacSetupControlBackgroundUPP = NewControlColorUPP( wxMacSetupControlBackground ) ;
}
if ( wxMacControlActionUPP == NULL )
{
wxMacControlActionUPP = NewControlDefUPP( wxMacControlDefinition ) ;
}
// The following block of code is responsible for crashes when switching
// back to windows, which can be seen in the dialogs sample.
// It is disabled until a proper solution can be found.
@@ -414,35 +414,35 @@ void wxControl::MacPostControlCreate()
cdef = (cdefHandle) NewHandle( sizeof(cdefRec) ) ;
if ( (**(ControlHandle)m_macControl).contrlDefProc != NULL )
{
(**cdef).instruction = 0x4EF9; /* JMP instruction */
(**cdef).function = (void(*)()) wxMacControlActionUPP;
(**(ControlHandle)m_macControl).contrlDefProc = (Handle) cdef ;
(**cdef).instruction = 0x4EF9; /* JMP instruction */
(**cdef).function = (void(*)()) wxMacControlActionUPP;
(**(ControlHandle)m_macControl).contrlDefProc = (Handle) cdef ;
}
#endif
#endif
SetControlColorProc( (ControlHandle) m_macControl , wxMacSetupControlBackgroundUPP ) ;
// Adjust the controls size and position
wxPoint pos(m_x, m_y);
wxSize best_size( DoGetBestSize() );
wxSize new_size( m_width, m_height );
m_x = m_y = m_width = m_height = -1; // Forces SetSize to move/size the control
if (new_size.x == -1) {
SetControlColorProc( (ControlHandle) m_macControl , wxMacSetupControlBackgroundUPP ) ;
// Adjust the controls size and position
wxPoint pos(m_x, m_y);
wxSize best_size( DoGetBestSize() );
wxSize new_size( m_width, m_height );
m_x = m_y = m_width = m_height = -1; // Forces SetSize to move/size the control
if (new_size.x == -1) {
new_size.x = best_size.x;
}
if (new_size.y == -1) {
new_size.y = best_size.y;
}
SetSize(pos.x, pos.y, new_size.x, new_size.y);
UMAShowControl( (ControlHandle) m_macControl ) ;
SetCursor( *wxSTANDARD_CURSOR ) ;
Refresh() ;
}
if (new_size.y == -1) {
new_size.y = best_size.y;
}
SetSize(pos.x, pos.y, new_size.x, new_size.y);
UMAShowControl( (ControlHandle) m_macControl ) ;
SetCursor( *wxSTANDARD_CURSOR ) ;
Refresh() ;
}
void wxControl::MacAdjustControlRect()
@@ -496,7 +496,7 @@ void wxControl::MacAdjustControlRect()
m_height += 2 * m_macVerticalBorder + MacGetTopBorderSize() + MacGetBottomBorderSize() ;
}
MacUpdateDimensions() ;
MacUpdateDimensions() ;
// UMASizeControl( (ControlHandle) m_macControl , m_width - 2 * m_macHorizontalBorder, m_height - 2 * m_macVerticalBorder ) ;
}
}
@@ -511,19 +511,19 @@ WXWidget wxControl::MacGetContainerForEmbedding()
void wxControl::MacUpdateDimensions()
{
// actually in the current systems this should never be possible, but later reparenting
// may become a reality
if ( (ControlHandle) m_macControl == NULL )
return ;
if ( GetParent() == NULL )
return ;
// actually in the current systems this should never be possible, but later reparenting
// may become a reality
if ( (ControlHandle) m_macControl == NULL )
return ;
if ( GetParent() == NULL )
return ;
WindowRef rootwindow = (WindowRef) MacGetRootWindow() ;
if ( rootwindow == NULL )
return ;
return ;
Rect oldBounds ;
GetControlBounds( (ControlHandle) m_macControl , &oldBounds ) ;
@@ -535,23 +535,23 @@ void wxControl::MacUpdateDimensions()
GetParent()->MacWindowToRootWindow( & new_x , & new_y ) ;
bool doMove = new_x != oldBounds.left || new_y != oldBounds.top ;
bool doResize = ( oldBounds.right - oldBounds.left ) != new_width || (oldBounds.bottom - oldBounds.top ) != new_height ;
if ( doMove || doResize )
{
InvalWindowRect( rootwindow, &oldBounds ) ;
if ( doMove )
{
UMAMoveControl( (ControlHandle) m_macControl , new_x , new_y ) ;
}
if ( doResize )
{
UMASizeControl( (ControlHandle) m_macControl , new_width , new_height ) ;
}
}
if ( doMove || doResize )
{
InvalWindowRect( rootwindow, &oldBounds ) ;
if ( doMove )
{
UMAMoveControl( (ControlHandle) m_macControl , new_x , new_y ) ;
}
if ( doResize )
{
UMASizeControl( (ControlHandle) m_macControl , new_width , new_height ) ;
}
}
}
void wxControl::MacSuperChangedPosition()
{
MacUpdateDimensions() ;
MacUpdateDimensions() ;
wxWindow::MacSuperChangedPosition() ;
}
@@ -561,7 +561,7 @@ void wxControl::MacSuperEnabled( bool enabled )
wxWindow::MacSuperEnabled( enabled ) ;
}
void wxControl::MacSuperShown( bool show )
void wxControl::MacSuperShown( bool show )
{
if ( (ControlHandle) m_macControl )
{
@@ -593,19 +593,19 @@ void wxControl::DoSetSize(int x, int y,
wxWindow::DoSetSize( x , y ,width , height ,sizeFlags ) ;
#if 0
{
Rect meta , control ;
GetControlBounds( (ControlHandle) m_macControl , &control ) ;
RgnHandle rgn = NewRgn() ;
GetControlRegion( (ControlHandle) m_macControl , kControlStructureMetaPart , rgn ) ;
GetRegionBounds( rgn , &meta ) ;
if ( !EmptyRect( &meta ) )
{
wxASSERT( meta.left >= control.left - m_macHorizontalBorder ) ;
wxASSERT( meta.right <= control.right + m_macHorizontalBorder ) ;
wxASSERT( meta.top >= control.top - m_macVerticalBorder ) ;
wxASSERT( meta.bottom <= control.bottom + m_macVerticalBorder ) ;
}
DisposeRgn( rgn ) ;
Rect meta , control ;
GetControlBounds( (ControlHandle) m_macControl , &control ) ;
RgnHandle rgn = NewRgn() ;
GetControlRegion( (ControlHandle) m_macControl , kControlStructureMetaPart , rgn ) ;
GetRegionBounds( rgn , &meta ) ;
if ( !EmptyRect( &meta ) )
{
wxASSERT( meta.left >= control.left - m_macHorizontalBorder ) ;
wxASSERT( meta.right <= control.right + m_macHorizontalBorder ) ;
wxASSERT( meta.top >= control.top - m_macVerticalBorder ) ;
wxASSERT( meta.bottom <= control.bottom + m_macVerticalBorder ) ;
}
DisposeRgn( rgn ) ;
}
#endif
return ;
@@ -814,16 +814,16 @@ void wxControl::OnKeyDown( wxKeyEvent &event )
#if TARGET_CARBON
char charCode ;
UInt32 keyCode ;
char charCode ;
UInt32 keyCode ;
UInt32 modifiers ;
GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
GetEventParameter((EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
GetEventParameter((EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
::HandleControlKey( (ControlHandle) m_macControl , keyCode , charCode , modifiers ) ;
#else
EventRecord *ev = (EventRecord*) wxTheApp->MacGetCurrentEvent() ;
short keycode ;
@@ -895,11 +895,10 @@ void wxControl::OnMouseEvent( wxMouseEvent &event )
bool wxControl::MacCanFocus() const
{
{ if ( (ControlHandle) m_macControl == NULL )
return true ;
else
return false ;
}
if ( (ControlHandle) m_macControl == NULL )
return true ;
else
return false ;
}
void wxControl::MacHandleControlClick( WXWidget control , wxInt16 controlpart )

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -41,7 +41,7 @@ const short kwxCursorSizeNESW = 22 ;
const short kwxCursorSizeNWSE = 23 ;
const short kwxCursorRoller = 24 ;
wxCursor gMacCurrentCursor ;
wxCursor gMacCurrentCursor ;
wxCursorRefData::wxCursorRefData()
{
@@ -60,15 +60,15 @@ wxCursorRefData::~wxCursorRefData()
{
::DisposeCCursor( (CCrsrHandle) m_hCursor ) ;
}
else if ( m_disposeHandle )
{
::DisposeHandle( (Handle ) m_hCursor ) ;
}
else if ( m_releaseHandle )
{
// we don't release the resource since it may already
// be in use again
}
else if ( m_disposeHandle )
{
::DisposeHandle( (Handle ) m_hCursor ) ;
}
else if ( m_releaseHandle )
{
// we don't release the resource since it may already
// be in use again
}
}
// Cursors
@@ -91,14 +91,14 @@ void wxCursor::CreateFromImage(const wxImage & image)
m_refData = new wxCursorRefData;
wxImage image16 = image.Scale(16,16) ;
unsigned char * rgbBits = image16.GetData();
unsigned char * rgbBits = image16.GetData();
int w = image16.GetWidth() ;
int h = image16.GetHeight() ;
bool bHasMask = image16.HasMask() ;
int hotSpotX = image16.GetOptionInt(wxCUR_HOTSPOT_X);
int hotSpotX = image16.GetOptionInt(wxCUR_HOTSPOT_X);
int hotSpotY = image16.GetOptionInt(wxCUR_HOTSPOT_Y);
if (hotSpotX < 0 || hotSpotX >= w)
hotSpotX = 0;
@@ -112,40 +112,40 @@ void wxCursor::CreateFromImage(const wxImage & image)
memset( cp->data , 0 , sizeof( Bits16 ) ) ;
memset( cp->mask , 0 , sizeof( Bits16 ) ) ;
unsigned char mr = image16.GetMaskRed() ;
unsigned char mg = image16.GetMaskGreen() ;
unsigned char mb = image16.GetMaskBlue() ;
unsigned char mr = image16.GetMaskRed() ;
unsigned char mg = image16.GetMaskGreen() ;
unsigned char mb = image16.GetMaskBlue() ;
for ( int y = 0 ; y < h ; ++y )
{
short rowbits = 0 ;
short maskbits = 0 ;
for ( int x = 0 ; x < w ; ++x )
{
long pos = (y * w + x) * 3;
short rowbits = 0 ;
short maskbits = 0 ;
for ( int x = 0 ; x < w ; ++x )
{
long pos = (y * w + x) * 3;
unsigned char r = rgbBits[pos] ;
unsigned char g = rgbBits[pos+1] ;
unsigned char b = rgbBits[pos+2] ;
if ( bHasMask && r==mr && g==mg && b==mb )
{
// masked area, does not appear anywhere
}
else
{
if ( (int)r + (int)g + (int)b < 0x60 )
{
rowbits |= ( 1 << (15-x) ) ;
}
maskbits |= ( 1 << (15-x) ) ;
}
}
cp->data[y] = rowbits ;
cp->mask[y] = maskbits ;
unsigned char r = rgbBits[pos] ;
unsigned char g = rgbBits[pos+1] ;
unsigned char b = rgbBits[pos+2] ;
if ( bHasMask && r==mr && g==mg && b==mb )
{
// masked area, does not appear anywhere
}
else
{
if ( (int)r + (int)g + (int)b < 0x60 )
{
rowbits |= ( 1 << (15-x) ) ;
}
maskbits |= ( 1 << (15-x) ) ;
}
}
cp->data[y] = rowbits ;
cp->mask[y] = maskbits ;
}
if ( !bHasMask )
{
memcpy( cp->mask , cp->data , sizeof( Bits16) ) ;
memcpy( cp->mask , cp->data , sizeof( Bits16) ) ;
}
cp->hotSpot.h = hotSpotX ;
@@ -158,40 +158,40 @@ wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho
m_refData = new wxCursorRefData;
if ( flags == wxBITMAP_TYPE_MACCURSOR_RESOURCE )
{
Str255 theName ;
Str255 theName ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) theName , cursor_file ) ;
c2pstrcpy( (StringPtr) theName , cursor_file ) ;
#else
strcpy( (char *) theName , cursor_file ) ;
c2pstr( (char *) theName ) ;
strcpy( (char *) theName , cursor_file ) ;
c2pstr( (char *) theName ) ;
#endif
wxStAppResource resload ;
Handle resHandle = ::GetNamedResource( 'crsr' , theName ) ;
if ( resHandle )
{
short theId = -1 ;
OSType theType ;
GetResInfo( resHandle , &theId , &theType , theName ) ;
ReleaseResource( resHandle ) ;
M_CURSORDATA->m_hCursor = GetCCursor( theId ) ;
if ( M_CURSORDATA->m_hCursor )
M_CURSORDATA->m_isColorCursor = true ;
}
else
{
Handle resHandle = ::GetNamedResource( 'CURS' , theName ) ;
if ( resHandle )
{
short theId = -1 ;
OSType theType ;
GetResInfo( resHandle , &theId , &theType , theName ) ;
ReleaseResource( resHandle ) ;
M_CURSORDATA->m_hCursor = GetCursor( theId ) ;
if ( M_CURSORDATA->m_hCursor )
M_CURSORDATA->m_releaseHandle = true ;
}
Handle resHandle = ::GetNamedResource( 'crsr' , theName ) ;
if ( resHandle )
{
short theId = -1 ;
OSType theType ;
GetResInfo( resHandle , &theId , &theType , theName ) ;
ReleaseResource( resHandle ) ;
M_CURSORDATA->m_hCursor = GetCCursor( theId ) ;
if ( M_CURSORDATA->m_hCursor )
M_CURSORDATA->m_isColorCursor = true ;
}
else
{
Handle resHandle = ::GetNamedResource( 'CURS' , theName ) ;
if ( resHandle )
{
short theId = -1 ;
OSType theType ;
GetResInfo( resHandle , &theId , &theType , theName ) ;
ReleaseResource( resHandle ) ;
M_CURSORDATA->m_hCursor = GetCursor( theId ) ;
if ( M_CURSORDATA->m_hCursor )
M_CURSORDATA->m_releaseHandle = true ;
}
}
}
else
@@ -211,155 +211,155 @@ wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho
// Cursors by stock number
wxCursor::wxCursor(int cursor_type)
{
m_refData = new wxCursorRefData;
switch (cursor_type)
{
m_refData = new wxCursorRefData;
switch (cursor_type)
{
case wxCURSOR_WAIT:
M_CURSORDATA->m_themeCursor = kThemeWatchCursor ;
break;
M_CURSORDATA->m_themeCursor = kThemeWatchCursor ;
break;
case wxCURSOR_IBEAM:
M_CURSORDATA->m_themeCursor = kThemeIBeamCursor ;
break;
M_CURSORDATA->m_themeCursor = kThemeIBeamCursor ;
break;
case wxCURSOR_CROSS:
M_CURSORDATA->m_themeCursor = kThemeCrossCursor;
break;
M_CURSORDATA->m_themeCursor = kThemeCrossCursor;
break;
case wxCURSOR_SIZENWSE:
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNWSE);
}
break;
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNWSE);
}
break;
case wxCURSOR_SIZENESW:
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNESW);
}
break;
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNESW);
}
break;
case wxCURSOR_SIZEWE:
{
M_CURSORDATA->m_themeCursor = kThemeResizeLeftRightCursor;
}
break;
{
M_CURSORDATA->m_themeCursor = kThemeResizeLeftRightCursor;
}
break;
case wxCURSOR_SIZENS:
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNS);
}
break;
case wxCURSOR_SIZING:
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSize);
}
break;
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNS);
}
break;
case wxCURSOR_SIZING:
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSize);
}
break;
case wxCURSOR_HAND:
{
M_CURSORDATA->m_themeCursor = kThemePointingHandCursor;
}
break;
{
M_CURSORDATA->m_themeCursor = kThemePointingHandCursor;
}
break;
case wxCURSOR_BULLSEYE:
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorBullseye);
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorBullseye);
}
break;
case wxCURSOR_PENCIL:
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPencil);
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPencil);
}
break;
case wxCURSOR_MAGNIFIER:
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorMagnifier);
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorMagnifier);
}
break;
case wxCURSOR_NO_ENTRY:
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorNoEntry);
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorNoEntry);
}
break;
case wxCURSOR_WATCH:
{
M_CURSORDATA->m_themeCursor = kThemeWatchCursor;
break;
}
{
M_CURSORDATA->m_themeCursor = kThemeWatchCursor;
break;
}
case wxCURSOR_PAINT_BRUSH:
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPaintBrush);
break;
}
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPaintBrush);
break;
}
case wxCURSOR_POINT_LEFT:
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPointLeft);
break;
}
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPointLeft);
break;
}
case wxCURSOR_POINT_RIGHT:
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPointRight);
break;
}
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPointRight);
break;
}
case wxCURSOR_QUESTION_ARROW:
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorQuestionArrow);
break;
}
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorQuestionArrow);
break;
}
case wxCURSOR_BLANK:
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorBlank);
break;
}
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorBlank);
break;
}
case wxCURSOR_RIGHT_ARROW:
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorRightArrow);
break;
}
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorRightArrow);
break;
}
case wxCURSOR_SPRAYCAN:
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorRoller);
break;
}
{
wxStAppResource resload ;
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorRoller);
break;
}
case wxCURSOR_CHAR:
case wxCURSOR_ARROW:
case wxCURSOR_LEFT_BUTTON:
case wxCURSOR_RIGHT_BUTTON:
case wxCURSOR_MIDDLE_BUTTON:
default:
M_CURSORDATA->m_themeCursor = kThemeArrowCursor ;
break;
}
if ( M_CURSORDATA->m_themeCursor == -1 )
M_CURSORDATA->m_releaseHandle = true ;
default:
M_CURSORDATA->m_themeCursor = kThemeArrowCursor ;
break;
}
if ( M_CURSORDATA->m_themeCursor == -1 )
M_CURSORDATA->m_releaseHandle = true ;
}
void wxCursor::MacInstall() const
{
gMacCurrentCursor = *this ;
if ( m_refData && M_CURSORDATA->m_themeCursor != -1 )
{
SetThemeCursor( M_CURSORDATA->m_themeCursor ) ;
}
else if ( m_refData && M_CURSORDATA->m_hCursor )
{
if ( M_CURSORDATA->m_isColorCursor )
::SetCCursor( (CCrsrHandle) M_CURSORDATA->m_hCursor ) ;
else
::SetCursor( * (CursHandle) M_CURSORDATA->m_hCursor ) ;
}
else
{
SetThemeCursor( kThemeArrowCursor ) ;
}
gMacCurrentCursor = *this ;
if ( m_refData && M_CURSORDATA->m_themeCursor != -1 )
{
SetThemeCursor( M_CURSORDATA->m_themeCursor ) ;
}
else if ( m_refData && M_CURSORDATA->m_hCursor )
{
if ( M_CURSORDATA->m_isColorCursor )
::SetCCursor( (CCrsrHandle) M_CURSORDATA->m_hCursor ) ;
else
::SetCursor( * (CursHandle) M_CURSORDATA->m_hCursor ) ;
}
else
{
SetThemeCursor( kThemeArrowCursor ) ;
}
}
wxCursor::~wxCursor()
@@ -369,7 +369,7 @@ wxCursor::~wxCursor()
// Global cursor setting
void wxSetCursor(const wxCursor& cursor)
{
cursor.MacInstall() ;
cursor.MacInstall() ;
}

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -137,7 +137,7 @@ const wxChar *wxDoubleToStringStr = wxT("%.2f");
const wxEventTable *wxEvtHandler::GetEventTable() const { return &wxEvtHandler::sm_eventTable; }
const wxEventTable wxEvtHandler::sm_eventTable =
{ NULL, &wxEvtHandler::sm_eventTableEntries[0] };
{ NULL, &wxEvtHandler::sm_eventTableEntries[0] };
const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] = { { 0, 0, 0, NULL } };
#endif

View File

@@ -141,7 +141,7 @@ bool wxDataObject::IsSupportedFormat(
}
else
{
wxDataFormat* pFormats = new wxDataFormat[nFormatCount];
wxDataFormat* pFormats = new wxDataFormat[nFormatCount];
GetAllFormats( pFormats
,vDir
);
@@ -183,7 +183,7 @@ bool wxFileDataObject::GetDataHere(
size_t wxFileDataObject::GetDataSize() const
{
size_t nRes = 0;
size_t nRes = 0;
for (size_t i = 0; i < m_filenames.GetCount(); i++)
{
@@ -201,7 +201,7 @@ bool wxFileDataObject::SetData(
{
m_filenames.Empty();
wxString sFile( (const char *)pBuf); /* char, not wxChar */
wxString sFile( (const char *)pBuf); /* char, not wxChar */
AddFile(sFile);
@@ -225,15 +225,15 @@ wxBitmapDataObject::wxBitmapDataObject()
}
wxBitmapDataObject::wxBitmapDataObject(
const wxBitmap& rBitmap
const wxBitmap& rBitmap
)
: wxBitmapDataObjectBase(rBitmap)
{
Init();
if ( m_bitmap.Ok() )
{
m_pictHandle = m_bitmap.GetPict( &m_pictCreated ) ;
}
m_pictHandle = m_bitmap.GetPict( &m_pictCreated ) ;
}
}
wxBitmapDataObject::~wxBitmapDataObject()
@@ -249,23 +249,23 @@ void wxBitmapDataObject::SetBitmap(
wxBitmapDataObjectBase::SetBitmap(rBitmap);
if ( m_bitmap.Ok() )
{
m_pictHandle = m_bitmap.GetPict( &m_pictCreated ) ;
}
m_pictHandle = m_bitmap.GetPict( &m_pictCreated ) ;
}
}
void wxBitmapDataObject::Init()
{
m_pictHandle = NULL ;
m_pictCreated = false ;
m_pictHandle = NULL ;
m_pictCreated = false ;
}
void wxBitmapDataObject::Clear()
{
if ( m_pictCreated && m_pictHandle )
{
KillPicture( (PicHandle) m_pictHandle ) ;
}
m_pictHandle = NULL ;
if ( m_pictCreated && m_pictHandle )
{
KillPicture( (PicHandle) m_pictHandle ) ;
}
m_pictHandle = NULL ;
}
bool wxBitmapDataObject::GetDataHere(
@@ -283,7 +283,7 @@ bool wxBitmapDataObject::GetDataHere(
size_t wxBitmapDataObject::GetDataSize() const
{
return GetHandleSize((Handle)m_pictHandle) ;
return GetHandleSize((Handle)m_pictHandle) ;
}
bool wxBitmapDataObject::SetData(
@@ -299,7 +299,7 @@ bool wxBitmapDataObject::SetData(
Rect frame = (**picHandle).picFrame ;
m_bitmap.SetPict( picHandle ) ;
m_bitmap.SetWidth( frame.right - frame.left ) ;
m_bitmap.SetHeight( frame.bottom - frame.top ) ;
m_bitmap.SetWidth( frame.right - frame.left ) ;
m_bitmap.SetHeight( frame.bottom - frame.top ) ;
return m_bitmap.Ok();
}

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,7 @@
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -49,24 +49,24 @@ wxWindowDC::wxWindowDC()
wxWindowDC::wxWindowDC(wxWindow *the_canvas)
{
wxTopLevelWindowMac* rootwindow = the_canvas->MacGetTopLevelWindow() ;
WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
int x , y ;
x = y = 0 ;
the_canvas->MacWindowToRootWindow( &x , &y ) ;
m_macLocalOrigin.x = x ;
m_macLocalOrigin.y = y ;
CopyRgn( (RgnHandle) the_canvas->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
m_macPort = UMAGetWindowPort( windowref ) ;
m_minY = m_minX = 0;
wxSize size = the_canvas->GetSize() ;
m_maxX = size.x ;
m_maxY = size.y ;
wxTopLevelWindowMac* rootwindow = the_canvas->MacGetTopLevelWindow() ;
WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
int x , y ;
x = y = 0 ;
the_canvas->MacWindowToRootWindow( &x , &y ) ;
m_macLocalOrigin.x = x ;
m_macLocalOrigin.y = y ;
CopyRgn( (RgnHandle) the_canvas->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
m_macPort = UMAGetWindowPort( windowref ) ;
m_minY = m_minX = 0;
wxSize size = the_canvas->GetSize() ;
m_maxX = size.x ;
m_maxY = size.y ;
m_ok = TRUE ;
m_ok = TRUE ;
SetBackground(the_canvas->MacGetBackgroundBrush());
}
@@ -84,30 +84,30 @@ wxClientDC::wxClientDC()
wxClientDC::wxClientDC(wxWindow *window)
{
wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
if (!rootwindow)
return;
WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
wxPoint origin = window->GetClientAreaOrigin() ;
wxSize size = window->GetClientSize() ;
int x , y ;
x = origin.x ;
y = origin.y ;
window->MacWindowToRootWindow( &x , &y ) ;
m_macLocalOrigin.x = x ;
m_macLocalOrigin.y = y ;
SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
CopyRgn( (RgnHandle) m_macBoundaryClipRgn ,(RgnHandle) m_macCurrentClipRgn ) ;
m_macPort = UMAGetWindowPort( windowref ) ;
m_minY = m_minX = 0;
m_maxX = size.x ;
m_maxY = size.y ;
m_ok = TRUE ;
SetBackground(window->MacGetBackgroundBrush());
SetFont( window->GetFont() ) ;
wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
if (!rootwindow)
return;
WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
wxPoint origin = window->GetClientAreaOrigin() ;
wxSize size = window->GetClientSize() ;
int x , y ;
x = origin.x ;
y = origin.y ;
window->MacWindowToRootWindow( &x , &y ) ;
m_macLocalOrigin.x = x ;
m_macLocalOrigin.y = y ;
SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
CopyRgn( (RgnHandle) m_macBoundaryClipRgn ,(RgnHandle) m_macCurrentClipRgn ) ;
m_macPort = UMAGetWindowPort( windowref ) ;
m_minY = m_minX = 0;
m_maxX = size.x ;
m_maxY = size.y ;
m_ok = TRUE ;
SetBackground(window->MacGetBackgroundBrush());
SetFont( window->GetFont() ) ;
}
wxClientDC::~wxClientDC()
@@ -124,29 +124,29 @@ wxPaintDC::wxPaintDC()
wxPaintDC::wxPaintDC(wxWindow *window)
{
wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
wxPoint origin = window->GetClientAreaOrigin() ;
wxSize size = window->GetClientSize() ;
int x , y ;
x = origin.x ;
y = origin.y ;
window->MacWindowToRootWindow( &x , &y ) ;
m_macLocalOrigin.x = x ;
m_macLocalOrigin.y = y ;
SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->GetUpdateRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
m_macPort = UMAGetWindowPort( windowref ) ;
m_minY = m_minX = 0;
m_maxX = size.x ;
m_maxY = size.y ;
m_ok = TRUE ;
SetBackground(window->MacGetBackgroundBrush());
SetFont( window->GetFont() ) ;
wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
wxPoint origin = window->GetClientAreaOrigin() ;
wxSize size = window->GetClientSize() ;
int x , y ;
x = origin.x ;
y = origin.y ;
window->MacWindowToRootWindow( &x , &y ) ;
m_macLocalOrigin.x = x ;
m_macLocalOrigin.y = y ;
SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->GetUpdateRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
m_macPort = UMAGetWindowPort( windowref ) ;
m_minY = m_minX = 0;
m_maxX = size.x ;
m_maxY = size.y ;
m_ok = TRUE ;
SetBackground(window->MacGetBackgroundBrush());
SetFont( window->GetFont() ) ;
}
wxPaintDC::~wxPaintDC()

View File

@@ -6,7 +6,7 @@
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -23,78 +23,78 @@
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxPaintDC)
wxMemoryDC::wxMemoryDC(void)
: m_selected()
: m_selected()
{
m_ok = TRUE;
m_ok = TRUE;
SetBackground(*wxWHITE_BRUSH);
SetBrush(*wxWHITE_BRUSH);
SetPen(*wxBLACK_PEN);
m_ok = FALSE;
m_ok = FALSE;
};
wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
: m_selected()
: m_selected()
{
m_ok = TRUE;
m_ok = TRUE;
SetBackground(*wxWHITE_BRUSH);
SetBrush(*wxWHITE_BRUSH);
SetPen(*wxBLACK_PEN);
m_ok = FALSE;
m_ok = FALSE;
};
wxMemoryDC::~wxMemoryDC()
{
if ( m_selected.Ok() )
{
UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected.GetHBITMAP())) );
}
if ( m_selected.Ok() )
{
UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected.GetHBITMAP())) );
}
};
void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
{
if ( m_selected.Ok() )
{
UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected.GetHBITMAP())) );
}
if ( m_selected.Ok() )
{
UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected.GetHBITMAP())) );
}
m_selected = bitmap;
if (m_selected.Ok())
{
if ( m_selected.GetHBITMAP() )
{
m_macPort = (GrafPtr) m_selected.GetHBITMAP() ;
LockPixels( GetGWorldPixMap( (CGrafPtr) m_macPort ) ) ;
wxMask * mask = bitmap.GetMask() ;
if ( mask )
{
m_macMask = mask->GetMaskBitmap() ;
}
SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , 0 , 0 , m_selected.GetWidth() , m_selected.GetHeight() ) ;
CopyRgn( (RgnHandle) m_macBoundaryClipRgn ,(RgnHandle) m_macCurrentClipRgn ) ;
m_ok = TRUE ;
}
else
{
m_ok = FALSE;
}
}
else
{
m_ok = FALSE;
}
if ( m_selected.GetHBITMAP() )
{
m_macPort = (GrafPtr) m_selected.GetHBITMAP() ;
LockPixels( GetGWorldPixMap( (CGrafPtr) m_macPort ) ) ;
wxMask * mask = bitmap.GetMask() ;
if ( mask )
{
m_macMask = mask->GetMaskBitmap() ;
}
SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , 0 , 0 , m_selected.GetWidth() , m_selected.GetHeight() ) ;
CopyRgn( (RgnHandle) m_macBoundaryClipRgn ,(RgnHandle) m_macCurrentClipRgn ) ;
m_ok = TRUE ;
}
else
{
m_ok = FALSE;
}
}
else
{
m_ok = FALSE;
}
}
void wxMemoryDC::DoGetSize( int *width, int *height ) const
{
if (m_selected.Ok())
{
if (width) (*width) = m_selected.GetWidth();
if (height) (*height) = m_selected.GetHeight();
}
else
{
if (width) (*width) = 0;
if (height) (*height) = 0;
}
if (m_selected.Ok())
{
if (width) (*width) = m_selected.GetWidth();
if (height) (*height) = m_selected.GetHeight();
}
else
{
if (width) (*width) = 0;
if (height) (*height) = 0;
}
}

View File

@@ -6,7 +6,7 @@
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -46,172 +46,172 @@ GrafPtr macPrintFormerPort = NULL ;
wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
{
OSStatus err ;
wxString message ;
m_printData = printdata ;
m_printData.ConvertToNative() ;
OSStatus err ;
wxString message ;
m_printData = printdata ;
m_printData.ConvertToNative() ;
#if TARGET_CARBON && PM_USE_SESSION_APIS
err = UMAPrOpen(&m_macPrintSessionPort) ;
if ( err != noErr || m_macPrintSessionPort == kPMNoData )
err = UMAPrOpen(&m_macPrintSessionPort) ;
if ( err != noErr || m_macPrintSessionPort == kPMNoData )
#else
err = UMAPrOpen(NULL) ;
if ( err != noErr )
err = UMAPrOpen(NULL) ;
if ( err != noErr )
#endif
{
message.Printf( "Print Error %ld", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
{
message.Printf( "Print Error %ld", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
#if TARGET_CARBON && PM_USE_SESSION_APIS
UMAPrClose(&m_macPrintSessionPort) ;
UMAPrClose(&m_macPrintSessionPort) ;
#else
UMAPrClose(NULL) ;
UMAPrClose(NULL) ;
#endif
m_ok = FALSE;
return;
}
m_ok = FALSE;
return;
}
#if !TARGET_CARBON
if ( ::PrValidate( (THPrint) m_printData.m_macPrintSettings ) )
{
::PrStlDialog( (THPrint) m_printData.m_macPrintSettings ) ;
// the driver has changed in the mean time, should we pop up a page setup dialog ?
}
err = PrError() ;
if ( err != noErr )
{
message.Printf( "Print Error %ld", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
UMAPrClose(NULL) ;
m_ok = FALSE;
return;
}
::GetPort( &macPrintFormerPort ) ;
m_macPrintSessionPort = ::PrOpenDoc( (THPrint) m_printData.m_macPrintSettings , NULL , NULL ) ;
err = PrError() ;
if ( err )
{
message.Printf( "Print Error %ld", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
UMAPrClose(NULL) ;
m_ok = FALSE;
return;
}
// sets current port
m_macPort = (GrafPtr ) m_macPrintSessionPort ;
if ( ::PrValidate( (THPrint) m_printData.m_macPrintSettings ) )
{
::PrStlDialog( (THPrint) m_printData.m_macPrintSettings ) ;
// the driver has changed in the mean time, should we pop up a page setup dialog ?
}
err = PrError() ;
if ( err != noErr )
{
message.Printf( "Print Error %ld", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
UMAPrClose(NULL) ;
m_ok = FALSE;
return;
}
::GetPort( &macPrintFormerPort ) ;
m_macPrintSessionPort = ::PrOpenDoc( (THPrint) m_printData.m_macPrintSettings , NULL , NULL ) ;
err = PrError() ;
if ( err )
{
message.Printf( "Print Error %ld", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
UMAPrClose(NULL) ;
m_ok = FALSE;
return;
}
// sets current port
m_macPort = (GrafPtr ) m_macPrintSessionPort ;
#else
#if PM_USE_SESSION_APIS
err = PMSessionBeginDocument((PMPrintSession)m_macPrintSessionPort,
(PMPrintSettings)m_printData.m_macPrintSettings,
(PMPageFormat)m_printData.m_macPageFormat);
(PMPageFormat)m_printData.m_macPageFormat);
if ( err != noErr )
#else
m_macPrintSessionPort = kPMNoReference ;
m_macPrintSessionPort = kPMNoReference ;
err = PMBeginDocument(
m_printData.m_macPrintSettings,
m_printData.m_macPageFormat,
&m_macPrintSessionPort);
m_printData.m_macPrintSettings,
m_printData.m_macPageFormat,
&m_macPrintSessionPort);
if ( err != noErr || m_macPrintSessionPort == kPMNoReference )
#endif
{
message.Printf( "Print Error %ld", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
message.Printf( "Print Error %ld", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
#if TARGET_CARBON && PM_USE_SESSION_APIS
UMAPrClose(&m_macPrintSessionPort) ;
UMAPrClose(&m_macPrintSessionPort) ;
#else
UMAPrClose(NULL) ;
UMAPrClose(NULL) ;
#endif
m_ok = FALSE;
return;
m_ok = FALSE;
return;
}
// sets current port
::GetPort( (GrafPtr *)&m_macPort ) ;
// sets current port
::GetPort( (GrafPtr *)&m_macPort ) ;
#endif
m_ok = TRUE ;
m_minY = m_minX = 0 ;
m_ok = TRUE ;
m_minY = m_minX = 0 ;
#if TARGET_CARBON
PMRect rPaper;
err = PMGetAdjustedPaperRect((PMPageFormat)m_printData.m_macPageFormat, &rPaper);
PMRect rPaper;
err = PMGetAdjustedPaperRect((PMPageFormat)m_printData.m_macPageFormat, &rPaper);
if ( err != noErr )
{
message.Printf( "Print Error %ld", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
message.Printf( "Print Error %ld", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
#if TARGET_CARBON && PM_USE_SESSION_APIS
UMAPrClose(&m_macPrintSessionPort) ;
UMAPrClose(&m_macPrintSessionPort) ;
#else
UMAPrClose(NULL) ;
UMAPrClose(NULL) ;
#endif
m_ok = FALSE;
return;
m_ok = FALSE;
return;
}
m_maxX = wxCoord(rPaper.right - rPaper.left) ;
m_maxY = wxCoord(rPaper.bottom - rPaper.top);
m_maxX = wxCoord(rPaper.right - rPaper.left) ;
m_maxY = wxCoord(rPaper.bottom - rPaper.top);
#else
m_maxX = (**(THPrint)m_printData.m_macPrintSettings).rPaper.right - (**(THPrint)m_printData.m_macPrintSettings).rPaper.left ;
m_maxY = (**(THPrint)m_printData.m_macPrintSettings).rPaper.bottom - (**(THPrint)m_printData.m_macPrintSettings).rPaper.top ;
m_maxX = (**(THPrint)m_printData.m_macPrintSettings).rPaper.right - (**(THPrint)m_printData.m_macPrintSettings).rPaper.left ;
m_maxY = (**(THPrint)m_printData.m_macPrintSettings).rPaper.bottom - (**(THPrint)m_printData.m_macPrintSettings).rPaper.top ;
#endif
}
wxPrinterDC::~wxPrinterDC(void)
{
OSStatus err ;
wxString message ;
OSStatus err ;
wxString message ;
#if !TARGET_CARBON
if ( m_ok )
{
::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ;
err = PrError() ;
if ( err == noErr )
{
if ( (**(THPrint)m_printData.m_macPrintSettings).prJob.bJDocLoop == bSpoolLoop )
{
TPrStatus status ;
::PrPicFile( (THPrint) m_printData.m_macPrintSettings , NULL , NULL , NULL , &status ) ;
}
}
else
{
message.Printf( "Print Error %ld", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
}
::UMAPrClose(NULL) ;
// ::SetPort( macPrintFormerPort ) ;
::SetPort( LMGetWMgrPort() ) ;
}
if ( m_ok )
{
::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ;
err = PrError() ;
if ( err == noErr )
{
if ( (**(THPrint)m_printData.m_macPrintSettings).prJob.bJDocLoop == bSpoolLoop )
{
TPrStatus status ;
::PrPicFile( (THPrint) m_printData.m_macPrintSettings , NULL , NULL , NULL , &status ) ;
}
}
else
{
message.Printf( "Print Error %ld", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
}
::UMAPrClose(NULL) ;
// ::SetPort( macPrintFormerPort ) ;
::SetPort( LMGetWMgrPort() ) ;
}
#else
if ( m_ok )
{
if ( m_ok )
{
#if PM_USE_SESSION_APIS
err = PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
err = PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
#else
err = PMEndDocument(m_macPrintSessionPort);
err = PMEndDocument(m_macPrintSessionPort);
#endif
if ( err != noErr )
{
message.Printf( "Print Error %ld", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
}
if ( err != noErr )
{
message.Printf( "Print Error %ld", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
}
#if TARGET_CARBON && PM_USE_SESSION_APIS
UMAPrClose(&m_macPrintSessionPort) ;
UMAPrClose(&m_macPrintSessionPort) ;
#else
UMAPrClose(NULL) ;
UMAPrClose(NULL) ;
#endif
}
}
#endif
}
bool wxPrinterDC::StartDoc( const wxString& WXUNUSED(message) )
{
return m_ok ;
return m_ok ;
}
void wxPrinterDC::EndDoc(void)
@@ -220,117 +220,117 @@ void wxPrinterDC::EndDoc(void)
void wxPrinterDC::StartPage(void)
{
if ( !m_ok )
return ;
if ( !m_ok )
return ;
m_logicalFunction = wxCOPY;
m_logicalFunction = wxCOPY;
// m_textAlignment = wxALIGN_TOP_LEFT;
m_backgroundMode = wxTRANSPARENT;
m_backgroundMode = wxTRANSPARENT;
m_textForegroundColour = *wxBLACK;
m_textBackgroundColour = *wxWHITE;
m_pen = *wxBLACK_PEN;
m_font = *wxNORMAL_FONT;
m_brush = *wxTRANSPARENT_BRUSH;
m_backgroundBrush = *wxWHITE_BRUSH;
m_textForegroundColour = *wxBLACK;
m_textBackgroundColour = *wxWHITE;
m_pen = *wxBLACK_PEN;
m_font = *wxNORMAL_FONT;
m_brush = *wxTRANSPARENT_BRUSH;
m_backgroundBrush = *wxWHITE_BRUSH;
m_macFontInstalled = false ;
m_macBrushInstalled = false ;
m_macPenInstalled = false ;
m_macFontInstalled = false ;
m_macBrushInstalled = false ;
m_macPenInstalled = false ;
OSStatus err ;
wxString message ;
OSStatus err ;
wxString message ;
#if !TARGET_CARBON
PrOpenPage( (TPPrPort) m_macPrintSessionPort , NULL ) ;
m_macLocalOrigin.x = (**(THPrint)m_printData.m_macPrintSettings).rPaper.left ;
m_macLocalOrigin.y = (**(THPrint)m_printData.m_macPrintSettings).rPaper.top ;
Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
::ClipRect( &clip ) ;
err = PrError() ;
if ( err != noErr )
{
message.Printf( "Print Error %ld", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
::PrClosePage( (TPPrPort) m_macPrintSessionPort ) ;
::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ;
::UMAPrClose(NULL) ;
::SetPort( macPrintFormerPort ) ;
m_ok = FALSE ;
}
PrOpenPage( (TPPrPort) m_macPrintSessionPort , NULL ) ;
m_macLocalOrigin.x = (**(THPrint)m_printData.m_macPrintSettings).rPaper.left ;
m_macLocalOrigin.y = (**(THPrint)m_printData.m_macPrintSettings).rPaper.top ;
Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
::ClipRect( &clip ) ;
err = PrError() ;
if ( err != noErr )
{
message.Printf( "Print Error %ld", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
::PrClosePage( (TPPrPort) m_macPrintSessionPort ) ;
::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ;
::UMAPrClose(NULL) ;
::SetPort( macPrintFormerPort ) ;
m_ok = FALSE ;
}
#else
#if PM_USE_SESSION_APIS
err = PMSessionBeginPage((PMPrintSession)m_macPrintSessionPort,
(PMPageFormat)m_printData.m_macPageFormat,
nil);
err = PMSessionBeginPage((PMPrintSession)m_macPrintSessionPort,
(PMPageFormat)m_printData.m_macPageFormat,
nil);
#else
err = PMBeginPage(m_macPrintSessionPort, nil);
err = PMBeginPage(m_macPrintSessionPort, nil);
#endif
if ( err != noErr )
{
message.Printf( "Print Error %ld", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
if ( err != noErr )
{
message.Printf( "Print Error %ld", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
#if PM_USE_SESSION_APIS
PMSessionEndPage((PMPrintSession)m_macPrintSessionPort);
PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
UMAPrClose(&m_macPrintSessionPort) ;
PMSessionEndPage((PMPrintSession)m_macPrintSessionPort);
PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
UMAPrClose(&m_macPrintSessionPort) ;
#else
PMEndPage(m_macPrintSessionPort);
PMEndDocument(m_macPrintSessionPort);
UMAPrClose(NULL) ;
PMEndPage(m_macPrintSessionPort);
PMEndDocument(m_macPrintSessionPort);
UMAPrClose(NULL) ;
#endif
::SetPort( macPrintFormerPort ) ;
m_ok = FALSE ;
}
::SetPort( macPrintFormerPort ) ;
m_ok = FALSE ;
}
#endif
}
void wxPrinterDC::EndPage(void)
{
if ( !m_ok )
return ;
if ( !m_ok )
return ;
OSStatus err ;
wxString message ;
OSStatus err ;
wxString message ;
#if !TARGET_CARBON
PrClosePage( (TPPrPort) m_macPort ) ;
err = PrError() ;
if ( err != noErr )
{
message.Printf( "Print Error %ld", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ;
::UMAPrClose(NULL) ;
::SetPort( macPrintFormerPort ) ;
m_ok = FALSE ;
}
PrClosePage( (TPPrPort) m_macPort ) ;
err = PrError() ;
if ( err != noErr )
{
message.Printf( "Print Error %ld", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ;
::UMAPrClose(NULL) ;
::SetPort( macPrintFormerPort ) ;
m_ok = FALSE ;
}
#else
#if PM_USE_SESSION_APIS
err = PMSessionEndPage((PMPrintSession)m_macPrintSessionPort);
err = PMSessionEndPage((PMPrintSession)m_macPrintSessionPort);
#else
err = PMEndPage(m_macPrintSessionPort);
err = PMEndPage(m_macPrintSessionPort);
#endif
if ( err != noErr )
{
message.Printf( "Print Error %ld", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
if ( err != noErr )
{
message.Printf( "Print Error %ld", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
#if PM_USE_SESSION_APIS
PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
UMAPrClose(&m_macPrintSessionPort) ;
PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
UMAPrClose(&m_macPrintSessionPort) ;
#else
PMEndDocument(m_macPrintSessionPort);
UMAPrClose(NULL) ;
PMEndDocument(m_macPrintSessionPort);
UMAPrClose(NULL) ;
#endif
::SetPort( macPrintFormerPort ) ;
m_ok = FALSE ;
}
::SetPort( macPrintFormerPort ) ;
m_ok = FALSE ;
}
#endif
}

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -24,36 +24,36 @@ IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
wxScreenDC::wxScreenDC()
{
#if TARGET_CARBON
m_macPort = GetQDGlobalsThePort() ;
GrafPtr port ;
GetPort( &port ) ;
SetPort( (GrafPtr) m_macPort ) ;
Point pt = { 0,0 } ;
LocalToGlobal( &pt ) ;
SetPort( port ) ;
m_macLocalOrigin.x = -pt.h ;
m_macLocalOrigin.y = -pt.v ;
m_macPort = GetQDGlobalsThePort() ;
GrafPtr port ;
GetPort( &port ) ;
SetPort( (GrafPtr) m_macPort ) ;
Point pt = { 0,0 } ;
LocalToGlobal( &pt ) ;
SetPort( port ) ;
m_macLocalOrigin.x = -pt.h ;
m_macLocalOrigin.y = -pt.v ;
#else
m_macPort = LMGetWMgrPort() ;
m_macLocalOrigin.x = 0 ;
m_macLocalOrigin.y = 0 ;
m_macPort = LMGetWMgrPort() ;
m_macLocalOrigin.x = 0 ;
m_macLocalOrigin.y = 0 ;
#endif
m_ok = TRUE ;
BitMap screenBits;
GetQDGlobalsScreenBits( &screenBits );
m_minX = screenBits.bounds.left ;
m_ok = TRUE ;
BitMap screenBits;
GetQDGlobalsScreenBits( &screenBits );
m_minX = screenBits.bounds.left ;
#if TARGET_CARBON
SInt16 height ;
GetThemeMenuBarHeight( &height ) ;
m_minY = screenBits.bounds.top + height ;
SInt16 height ;
GetThemeMenuBarHeight( &height ) ;
m_minY = screenBits.bounds.top + height ;
#else
m_minY = screenBits.bounds.top + LMGetMBarHeight() ;
m_minY = screenBits.bounds.top + LMGetMBarHeight() ;
#endif
m_maxX = screenBits.bounds.right ;
m_maxY = screenBits.bounds.bottom ;
MacSetRectRgn( (RgnHandle) m_macBoundaryClipRgn , m_minX , m_minY , m_maxX , m_maxY ) ;
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
m_maxX = screenBits.bounds.right ;
m_maxY = screenBits.bounds.bottom ;
MacSetRectRgn( (RgnHandle) m_macBoundaryClipRgn , m_minX , m_minY , m_maxX , m_maxY ) ;
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
}
wxScreenDC::~wxScreenDC()

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -46,7 +46,7 @@ END_EVENT_TABLE()
wxDialog::wxDialog()
{
m_isShown = FALSE;
m_isShown = FALSE;
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
}
@@ -57,60 +57,59 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
long style,
const wxString& name)
{
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
return FALSE;
MacCreateRealWindow( title , pos , size , MacRemoveBordersFromStyle(style) , name ) ;
m_macWindowBackgroundTheme = kThemeBrushDialogBackgroundActive ;
SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
MacCreateRealWindow( title , pos , size , MacRemoveBordersFromStyle(style) , name ) ;
m_macWindowBackgroundTheme = kThemeBrushDialogBackgroundActive ;
SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
return TRUE;
return TRUE;
}
void wxDialog::SetModal(bool flag)
{
if ( flag )
if ( flag )
{
m_windowStyle |= wxDIALOG_MODAL;
wxModelessWindows.DeleteObject(this);
}
else
{
m_windowStyle &= ~wxDIALOG_MODAL;
wxModelessWindows.Append(this);
}
}
wxDialog::~wxDialog()
{
m_isBeingDeleted = TRUE ;
Show(FALSE);
m_isBeingDeleted = TRUE ;
Show(FALSE);
}
// By default, pressing escape cancels the dialog , on mac command-stop does the same thing
void wxDialog::OnCharHook(wxKeyEvent& event)
{
if (
( event.m_keyCode == WXK_ESCAPE ||
( event.m_keyCode == '.' && event.MetaDown() ) )
&& FindWindow(wxID_CANCEL) )
{
// Behaviour changed in 2.0: we'll send a Cancel message
// to the dialog instead of Close.
wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
cancelEvent.SetEventObject( this );
GetEventHandler()->ProcessEvent(cancelEvent);
return;
}
// We didn't process this event.
event.Skip();
if (( event.m_keyCode == WXK_ESCAPE ||
( event.m_keyCode == '.' && event.MetaDown() ) )
&& FindWindow(wxID_CANCEL) )
{
// Behaviour changed in 2.0: we'll send a Cancel message
// to the dialog instead of Close.
wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
cancelEvent.SetEventObject( this );
GetEventHandler()->ProcessEvent(cancelEvent);
return;
}
// We didn't process this event.
event.Skip();
}
bool wxDialog::IsModal() const
@@ -165,7 +164,7 @@ void wxDialog::DoShowModal()
wxModalDialogs.Append(this);
wxWindow *parent = GetParent();
wxWindow *parent = GetParent();
// remember where the focus was
wxWindow *winFocus = FindFocus();
@@ -178,23 +177,23 @@ void wxDialog::DoShowModal()
winFocus = wxTheApp->GetTopWindow();
}
#if TARGET_CARBON
BeginAppModalStateForWindow( (WindowRef) MacGetWindowRef()) ;
BeginAppModalStateForWindow( (WindowRef) MacGetWindowRef()) ;
#else
// TODO : test whether parent gets disabled
bool formerModal = s_macIsInModalLoop ;
s_macIsInModalLoop = true ;
// TODO : test whether parent gets disabled
bool formerModal = s_macIsInModalLoop ;
s_macIsInModalLoop = true ;
#endif
while ( IsModalShowing() )
{
wxTheApp->MacDoOneEvent() ;
// calls process idle itself
}
while ( IsModalShowing() )
{
wxTheApp->MacDoOneEvent() ;
// calls process idle itself
}
#if TARGET_CARBON
EndAppModalStateForWindow( (WindowRef) MacGetWindowRef() ) ;
EndAppModalStateForWindow( (WindowRef) MacGetWindowRef() ) ;
#else
// TODO probably reenable the parent window if any
s_macIsInModalLoop = formerModal ;
s_macIsInModalLoop = formerModal ;
#endif
@@ -209,13 +208,13 @@ void wxDialog::DoShowModal()
// Replacement for Show(TRUE) for modal dialogs - returns return code
int wxDialog::ShowModal()
{
if ( !IsModal() )
{
SetModal(TRUE);
}
if ( !IsModal() )
{
SetModal(TRUE);
}
Show(TRUE);
return GetReturnCode();
Show(TRUE);
return GetReturnCode();
}
// NB: this function (surprizingly) may be called for both modal and modeless

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -40,107 +40,107 @@ wxDirDialog::wxDirDialog(wxWindow *parent,
const wxSize& WXUNUSED(size),
const wxString& WXUNUSED(name))
{
wxASSERT_MSG( NavServicesAvailable() , "Navigation Services are not running" ) ;
wxASSERT_MSG( NavServicesAvailable() , "Navigation Services are not running" ) ;
m_message = message;
m_dialogStyle = style;
m_parent = parent;
m_path = defaultPath;
m_path = defaultPath;
}
int wxDirDialog::ShowModal()
{
NavDialogOptions mNavOptions;
NavObjectFilterUPP mNavFilterUPP = NULL;
NavPreviewUPP mNavPreviewUPP = NULL ;
NavReplyRecord mNavReply;
AEDesc* mDefaultLocation = NULL ;
bool mSelectDefault = false ;
::NavGetDefaultDialogOptions(&mNavOptions);
NavDialogOptions mNavOptions;
NavObjectFilterUPP mNavFilterUPP = NULL;
NavPreviewUPP mNavPreviewUPP = NULL ;
NavReplyRecord mNavReply;
AEDesc* mDefaultLocation = NULL ;
bool mSelectDefault = false ;
::NavGetDefaultDialogOptions(&mNavOptions);
mNavFilterUPP = nil;
mNavPreviewUPP = nil;
mSelectDefault = false;
mNavReply.validRecord = false;
mNavReply.replacing = false;
mNavReply.isStationery = false;
mNavReply.translationNeeded = false;
mNavReply.selection.descriptorType = typeNull;
mNavReply.selection.dataHandle = nil;
mNavReply.keyScript = smSystemScript;
mNavReply.fileTranslation = nil;
// Set default location, the location
// that's displayed when the dialog
// first appears
if ( mDefaultLocation ) {
if (mSelectDefault) {
mNavOptions.dialogOptionFlags |= kNavSelectDefaultLocation;
} else {
mNavOptions.dialogOptionFlags &= ~kNavSelectDefaultLocation;
}
}
OSErr err = ::NavChooseFolder(
mDefaultLocation,
&mNavReply,
&mNavOptions,
NULL,
mNavFilterUPP,
0L); // User Data
if ( (err != noErr) && (err != userCanceledErr) ) {
m_path = "" ;
return wxID_CANCEL ;
}
mNavFilterUPP = nil;
mNavPreviewUPP = nil;
mSelectDefault = false;
mNavReply.validRecord = false;
mNavReply.replacing = false;
mNavReply.isStationery = false;
mNavReply.translationNeeded = false;
mNavReply.selection.descriptorType = typeNull;
mNavReply.selection.dataHandle = nil;
mNavReply.keyScript = smSystemScript;
mNavReply.fileTranslation = nil;
// Set default location, the location
// that's displayed when the dialog
// first appears
if ( mDefaultLocation ) {
if (mSelectDefault) {
mNavOptions.dialogOptionFlags |= kNavSelectDefaultLocation;
} else {
mNavOptions.dialogOptionFlags &= ~kNavSelectDefaultLocation;
}
}
OSErr err = ::NavChooseFolder(
mDefaultLocation,
&mNavReply,
&mNavOptions,
NULL,
mNavFilterUPP,
0L); // User Data
if ( (err != noErr) && (err != userCanceledErr) ) {
m_path = "" ;
return wxID_CANCEL ;
}
if (mNavReply.validRecord) { // User chose a folder
FSSpec folderInfo;
FSSpec outFileSpec ;
AEDesc specDesc ;
OSErr err = ::AECoerceDesc( &mNavReply.selection , typeFSS, &specDesc);
if ( err != noErr ) {
m_path = "" ;
return wxID_CANCEL ;
}
folderInfo = **(FSSpec**) specDesc.dataHandle;
if (specDesc.dataHandle != nil) {
::AEDisposeDesc(&specDesc);
}
if (mNavReply.validRecord) { // User chose a folder
FSSpec folderInfo;
FSSpec outFileSpec ;
AEDesc specDesc ;
OSErr err = ::AECoerceDesc( &mNavReply.selection , typeFSS, &specDesc);
if ( err != noErr ) {
m_path = "" ;
return wxID_CANCEL ;
}
folderInfo = **(FSSpec**) specDesc.dataHandle;
if (specDesc.dataHandle != nil) {
::AEDisposeDesc(&specDesc);
}
// mNavReply.GetFileSpec(folderInfo);
// The FSSpec from NavChooseFolder is NOT the file spec
// for the folder. The parID field is actually the DirID
// of the folder itself, not the folder's parent, and
// the name field is empty. We must call PBGetCatInfo
// to get the parent DirID and folder name
Str255 name;
CInfoPBRec thePB; // Directory Info Parameter Block
thePB.dirInfo.ioCompletion = nil;
thePB.dirInfo.ioVRefNum = folderInfo.vRefNum; // Volume is right
thePB.dirInfo.ioDrDirID = folderInfo.parID; // Folder's DirID
thePB.dirInfo.ioNamePtr = name;
thePB.dirInfo.ioFDirIndex = -1; // Lookup using Volume and DirID
err = ::PBGetCatInfoSync(&thePB);
if ( err != noErr ) {
m_path = "" ;
return wxID_CANCEL ;
}
// Create cannonical FSSpec
::FSMakeFSSpec(thePB.dirInfo.ioVRefNum, thePB.dirInfo.ioDrParID,
name, &outFileSpec);
// outFolderDirID = thePB.dirInfo.ioDrDirID;
m_path = wxMacFSSpec2MacFilename( &outFileSpec ) ;
return wxID_OK ;
}
return wxID_CANCEL;
// mNavReply.GetFileSpec(folderInfo);
// The FSSpec from NavChooseFolder is NOT the file spec
// for the folder. The parID field is actually the DirID
// of the folder itself, not the folder's parent, and
// the name field is empty. We must call PBGetCatInfo
// to get the parent DirID and folder name
Str255 name;
CInfoPBRec thePB; // Directory Info Parameter Block
thePB.dirInfo.ioCompletion = nil;
thePB.dirInfo.ioVRefNum = folderInfo.vRefNum; // Volume is right
thePB.dirInfo.ioDrDirID = folderInfo.parID; // Folder's DirID
thePB.dirInfo.ioNamePtr = name;
thePB.dirInfo.ioFDirIndex = -1; // Lookup using Volume and DirID
err = ::PBGetCatInfoSync(&thePB);
if ( err != noErr ) {
m_path = "" ;
return wxID_CANCEL ;
}
// Create cannonical FSSpec
::FSMakeFSSpec(thePB.dirInfo.ioVRefNum, thePB.dirInfo.ioDrParID,
name, &outFileSpec);
// outFolderDirID = thePB.dirInfo.ioDrDirID;
m_path = wxMacFSSpec2MacFilename( &outFileSpec ) ;
return wxID_OK ;
}
return wxID_CANCEL;
}

View File

@@ -83,11 +83,11 @@ public:
const wxString& GetName() const { return m_dirname; }
private:
CInfoPBRec m_CPB ;
wxInt16 m_index ;
long m_dirId ;
Str255 m_name ;
Boolean m_isDir ;
CInfoPBRec m_CPB ;
wxInt16 m_index ;
long m_dirId ;
Str255 m_name ;
Boolean m_isDir ;
wxString m_dirname;
wxString m_filespec;
@@ -145,26 +145,26 @@ wxDirData::~wxDirData()
void wxDirData::Rewind()
{
m_index = 0 ;
m_index = 0 ;
}
bool wxDirData::Read(wxString *filename)
{
if ( !m_isDir )
return FALSE ;
#if TARGET_CARBON
char c_name[256] ;
char c_name[256] ;
#endif
wxString result;
short err = noErr ;
while ( err == noErr )
{
m_index++ ;
m_CPB.dirInfo.ioFDirIndex = m_index;
m_CPB.dirInfo.ioDrDirID = m_dirId; /* we need to do this every time */
m_CPB.dirInfo.ioDrDirID = m_dirId; /* we need to do this every time */
err = PBGetCatInfoSync((CInfoPBPtr)&m_CPB);
if ( err != noErr )
break ;
@@ -270,12 +270,12 @@ wxString wxDir::GetName() const
wxString name;
if ( m_data )
{
name = M_DIR->GetName();
if ( !name.empty() && (name.Last() == _T('/')) )
{
// chop off the last (back)slash
name.Truncate(name.length() - 1);
}
name = M_DIR->GetName();
if ( !name.empty() && (name.Last() == _T('/')) )
{
// chop off the last (back)slash
name.Truncate(name.length() - 1);
}
}
return name;

View File

@@ -44,7 +44,7 @@
class wxDisplayMacPriv
{
public:
GDHandle m_hndl;
GDHandle m_hndl;
};
size_t wxDisplayBase::GetCount()

View File

@@ -82,47 +82,47 @@ bool wxDropTarget::CurrentDragHasSupportedFormat()
bool supported = false ;
if ( gTrackingGlobals.m_currentSource != NULL )
{
wxDataObject* data = gTrackingGlobals.m_currentSource->GetDataObject() ;
if ( data )
{
size_t formatcount = data->GetFormatCount() ;
wxDataFormat *array = new wxDataFormat[ formatcount ];
data->GetAllFormats( array );
for (size_t i = 0; !supported && i < formatcount ; i++)
wxDataObject* data = gTrackingGlobals.m_currentSource->GetDataObject() ;
if ( data )
{
wxDataFormat format = array[i] ;
if ( m_dataObject->IsSupported( format ) )
size_t formatcount = data->GetFormatCount() ;
wxDataFormat *array = new wxDataFormat[ formatcount ];
data->GetAllFormats( array );
for (size_t i = 0; !supported && i < formatcount ; i++)
{
supported = true ;
break ;
wxDataFormat format = array[i] ;
if ( m_dataObject->IsSupported( format ) )
{
supported = true ;
break ;
}
}
delete[] array ;
}
delete[] array ;
}
}
if ( !supported )
{
UInt16 items ;
OSErr result;
CountDragItems((DragReference)m_currentDrag, &items);
for (UInt16 index = 1; index <= items && supported == false ; ++index)
{
ItemReference theItem;
FlavorType theType ;
UInt16 flavors = 0 ;
GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
{
result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType);
if ( m_dataObject->IsSupportedFormat( wxDataFormat( theType ) ) )
UInt16 items ;
OSErr result;
CountDragItems((DragReference)m_currentDrag, &items);
for (UInt16 index = 1; index <= items && supported == false ; ++index)
{
ItemReference theItem;
FlavorType theType ;
UInt16 flavors = 0 ;
GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
{
supported = true ;
break ;
result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType);
if ( m_dataObject->IsSupportedFormat( wxDataFormat( theType ) ) )
{
supported = true ;
break ;
}
}
}
}
}
}
return supported ;
}
@@ -131,109 +131,109 @@ bool wxDropTarget::GetData()
{
if (!m_dataObject)
return FALSE;
if ( !CurrentDragHasSupportedFormat() )
return FALSE ;
bool transferred = false ;
if ( gTrackingGlobals.m_currentSource != NULL )
{
wxDataObject* data = gTrackingGlobals.m_currentSource->GetDataObject() ;
if ( data )
{
size_t formatcount = data->GetFormatCount() ;
wxDataFormat *array = new wxDataFormat[ formatcount ];
data->GetAllFormats( array );
for (size_t i = 0; !transferred && i < formatcount ; i++)
wxDataObject* data = gTrackingGlobals.m_currentSource->GetDataObject() ;
if ( data )
{
wxDataFormat format = array[i] ;
if ( m_dataObject->IsSupported( format ) )
size_t formatcount = data->GetFormatCount() ;
wxDataFormat *array = new wxDataFormat[ formatcount ];
data->GetAllFormats( array );
for (size_t i = 0; !transferred && i < formatcount ; i++)
{
int size = data->GetDataSize( format );
transferred = true ;
if (size == 0)
{
m_dataObject->SetData(format , 0 , 0 ) ;
}
else
{
char *d = new char[size];
data->GetDataHere( format , (void*) d );
m_dataObject->SetData( format , size , d ) ;
delete[] d ;
}
wxDataFormat format = array[i] ;
if ( m_dataObject->IsSupported( format ) )
{
int size = data->GetDataSize( format );
transferred = true ;
if (size == 0)
{
m_dataObject->SetData(format , 0 , 0 ) ;
}
else
{
char *d = new char[size];
data->GetDataHere( format , (void*) d );
m_dataObject->SetData( format , size , d ) ;
delete[] d ;
}
}
}
}
delete[] array ;
}
delete[] array ;
}
}
if ( !transferred )
{
UInt16 items ;
OSErr result;
bool firstFileAdded = false ;
CountDragItems((DragReference)m_currentDrag, &items);
for (UInt16 index = 1; index <= items; ++index)
{
ItemReference theItem;
FlavorType theType ;
UInt16 flavors = 0 ;
GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
{
result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType);
wxDataFormat format(theType) ;
if ( m_dataObject->IsSupportedFormat( format ) )
UInt16 items ;
OSErr result;
bool firstFileAdded = false ;
CountDragItems((DragReference)m_currentDrag, &items);
for (UInt16 index = 1; index <= items; ++index)
{
ItemReference theItem;
FlavorType theType ;
UInt16 flavors = 0 ;
GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
{
FlavorFlags theFlags;
result = GetFlavorFlags((DragReference)m_currentDrag, theItem, theType, &theFlags);
if (result == noErr)
{
Size dataSize ;
Ptr theData ;
GetFlavorDataSize((DragReference)m_currentDrag, theItem, theType, &dataSize);
if ( theType == 'TEXT' )
{
// this increment is only valid for allocating, on the next GetFlavorData
// call it is reset again to the original value
dataSize++ ;
}
theData = new char[dataSize];
GetFlavorData((DragReference)m_currentDrag, theItem, theType, (void*) theData, &dataSize, 0L);
if( theType == 'TEXT' )
{
theData[dataSize]=0 ;
if ( wxApp::s_macDefaultEncodingIsPC )
result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType);
wxDataFormat format(theType) ;
if ( m_dataObject->IsSupportedFormat( format ) )
{
FlavorFlags theFlags;
result = GetFlavorFlags((DragReference)m_currentDrag, theItem, theType, &theFlags);
if (result == noErr)
{
wxMacConvertToPC((char*)theData,(char*)theData,dataSize) ;
Size dataSize ;
Ptr theData ;
GetFlavorDataSize((DragReference)m_currentDrag, theItem, theType, &dataSize);
if ( theType == 'TEXT' )
{
// this increment is only valid for allocating, on the next GetFlavorData
// call it is reset again to the original value
dataSize++ ;
}
theData = new char[dataSize];
GetFlavorData((DragReference)m_currentDrag, theItem, theType, (void*) theData, &dataSize, 0L);
if( theType == 'TEXT' )
{
theData[dataSize]=0 ;
if ( wxApp::s_macDefaultEncodingIsPC )
{
wxMacConvertToPC((char*)theData,(char*)theData,dataSize) ;
}
m_dataObject->SetData( format, dataSize, theData );
}
else if ( theType == kDragFlavorTypeHFS )
{
HFSFlavor* theFile = (HFSFlavor*) theData ;
wxString name = wxMacFSSpec2MacFilename( &theFile->fileSpec ) ;
if ( firstFileAdded )
((wxFileDataObject*)m_dataObject)->AddFile( name ) ;
else
{
((wxFileDataObject*)m_dataObject)->SetData( 0 , name.c_str() ) ;
firstFileAdded = true ;
}
}
else
{
m_dataObject->SetData( format, dataSize, theData );
}
delete[] theData;
}
m_dataObject->SetData( format, dataSize, theData );
}
else if ( theType == kDragFlavorTypeHFS )
{
HFSFlavor* theFile = (HFSFlavor*) theData ;
wxString name = wxMacFSSpec2MacFilename( &theFile->fileSpec ) ;
if ( firstFileAdded )
((wxFileDataObject*)m_dataObject)->AddFile( name ) ;
else
{
((wxFileDataObject*)m_dataObject)->SetData( 0 , name.c_str() ) ;
firstFileAdded = true ;
}
}
else
{
m_dataObject->SetData( format, dataSize, theData );
}
delete[] theData;
}
break ;
break ;
}
}
}
}
}
}
return TRUE ;
}
@@ -273,13 +273,13 @@ wxDropSource::~wxDropSource()
wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags))
{
wxASSERT_MSG( m_data, wxT("Drop source: no data") );
if (!m_data)
return (wxDragResult) wxDragNone;
if (m_data->GetFormatCount() == 0)
return (wxDragResult) wxDragNone;
OSErr result;
DragReference theDrag;
RgnHandle dragRegion;
@@ -300,45 +300,45 @@ wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags))
OSType type = formats[i].GetFormatId() ;
if ( type == 'TEXT' )
{
dataSize-- ;
if ( wxApp::s_macDefaultEncodingIsPC )
{
wxMacConvertFromPC((char*)dataPtr,(char*)dataPtr,dataSize) ;
}
AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);
dataSize-- ;
if ( wxApp::s_macDefaultEncodingIsPC )
{
wxMacConvertFromPC((char*)dataPtr,(char*)dataPtr,dataSize) ;
}
AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);
}
else if (type == kDragFlavorTypeHFS )
{
HFSFlavor theFlavor ;
OSErr err = noErr;
CInfoPBRec cat;
wxMacFilename2FSSpec( dataPtr , &theFlavor.fileSpec ) ;
cat.hFileInfo.ioNamePtr = theFlavor.fileSpec.name;
cat.hFileInfo.ioVRefNum = theFlavor.fileSpec.vRefNum;
cat.hFileInfo.ioDirID = theFlavor.fileSpec.parID;
cat.hFileInfo.ioFDirIndex = 0;
err = PBGetCatInfoSync(&cat);
if (err == noErr )
{
theFlavor.fdFlags = cat.hFileInfo.ioFlFndrInfo.fdFlags;
if (theFlavor.fileSpec.parID == fsRtParID) {
theFlavor.fileCreator = 'MACS';
theFlavor.fileType = 'disk';
} else if ((cat.hFileInfo.ioFlAttrib & ioDirMask) != 0) {
theFlavor.fileCreator = 'MACS';
theFlavor.fileType = 'fold';
} else {
theFlavor.fileCreator = cat.hFileInfo.ioFlFndrInfo.fdCreator;
theFlavor.fileType = cat.hFileInfo.ioFlFndrInfo.fdType;
}
AddDragItemFlavor(theDrag, theItem, type , &theFlavor, sizeof(theFlavor), 0);
}
HFSFlavor theFlavor ;
OSErr err = noErr;
CInfoPBRec cat;
wxMacFilename2FSSpec( dataPtr , &theFlavor.fileSpec ) ;
cat.hFileInfo.ioNamePtr = theFlavor.fileSpec.name;
cat.hFileInfo.ioVRefNum = theFlavor.fileSpec.vRefNum;
cat.hFileInfo.ioDirID = theFlavor.fileSpec.parID;
cat.hFileInfo.ioFDirIndex = 0;
err = PBGetCatInfoSync(&cat);
if (err == noErr )
{
theFlavor.fdFlags = cat.hFileInfo.ioFlFndrInfo.fdFlags;
if (theFlavor.fileSpec.parID == fsRtParID) {
theFlavor.fileCreator = 'MACS';
theFlavor.fileType = 'disk';
} else if ((cat.hFileInfo.ioFlAttrib & ioDirMask) != 0) {
theFlavor.fileCreator = 'MACS';
theFlavor.fileType = 'fold';
} else {
theFlavor.fileCreator = cat.hFileInfo.ioFlFndrInfo.fdCreator;
theFlavor.fileType = cat.hFileInfo.ioFlFndrInfo.fdType;
}
AddDragItemFlavor(theDrag, theItem, type , &theFlavor, sizeof(theFlavor), 0);
}
}
else
{
AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);
AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);
}
delete[] dataPtr ;
}
@@ -349,37 +349,37 @@ wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags))
EventRecord* ev = NULL ;
#if !TARGET_CARBON // TODO
ev = (EventRecord*) wxTheApp->MacGetCurrentEvent() ;
ev = (EventRecord*) wxTheApp->MacGetCurrentEvent() ;
#else
EventRecord rec ;
ev = &rec ;
wxMacConvertEventToRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) ;
EventRecord rec ;
ev = &rec ;
wxMacConvertEventToRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) ;
#endif
const short dragRegionOuterBoundary = 10 ;
const short dragRegionInnerBoundary = 9 ;
SetRectRgn( dragRegion , ev->where.h - dragRegionOuterBoundary ,
ev->where.v - dragRegionOuterBoundary ,
ev->where.h + dragRegionOuterBoundary ,
ev->where.v + dragRegionOuterBoundary ) ;
ev->where.v - dragRegionOuterBoundary ,
ev->where.h + dragRegionOuterBoundary ,
ev->where.v + dragRegionOuterBoundary ) ;
SetRectRgn( tempRgn , ev->where.h - dragRegionInnerBoundary ,
ev->where.v - dragRegionInnerBoundary ,
ev->where.h + dragRegionInnerBoundary ,
ev->where.v + dragRegionInnerBoundary ) ;
ev->where.v - dragRegionInnerBoundary ,
ev->where.h + dragRegionInnerBoundary ,
ev->where.v + dragRegionInnerBoundary ) ;
DiffRgn( dragRegion , tempRgn , dragRegion ) ;
DisposeRgn( tempRgn ) ;
// TODO:work with promises in order to return data only when drag
// was successfully completed
gTrackingGlobals.m_currentSource = this ;
result = TrackDrag(theDrag, ev , dragRegion);
DisposeRgn(dragRegion);
DisposeDrag(theDrag);
gTrackingGlobals.m_currentSource = NULL ;
return wxDragCopy ;
}
@@ -423,7 +423,7 @@ pascal OSErr wxMacWindowDragTrackingHandler(DragTrackingMessage theMessage, Wind
case kDragTrackingLeaveHandler:
break;
case kDragTrackingEnterWindow:
trackingGlobals->m_currentTargetWindow = NULL ;
trackingGlobals->m_currentTargetWindow = NULL ;
trackingGlobals->m_currentTarget = NULL ;
break;
case kDragTrackingInWindow:

View File

@@ -52,160 +52,160 @@ extern bool gUseNavServices ;
struct OpenUserDataRec {
int currentfilter ;
bool saveMode ;
bool saveMode ;
wxArrayString name ;
wxArrayString extensions ;
wxArrayLong filtermactypes ;
wxArrayLong filtermactypes ;
NavMenuItemSpecArrayHandle menuitems ;
};
typedef struct OpenUserDataRec
OpenUserDataRec, *OpenUserDataRecPtr;
OpenUserDataRec, *OpenUserDataRecPtr;
static pascal void NavEventProc(
NavEventCallbackMessage inSelector,
NavCBRecPtr ioParams,
NavCallBackUserData ioUserData);
static pascal void NavEventProc(
NavEventCallbackMessage inSelector,
NavCBRecPtr ioParams,
NavCallBackUserData ioUserData);
#if TARGET_CARBON
static NavEventUPP sStandardNavEventFilter = NewNavEventUPP(NavEventProc);
static NavEventUPP sStandardNavEventFilter = NewNavEventUPP(NavEventProc);
#else
static NavEventUPP sStandardNavEventFilter = NewNavEventProc(NavEventProc);
static NavEventUPP sStandardNavEventFilter = NewNavEventProc(NavEventProc);
#endif
static pascal void
NavEventProc(
NavEventCallbackMessage inSelector,
NavCBRecPtr ioParams,
NavCallBackUserData ioUserData )
NavEventCallbackMessage inSelector,
NavCBRecPtr ioParams,
NavCallBackUserData ioUserData )
{
OpenUserDataRec * data = ( OpenUserDataRec *) ioUserData ;
if (inSelector == kNavCBEvent) {
OpenUserDataRec * data = ( OpenUserDataRec *) ioUserData ;
if (inSelector == kNavCBEvent) {
#if !TARGET_CARBON
wxTheApp->MacHandleOneEvent(ioParams->eventData.eventDataParms.event);
#endif
}
else if ( inSelector == kNavCBStart )
{
if ( data->menuitems )
NavCustomControl(ioParams->context, kNavCtlSelectCustomType, &(*data->menuitems)[data->currentfilter]);
}
else if ( inSelector == kNavCBPopupMenuSelect )
{
NavMenuItemSpec * menu = (NavMenuItemSpec *) ioParams->eventData.eventDataParms.param ;
if ( menu->menuCreator == 'WXNG' )
{
data->currentfilter = menu->menuType ;
if ( data->saveMode )
{
int i = menu->menuType ;
wxString extension = data->extensions[i].AfterLast('.') ;
extension.MakeLower() ;
Str255 filename ;
// get the current filename
NavCustomControl(ioParams->context, kNavCtlGetEditFileName, &filename);
CopyPascalStringToC( filename , (char*) filename ) ;
wxString sfilename( filename ) ;
int pos = sfilename.Find('.',TRUE) ;
if ( pos != wxNOT_FOUND )
{
sfilename = sfilename.Left(pos+1)+extension ;
CopyCStringToPascal( sfilename.c_str() , filename ) ;
NavCustomControl(ioParams->context, kNavCtlSetEditFileName, &filename);
}
}
}
}
}
else if ( inSelector == kNavCBStart )
{
if ( data->menuitems )
NavCustomControl(ioParams->context, kNavCtlSelectCustomType, &(*data->menuitems)[data->currentfilter]);
}
else if ( inSelector == kNavCBPopupMenuSelect )
{
NavMenuItemSpec * menu = (NavMenuItemSpec *) ioParams->eventData.eventDataParms.param ;
if ( menu->menuCreator == 'WXNG' )
{
data->currentfilter = menu->menuType ;
if ( data->saveMode )
{
int i = menu->menuType ;
wxString extension = data->extensions[i].AfterLast('.') ;
extension.MakeLower() ;
Str255 filename ;
// get the current filename
NavCustomControl(ioParams->context, kNavCtlGetEditFileName, &filename);
CopyPascalStringToC( filename , (char*) filename ) ;
wxString sfilename( filename ) ;
int pos = sfilename.Find('.',TRUE) ;
if ( pos != wxNOT_FOUND )
{
sfilename = sfilename.Left(pos+1)+extension ;
CopyCStringToPascal( sfilename.c_str() , filename ) ;
NavCustomControl(ioParams->context, kNavCtlSetEditFileName, &filename);
}
}
}
}
}
const char * gfilters[] =
{
"*.TXT" ,
"*.TIF" ,
"*.JPG" ,
NULL
"*.TXT" ,
"*.TIF" ,
"*.JPG" ,
NULL
} ;
OSType gfiltersmac[] =
{
'TEXT' ,
'TIFF' ,
'JPEG' ,
'****'
'TEXT' ,
'TIFF' ,
'JPEG' ,
'****'
} ;
void MakeUserDataRec(OpenUserDataRec *myData , const wxString& filter )
void MakeUserDataRec(OpenUserDataRec *myData , const wxString& filter )
{
myData->menuitems = NULL ;
myData->currentfilter = 0 ;
myData->saveMode = FALSE ;
if ( filter && filter[0] )
{
wxString filter2(filter) ;
int filterIndex = 0;
bool isName = true ;
wxString current ;
for( unsigned int i = 0; i < filter2.Len() ; i++ )
myData->menuitems = NULL ;
myData->currentfilter = 0 ;
myData->saveMode = FALSE ;
if ( filter && filter[0] )
{
if( filter2.GetChar(i) == wxT('|') )
{
if( isName ) {
myData->name.Add( current ) ;
wxString filter2(filter) ;
int filterIndex = 0;
bool isName = true ;
wxString current ;
for( unsigned int i = 0; i < filter2.Len() ; i++ )
{
if( filter2.GetChar(i) == wxT('|') )
{
if( isName ) {
myData->name.Add( current ) ;
}
else {
myData->extensions.Add( current.MakeUpper() ) ;
++filterIndex ;
}
isName = !isName ;
current = "" ;
}
else
{
current += filter2.GetChar(i) ;
}
}
else {
myData->extensions.Add( current.MakeUpper() ) ;
++filterIndex ;
}
isName = !isName ;
current = "" ;
}
else
{
current += filter2.GetChar(i) ;
}
}
// we allow for compatibility reason to have a single filter expression (like *.*) without
// an explanatory text, in that case the first part is name and extension at the same time
wxASSERT_MSG( filterIndex == 0 || !isName , "incorrect format of format string" ) ;
if ( current.IsEmpty() )
myData->extensions.Add( myData->name[filterIndex] ) ;
else
myData->extensions.Add( current.MakeUpper() ) ;
if ( filterIndex == 0 || isName )
myData->name.Add( current.MakeUpper() ) ;
// we allow for compatibility reason to have a single filter expression (like *.*) without
// an explanatory text, in that case the first part is name and extension at the same time
wxASSERT_MSG( filterIndex == 0 || !isName , "incorrect format of format string" ) ;
if ( current.IsEmpty() )
myData->extensions.Add( myData->name[filterIndex] ) ;
else
myData->extensions.Add( current.MakeUpper() ) ;
if ( filterIndex == 0 || isName )
myData->name.Add( current.MakeUpper() ) ;
++filterIndex ;
++filterIndex ;
const size_t extCount = myData->extensions.GetCount();
for ( size_t i = 0 ; i < extCount; i++ )
{
int j ;
for ( j = 0 ; gfilters[j] ; j++ )
{
if ( strcmp( myData->extensions[i] , gfilters[j] ) == 0 )
{
myData->filtermactypes.Add( gfiltersmac[j] ) ;
break ;
}
}
if( gfilters[j] == NULL )
{
myData->filtermactypes.Add( '****' ) ;
}
}
}
for ( size_t i = 0 ; i < extCount; i++ )
{
int j ;
for ( j = 0 ; gfilters[j] ; j++ )
{
if ( strcmp( myData->extensions[i] , gfilters[j] ) == 0 )
{
myData->filtermactypes.Add( gfiltersmac[j] ) ;
break ;
}
}
if( gfilters[j] == NULL )
{
myData->filtermactypes.Add( '****' ) ;
}
}
}
}
static Boolean CheckFile( ConstStr255Param name , OSType type , OpenUserDataRecPtr data)
{
Str255 filename ;
Str255 filename ;
#if TARGET_CARBON
p2cstrcpy((char *)filename, name) ;
@@ -218,55 +218,55 @@ static Boolean CheckFile( ConstStr255Param name , OSType type , OpenUserDataRecP
if ( data->extensions.GetCount() > 0 )
{
//for ( int i = 0 ; i < data->numfilters ; ++i )
int i = data->currentfilter ;
if ( data->extensions[i].Right(2) == ".*" )
return true ;
{
if ( type == (OSType)data->filtermactypes[i] )
return true ;
wxStringTokenizer tokenizer( data->extensions[i] , ";" ) ;
while( tokenizer.HasMoreTokens() )
{
wxString extension = tokenizer.GetNextToken() ;
if ( extension.GetChar(0) == '*' )
extension = extension.Mid(1) ;
if ( file.Len() >= extension.Len() && extension == file.Right(extension.Len() ) )
return true ;
}
}
return false ;
//for ( int i = 0 ; i < data->numfilters ; ++i )
int i = data->currentfilter ;
if ( data->extensions[i].Right(2) == ".*" )
return true ;
{
if ( type == (OSType)data->filtermactypes[i] )
return true ;
wxStringTokenizer tokenizer( data->extensions[i] , ";" ) ;
while( tokenizer.HasMoreTokens() )
{
wxString extension = tokenizer.GetNextToken() ;
if ( extension.GetChar(0) == '*' )
extension = extension.Mid(1) ;
if ( file.Len() >= extension.Len() && extension == file.Right(extension.Len() ) )
return true ;
}
}
return false ;
}
return true ;
}
#ifndef __DARWIN__
static pascal Boolean CrossPlatformFileFilter(CInfoPBPtr myCInfoPBPtr, void *dataPtr)
{
OpenUserDataRecPtr data = (OpenUserDataRecPtr) dataPtr ;
// return true if this item is invisible or a file
{
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 )
{
return !CheckFile( myCInfoPBPtr->hFileInfo.ioNamePtr , myCInfoPBPtr->hFileInfo.ioFlFndrInfo.fdType , data ) ;
}
return false ;
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 )
{
return !CheckFile( myCInfoPBPtr->hFileInfo.ioNamePtr , myCInfoPBPtr->hFileInfo.ioFlFndrInfo.fdType , data ) ;
}
return false ;
}
#endif
@@ -335,7 +335,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
long style, const wxPoint& pos)
{
wxASSERT_MSG( NavServicesAvailable() , "Navigation Services are not running" ) ;
wxASSERT_MSG( NavServicesAvailable() , "Navigation Services are not running" ) ;
m_message = message;
m_dialogStyle = style;
m_parent = parent;
@@ -362,7 +362,7 @@ pascal Boolean CrossPlatformFilterCallback (
NavFileOrFolderInfo* theInfo = (NavFileOrFolderInfo*) info ;
if (theItem->descriptorType == typeFSS && !theInfo->isFolder)
{
FSSpec spec;
FSSpec spec;
memcpy( &spec , *theItem->dataHandle , sizeof(FSSpec) ) ;
display = CheckFile( spec.name , theInfo->fileAndFolder.fileInfo.finderInfo.fdType , data ) ;
}
@@ -373,58 +373,58 @@ pascal Boolean CrossPlatformFilterCallback (
int wxFileDialog::ShowModal()
{
NavDialogOptions mNavOptions;
NavObjectFilterUPP mNavFilterUPP = NULL;
NavPreviewUPP mNavPreviewUPP = NULL ;
NavReplyRecord mNavReply;
AEDesc mDefaultLocation ;
bool mSelectDefault = false ;
// zero all data
m_path = wxEmptyString ;
m_fileName = wxEmptyString ;
m_paths.Empty();
m_fileNames.Empty();
NavDialogOptions mNavOptions;
NavObjectFilterUPP mNavFilterUPP = NULL;
NavPreviewUPP mNavPreviewUPP = NULL ;
NavReplyRecord mNavReply;
AEDesc mDefaultLocation ;
bool mSelectDefault = false ;
// zero all data
m_path = wxEmptyString ;
m_fileName = wxEmptyString ;
m_paths.Empty();
m_fileNames.Empty();
// setup dialog
// setup dialog
::NavGetDefaultDialogOptions(&mNavOptions);
mNavFilterUPP = nil;
mNavPreviewUPP = nil;
mSelectDefault = false;
mNavFilterUPP = nil;
mNavPreviewUPP = nil;
mSelectDefault = false;
mNavReply.validRecord = false;
mNavReply.replacing = false;
mNavReply.replacing = false;
mNavReply.isStationery = false;
mNavReply.translationNeeded = false;
mNavReply.translationNeeded = false;
mNavReply.selection.descriptorType = typeNull;
mNavReply.selection.dataHandle = nil;
mNavReply.keyScript = smSystemScript;
mNavReply.keyScript = smSystemScript;
mNavReply.fileTranslation = nil;
// Set default location, the location
// that's displayed when the dialog
// first appears
FSSpec location ;
wxMacFilename2FSSpec( m_dir , &location ) ;
OSErr err = noErr ;
mDefaultLocation.descriptorType = typeNull;
mDefaultLocation.dataHandle = nil;
err = ::AECreateDesc(typeFSS, &location, sizeof(FSSpec), &mDefaultLocation );
if ( mDefaultLocation.dataHandle ) {
if (mSelectDefault) {
mNavOptions.dialogOptionFlags |= kNavSelectDefaultLocation;
} else {
mNavOptions.dialogOptionFlags &= ~kNavSelectDefaultLocation;
}
}
#if TARGET_CARBON
c2pstrcpy((StringPtr)mNavOptions.message, m_message) ;
#else
@@ -438,7 +438,7 @@ int wxFileDialog::ShowModal()
c2pstr((char *)mNavOptions.savedFileName ) ;
#endif
OpenUserDataRec myData;
OpenUserDataRec myData;
MakeUserDataRec( &myData , m_wildCard ) ;
myData.currentfilter = m_filterIndex ;
if ( myData.extensions.GetCount() > 0 )
@@ -464,7 +464,7 @@ int wxFileDialog::ShowModal()
mNavOptions.dialogOptionFlags |= kNavDontAutoTranslate ;
mNavOptions.dialogOptionFlags |= kNavDontAddTranslateItems ;
err = ::NavPutFile(
&mDefaultLocation,
&mNavReply,
@@ -472,7 +472,7 @@ int wxFileDialog::ShowModal()
sStandardNavEventFilter ,
NULL,
kNavGenericSignature,
&myData); // User Data
&myData); // User Data
m_filterIndex = myData.currentfilter ;
}
else
@@ -484,7 +484,7 @@ int wxFileDialog::ShowModal()
mNavOptions.dialogOptionFlags |= kNavAllowMultipleFiles ;
else
mNavOptions.dialogOptionFlags &= ~kNavAllowMultipleFiles ;
err = ::NavGetFile(
&mDefaultLocation,
&mNavReply,
@@ -496,23 +496,23 @@ int wxFileDialog::ShowModal()
&myData);
m_filterIndex = myData.currentfilter ;
}
DisposeNavObjectFilterUPP(mNavFilterUPP);
if ( mDefaultLocation.dataHandle != nil )
{
::AEDisposeDesc(&mDefaultLocation);
}
if ( (err != noErr) && (err != userCanceledErr) ) {
return wxID_CANCEL ;
}
if (mNavReply.validRecord) {
FSSpec outFileSpec ;
AEDesc specDesc ;
AEKeyword keyWord ;
long count ;
::AECountItems( &mNavReply.selection , &count ) ;
for ( long i = 1 ; i <= count ; ++i )
@@ -521,7 +521,7 @@ int wxFileDialog::ShowModal()
if ( err != noErr ) {
m_path = "" ;
return wxID_CANCEL ;
}
}
outFileSpec = **(FSSpec**) specDesc.dataHandle;
if (specDesc.dataHandle != nil) {
::AEDisposeDesc(&specDesc);
@@ -566,7 +566,7 @@ wxDefaultFileSelector(bool load, const char *what, const char *extension, const
wxString
wxLoadFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent)
{
return wxDefaultFileSelector(TRUE, what, extension, default_name, parent);
return wxDefaultFileSelector(TRUE, what, extension, default_name, parent);
}
@@ -574,7 +574,7 @@ wxLoadFileSelector(const char *what, const char *extension, const char *default_
wxString
wxSaveFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent)
{
return wxDefaultFileSelector(FALSE, what, extension, default_name, parent);
return wxDefaultFileSelector(FALSE, what, extension, default_name, parent);
}

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -67,66 +67,66 @@ wxFontRefData::~wxFontRefData()
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( "\pGeneva" , &m_macFontNum) ;
break ;
case wxMODERN :
::GetFNum( "\pMonaco" , &m_macFontNum) ;
break ;
}
Str255 name ;
GetFontName( m_macFontNum , name ) ;
CopyPascalStringToC( name , (char*) name ) ;
m_faceName = (char*) name ;
}
else
{
if ( m_faceName == "systemfont" )
m_macFontNum = ::GetSysFont() ;
else if ( m_faceName == "applicationfont" )
m_macFontNum = ::GetAppFont() ;
else
{
Str255 fontname ;
wxMacStringToPascal( m_faceName , fontname ) ;
::GetFNum( fontname, &m_macFontNum);
}
}
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( "\pGeneva" , &m_macFontNum) ;
break ;
case wxMODERN :
::GetFNum( "\pMonaco" , &m_macFontNum) ;
break ;
}
Str255 name ;
GetFontName( m_macFontNum , name ) ;
CopyPascalStringToC( name , (char*) name ) ;
m_faceName = (char*) name ;
}
else
{
if ( m_faceName == "systemfont" )
m_macFontNum = ::GetSysFont() ;
else if ( m_faceName == "applicationfont" )
m_macFontNum = ::GetAppFont() ;
else
{
Str255 fontname ;
wxMacStringToPascal( m_faceName , fontname ) ;
::GetFNum( fontname, &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 ;
//TODO:if we supply the style as an additional parameter we must make a testing
//sequence in order to degrade gracefully while trying to maintain most of the style
//information, meanwhile we just take the normal font and apply the features after
OSStatus status = ::ATSUFONDtoFontID(m_macFontNum, normal /*qdStyle*/, (UInt32*)&m_macATSUFontID);
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 ;
//TODO:if we supply the style as an additional parameter we must make a testing
//sequence in order to degrade gracefully while trying to maintain most of the style
//information, meanwhile we just take the normal font and apply the features after
OSStatus status = ::ATSUFONDtoFontID(m_macFontNum, normal /*qdStyle*/, (UInt32*)&m_macATSUFontID);
/*
status = ATSUFindFontFromName ( (Ptr) m_faceName , strlen( m_faceName ) ,
kFontFullName, kFontMacintoshPlatform, kFontRomanScript , kFontNoLanguage , (UInt32*)&m_macATSUFontID ) ;
kFontFullName, kFontMacintoshPlatform, kFontRomanScript , kFontNoLanguage , (UInt32*)&m_macATSUFontID ) ;
*/
wxASSERT_MSG( status == noErr , "couldn't retrieve font identifier" ) ;
wxASSERT_MSG( status == noErr , "couldn't retrieve font identifier" ) ;
}
// ----------------------------------------------------------------------------
@@ -173,7 +173,7 @@ wxFont::~wxFont()
bool wxFont::RealizeResource()
{
M_FONTDATA->MacFindFont() ;
M_FONTDATA->MacFindFont() ;
return TRUE;
}
@@ -188,17 +188,17 @@ void wxFont::SetEncoding(wxFontEncoding encoding)
void wxFont::Unshare()
{
// Don't change shared data
if (!m_refData)
// Don't change shared data
if (!m_refData)
{
m_refData = new wxFontRefData();
}
m_refData = new wxFontRefData();
}
else
{
wxFontRefData* ref = new wxFontRefData(*(wxFontRefData*)m_refData);
UnRef();
m_refData = ref;
}
wxFontRefData* ref = new wxFontRefData(*(wxFontRefData*)m_refData);
UnRef();
m_refData = ref;
}
}
void wxFont::SetPointSize(int pointSize)

View File

@@ -7,7 +7,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__

View File

@@ -103,46 +103,46 @@ bool wxFontEnumeratorHelper::SetEncoding(wxFontEncoding encoding)
void wxFontEnumeratorHelper::DoEnumerate()
{
MenuHandle menu ;
Str255 p_name ;
MenuHandle menu ;
Str255 p_name ;
short lines ;
menu = NewMenu( 32000 , "\pFont" ) ;
AppendResMenu( menu , 'FONT' ) ;
lines = CountMenuItems( menu ) ;
short lines ;
menu = NewMenu( 32000 , "\pFont" ) ;
AppendResMenu( menu , 'FONT' ) ;
lines = CountMenuItems( menu ) ;
for ( int i = 1 ; i < lines+1 ; i ++ )
{
GetMenuItemText( menu , i , p_name ) ;
wxString c_name = wxMacMakeStringFromPascal(p_name) ;
for ( int i = 1 ; i < lines+1 ; i ++ )
{
GetMenuItemText( menu , i , p_name ) ;
wxString c_name = wxMacMakeStringFromPascal(p_name) ;
/*
if ( m_fixedOnly )
{
// check that it's a fixed pitch font (there is *no* error here, the
// flag name is misleading!)
if ( tm->tmPitchAndFamily & TMPF_FIXED_PITCH )
{
// not a fixed pitch font
return TRUE;
}
}
if ( m_charset != -1 )
{
// check that we have the right encoding
if ( lf->lfCharSet != m_charset )
{
return TRUE;
}
}
*/
m_fontEnum->OnFacename( c_name ) ;
}
DisposeMenu( menu ) ;
/*
if ( m_fixedOnly )
{
// check that it's a fixed pitch font (there is *no* error here, the
// flag name is misleading!)
if ( tm->tmPitchAndFamily & TMPF_FIXED_PITCH )
{
// not a fixed pitch font
return TRUE;
}
}
if ( m_charset != -1 )
{
// check that we have the right encoding
if ( lf->lfCharSet != m_charset )
{
return TRUE;
}
}
*/
m_fontEnum->OnFacename( c_name ) ;
}
DisposeMenu( menu ) ;
}
// ----------------------------------------------------------------------------

View File

@@ -53,16 +53,16 @@ bool wxFrame::m_useNativeStatusBar = FALSE;
void wxFrame::Init()
{
m_frameMenuBar = NULL;
m_frameMenuBar = NULL;
#if wxUSE_TOOLBAR
m_frameToolBar = NULL ;
m_frameToolBar = NULL ;
#endif
m_frameStatusBar = NULL;
m_winLastFocused = NULL ;
m_frameStatusBar = NULL;
m_winLastFocused = NULL ;
m_iconized = FALSE;
#if wxUSE_TOOLTIPS
m_hwndToolTip = 0;
#endif
@@ -70,7 +70,7 @@ void wxFrame::Init()
wxPoint wxFrame::GetClientAreaOrigin() const
{
// on mac we are at position -1,-1 with the control
// on mac we are at position -1,-1 with the control
wxPoint pt(0, 0);
#if wxUSE_TOOLBAR
@@ -101,27 +101,26 @@ bool wxFrame::Create(wxWindow *parent,
long style,
const wxString& name)
{
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
return FALSE;
MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
wxModelessWindows.Append(this);
return TRUE;
MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
wxModelessWindows.Append(this);
return TRUE;
}
wxFrame::~wxFrame()
{
m_isBeingDeleted = TRUE;
DeleteAllBars();
m_isBeingDeleted = TRUE;
DeleteAllBars();
}
@@ -130,14 +129,14 @@ bool wxFrame::Enable(bool enable)
if ( !wxWindow::Enable(enable) )
return FALSE;
if ( m_frameMenuBar && m_frameMenuBar == wxMenuBar::MacGetInstalledMenuBar() )
{
int iMaxMenu = m_frameMenuBar->GetMenuCount();
for ( int i = 0 ; i < iMaxMenu ; ++ i )
{
m_frameMenuBar->EnableTop( i , enable ) ;
}
}
if ( m_frameMenuBar && m_frameMenuBar == wxMenuBar::MacGetInstalledMenuBar() )
{
int iMaxMenu = m_frameMenuBar->GetMenuCount();
for ( int i = 0 ; i < iMaxMenu ; ++ i )
{
m_frameMenuBar->EnableTop( i , enable ) ;
}
}
return TRUE;
}
@@ -149,24 +148,24 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
statusBar = new wxStatusBar(this, id,
style, name);
statusBar->SetSize( 100 , 15 ) ;
statusBar->SetSize( 100 , 15 ) ;
statusBar->SetFieldsCount(number);
return statusBar;
}
void wxFrame::PositionStatusBar()
{
if (m_frameStatusBar )
{
int w, h;
GetClientSize(&w, &h);
int sw, sh;
m_frameStatusBar->GetSize(&sw, &sh);
// 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);
}
if (m_frameStatusBar )
{
int w, h;
GetClientSize(&w, &h);
int sw, sh;
m_frameStatusBar->GetSize(&sw, &sh);
// 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);
}
}
// Responds to colour changes, and passes event on to children.
@@ -215,8 +214,8 @@ void wxFrame::OnActivate(wxActivateEvent& event)
event.Skip();
}
else
{
else
{
// restore focus to the child which was last focused
wxWindow *parent = m_winLastFocused ? m_winLastFocused->GetParent()
: NULL;
@@ -225,19 +224,19 @@ void wxFrame::OnActivate(wxActivateEvent& event)
parent = this;
}
wxSetFocusToChild(parent, &m_winLastFocused);
wxSetFocusToChild(parent, &m_winLastFocused);
if ( m_frameMenuBar != NULL )
{
m_frameMenuBar->MacInstallMenuBar() ;
}
else if (wxTheApp->GetTopWindow() && wxTheApp->GetTopWindow()->IsKindOf(CLASSINFO(wxFrame)))
if ( m_frameMenuBar != NULL )
{
m_frameMenuBar->MacInstallMenuBar() ;
}
else if (wxTheApp->GetTopWindow() && wxTheApp->GetTopWindow()->IsKindOf(CLASSINFO(wxFrame)))
{
// Trying toplevel frame menbar
if( ((wxFrame*)wxTheApp->GetTopWindow())->GetMenuBar() )
((wxFrame*)wxTheApp->GetTopWindow())->GetMenuBar()->MacInstallMenuBar();
}
}
((wxFrame*)wxTheApp->GetTopWindow())->GetMenuBar()->MacInstallMenuBar();
}
}
}
void wxFrame::DetachMenuBar()
@@ -262,40 +261,40 @@ void wxFrame::AttachMenuBar( wxMenuBar *menuBar )
void wxFrame::DoGetClientSize(int *x, int *y) const
{
wxWindow::DoGetClientSize( x , y ) ;
wxWindow::DoGetClientSize( x , y ) ;
#if wxUSE_STATUSBAR
if ( GetStatusBar() && y )
{
int statusX, statusY;
GetStatusBar()->GetClientSize(&statusX, &statusY);
*y -= statusY;
}
if ( GetStatusBar() && y )
{
int statusX, statusY;
GetStatusBar()->GetClientSize(&statusX, &statusY);
*y -= statusY;
}
#endif // wxUSE_STATUSBAR
wxPoint pt(GetClientAreaOrigin());
if ( y )
*y -= pt.y;
if ( x )
*x -= pt.x;
wxPoint pt(GetClientAreaOrigin());
if ( y )
*y -= pt.y;
if ( x )
*x -= pt.x;
}
void wxFrame::DoSetClientSize(int clientwidth, int clientheight)
{
int currentclientwidth , currentclientheight ;
int currentwidth , currentheight ;
GetClientSize( &currentclientwidth , &currentclientheight ) ;
GetSize( &currentwidth , &currentheight ) ;
// find the current client size
int currentclientwidth , currentclientheight ;
int currentwidth , currentheight ;
GetClientSize( &currentclientwidth , &currentclientheight ) ;
GetSize( &currentwidth , &currentheight ) ;
// find the current client size
// 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 ) ;
DoSetSize( -1 , -1 , currentwidth + clientwidth - currentclientwidth ,
currentheight + clientheight - currentclientheight , wxSIZE_USE_EXISTING ) ;
}
@@ -314,8 +313,8 @@ void wxFrame::PositionToolBar()
{
int cw, ch;
cw = m_width ;
ch = m_height ;
cw = m_width ;
ch = m_height ;
if ( GetStatusBar() )
{

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -29,25 +29,25 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id,
const wxValidator& validator,
const wxString& name)
{
wxSize size = s ;
Rect bounds ;
Str255 title ;
m_rangeMax = range ;
m_gaugePos = 0 ;
if ( size.x == wxDefaultSize.x && size.y == wxDefaultSize.y)
{
size = wxSize( 200 , 16 ) ;
}
MacPreControlCreate( parent , id , "" , pos , size ,style & 0xE0FFFFFF /* no borders on mac */ , validator , name , &bounds , title ) ;
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , range,
kControlProgressBarProc , (long) this ) ;
MacPostControlCreate() ;
return TRUE;
wxSize size = s ;
Rect bounds ;
Str255 title ;
m_rangeMax = range ;
m_gaugePos = 0 ;
if ( size.x == wxDefaultSize.x && size.y == wxDefaultSize.y)
{
size = wxSize( 200 , 16 ) ;
}
MacPreControlCreate( parent , id , "" , pos , size ,style & 0xE0FFFFFF /* no borders on mac */ , validator , name , &bounds , title ) ;
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , range,
kControlProgressBarProc , (long) this ) ;
MacPostControlCreate() ;
return TRUE;
}
void wxGauge::SetShadowWidth(int w)
@@ -67,7 +67,7 @@ void wxGauge::SetRange(int r)
void wxGauge::SetValue(int pos)
{
m_gaugePos = pos;
::SetControl32BitValue( (ControlHandle) m_macControl , m_gaugePos ) ;
::SetControl32BitValue( (ControlHandle) m_macControl , m_gaugePos ) ;
}
int wxGauge::GetShadowWidth() const

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -34,82 +34,82 @@
#include "wx/mac/uma.h"
/*
* GLContext implementation
*/
* GLContext implementation
*/
wxGLContext::wxGLContext(
AGLPixelFormat fmt, wxGLCanvas *win,
const wxPalette& palette,
const wxGLContext *other /* for sharing display lists */
)
AGLPixelFormat fmt, wxGLCanvas *win,
const wxPalette& palette,
const wxGLContext *other /* for sharing display lists */
)
{
m_window = win;
m_drawable = (AGLDrawable) UMAGetWindowPort(MAC_WXHWND(win->MacGetRootWindow()));
m_glContext = aglCreateContext(fmt, other ? other->m_glContext : NULL);
wxCHECK_RET( m_glContext, wxT("Couldn't create OpenGl context") );
GLboolean b;
GLboolean b;
b = aglSetDrawable(m_glContext, m_drawable);
wxCHECK_RET( b, wxT("Couldn't bind OpenGl context") );
aglEnable(m_glContext , AGL_BUFFER_RECT ) ;
aglEnable(m_glContext , AGL_BUFFER_RECT ) ;
b = aglSetCurrentContext(m_glContext);
wxCHECK_RET( b, wxT("Couldn't activate OpenGl context") );
}
wxGLContext::~wxGLContext()
{
if (m_glContext)
{
aglSetCurrentContext(NULL);
aglDestroyContext(m_glContext);
}
if (m_glContext)
{
aglSetCurrentContext(NULL);
aglDestroyContext(m_glContext);
}
}
void wxGLContext::SwapBuffers()
{
if (m_glContext)
{
aglSwapBuffers(m_glContext);
}
if (m_glContext)
{
aglSwapBuffers(m_glContext);
}
}
void wxGLContext::SetCurrent()
{
if (m_glContext)
{
aglSetCurrentContext(m_glContext);
}
if (m_glContext)
{
aglSetCurrentContext(m_glContext);
}
}
void wxGLContext::Update()
{
if (m_glContext)
{
aglUpdateContext(m_glContext);
}
if (m_glContext)
{
aglUpdateContext(m_glContext);
}
}
void wxGLContext::SetColour(const char *colour)
{
float r = 0.0;
float g = 0.0;
float b = 0.0;
wxColour *col = wxTheColourDatabase->FindColour(colour);
if (col)
{
r = (float)(col->Red()/256.0);
g = (float)(col->Green()/256.0);
b = (float)(col->Blue()/256.0);
glColor3f( r, g, b);
}
float r = 0.0;
float g = 0.0;
float b = 0.0;
wxColour *col = wxTheColourDatabase->FindColour(colour);
if (col)
{
r = (float)(col->Red()/256.0);
g = (float)(col->Green()/256.0);
b = (float)(col->Blue()/256.0);
glColor3f( r, g, b);
}
}
/*
* wxGLCanvas implementation
*/
* wxGLCanvas implementation
*/
IMPLEMENT_CLASS(wxGLCanvas, wxWindow)
@@ -118,23 +118,23 @@ BEGIN_EVENT_TABLE(wxGLCanvas, wxWindow)
END_EVENT_TABLE()
wxGLCanvas::wxGLCanvas(wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
int *attribList, const wxPalette& palette)
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
int *attribList, const wxPalette& palette)
{
Create(parent, NULL, id, pos, size, style, name, attribList, palette);
}
wxGLCanvas::wxGLCanvas( wxWindow *parent,
const wxGLContext *shared, wxWindowID id,
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
int *attribList, const wxPalette& palette )
const wxGLContext *shared, wxWindowID id,
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
int *attribList, const wxPalette& palette )
{
Create(parent, shared, id, pos, size, style, name, attribList, palette);
}
wxGLCanvas::wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared, wxWindowID id,
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
int *attribList, const wxPalette& palette )
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
int *attribList, const wxPalette& palette )
{
Create(parent, shared ? shared->GetContext() : NULL, id, pos, size, style, name, attribList, palette);
}
@@ -151,80 +151,80 @@ static AGLPixelFormat ChoosePixelFormat(const int *attribList)
{
GLint data[512];
GLint defaultAttribs[] = { AGL_RGBA,
AGL_DOUBLEBUFFER,
AGL_MINIMUM_POLICY,
AGL_DEPTH_SIZE, 1, // use largest available depth buffer
AGL_RED_SIZE, 1,
AGL_GREEN_SIZE, 1,
AGL_BLUE_SIZE, 1,
AGL_ALPHA_SIZE, 0,
AGL_NONE };
AGL_DOUBLEBUFFER,
AGL_MINIMUM_POLICY,
AGL_DEPTH_SIZE, 1, // use largest available depth buffer
AGL_RED_SIZE, 1,
AGL_GREEN_SIZE, 1,
AGL_BLUE_SIZE, 1,
AGL_ALPHA_SIZE, 0,
AGL_NONE };
GLint *attribs;
if (!attribList)
{
attribs = defaultAttribs;
attribs = defaultAttribs;
}
else
{
int arg=0, p=0;
data[p++] = AGL_MINIMUM_POLICY; // make _SIZE tags behave more like GLX
while( (attribList[arg]!=0) && (p<512) )
{
switch( attribList[arg++] )
int arg=0, p=0;
data[p++] = AGL_MINIMUM_POLICY; // make _SIZE tags behave more like GLX
while( (attribList[arg]!=0) && (p<512) )
{
case WX_GL_RGBA: data[p++] = AGL_RGBA; break;
case WX_GL_BUFFER_SIZE:
data[p++]=AGL_BUFFER_SIZE; data[p++]=attribList[arg++]; break;
case WX_GL_LEVEL:
data[p++]=AGL_LEVEL; data[p++]=attribList[arg++]; break;
case WX_GL_DOUBLEBUFFER: data[p++] = AGL_DOUBLEBUFFER; break;
case WX_GL_STEREO: data[p++] = AGL_STEREO; break;
case WX_GL_AUX_BUFFERS:
data[p++]=AGL_AUX_BUFFERS; data[p++]=attribList[arg++]; break;
case WX_GL_MIN_RED:
data[p++]=AGL_RED_SIZE; data[p++]=attribList[arg++]; break;
case WX_GL_MIN_GREEN:
data[p++]=AGL_GREEN_SIZE; data[p++]=attribList[arg++]; break;
case WX_GL_MIN_BLUE:
data[p++]=AGL_BLUE_SIZE; data[p++]=attribList[arg++]; break;
case WX_GL_MIN_ALPHA:
data[p++]=AGL_ALPHA_SIZE; data[p++]=attribList[arg++]; break;
case WX_GL_DEPTH_SIZE:
data[p++]=AGL_DEPTH_SIZE; data[p++]=attribList[arg++]; break;
case WX_GL_STENCIL_SIZE:
data[p++]=AGL_STENCIL_SIZE; data[p++]=attribList[arg++]; break;
case WX_GL_MIN_ACCUM_RED:
data[p++]=AGL_ACCUM_RED_SIZE; data[p++]=attribList[arg++]; break;
case WX_GL_MIN_ACCUM_GREEN:
data[p++]=AGL_ACCUM_GREEN_SIZE; data[p++]=attribList[arg++]; break;
case WX_GL_MIN_ACCUM_BLUE:
data[p++]=AGL_ACCUM_BLUE_SIZE; data[p++]=attribList[arg++]; break;
case WX_GL_MIN_ACCUM_ALPHA:
data[p++]=AGL_ACCUM_ALPHA_SIZE; data[p++]=attribList[arg++]; break;
default:
break;
}
}
data[p] = 0;
attribs = data;
switch( attribList[arg++] )
{
case WX_GL_RGBA: data[p++] = AGL_RGBA; break;
case WX_GL_BUFFER_SIZE:
data[p++]=AGL_BUFFER_SIZE; data[p++]=attribList[arg++]; break;
case WX_GL_LEVEL:
data[p++]=AGL_LEVEL; data[p++]=attribList[arg++]; break;
case WX_GL_DOUBLEBUFFER: data[p++] = AGL_DOUBLEBUFFER; break;
case WX_GL_STEREO: data[p++] = AGL_STEREO; break;
case WX_GL_AUX_BUFFERS:
data[p++]=AGL_AUX_BUFFERS; data[p++]=attribList[arg++]; break;
case WX_GL_MIN_RED:
data[p++]=AGL_RED_SIZE; data[p++]=attribList[arg++]; break;
case WX_GL_MIN_GREEN:
data[p++]=AGL_GREEN_SIZE; data[p++]=attribList[arg++]; break;
case WX_GL_MIN_BLUE:
data[p++]=AGL_BLUE_SIZE; data[p++]=attribList[arg++]; break;
case WX_GL_MIN_ALPHA:
data[p++]=AGL_ALPHA_SIZE; data[p++]=attribList[arg++]; break;
case WX_GL_DEPTH_SIZE:
data[p++]=AGL_DEPTH_SIZE; data[p++]=attribList[arg++]; break;
case WX_GL_STENCIL_SIZE:
data[p++]=AGL_STENCIL_SIZE; data[p++]=attribList[arg++]; break;
case WX_GL_MIN_ACCUM_RED:
data[p++]=AGL_ACCUM_RED_SIZE; data[p++]=attribList[arg++]; break;
case WX_GL_MIN_ACCUM_GREEN:
data[p++]=AGL_ACCUM_GREEN_SIZE; data[p++]=attribList[arg++]; break;
case WX_GL_MIN_ACCUM_BLUE:
data[p++]=AGL_ACCUM_BLUE_SIZE; data[p++]=attribList[arg++]; break;
case WX_GL_MIN_ACCUM_ALPHA:
data[p++]=AGL_ACCUM_ALPHA_SIZE; data[p++]=attribList[arg++]; break;
default:
break;
}
}
data[p] = 0;
attribs = data;
}
return aglChoosePixelFormat(NULL, 0, attribs);
}
bool wxGLCanvas::Create(wxWindow *parent, const wxGLContext *shared, wxWindowID id,
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
int *attribList, const wxPalette& palette)
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
int *attribList, const wxPalette& palette)
{
wxWindow::Create( parent, id, pos, size, style, name );
AGLPixelFormat fmt = ChoosePixelFormat(attribList);
wxCHECK_MSG( fmt, false, wxT("Couldn't create OpenGl pixel format") );
m_glContext = new wxGLContext(fmt, this, palette, shared);
aglDestroyPixelFormat(fmt);
return true;
@@ -232,20 +232,20 @@ bool wxGLCanvas::Create(wxWindow *parent, const wxGLContext *shared, wxWindowID
void wxGLCanvas::SwapBuffers()
{
if (m_glContext)
m_glContext->SwapBuffers();
if (m_glContext)
m_glContext->SwapBuffers();
}
void wxGLCanvas::UpdateContext()
{
if (m_glContext)
m_glContext->Update();
if (m_glContext)
m_glContext->Update();
}
void wxGLCanvas::SetViewport()
{
// viewport is initially set to entire port
// adjust glViewport to just this window
// viewport is initially set to entire port
// adjust glViewport to just this window
int x = 0 ;
int y = 0 ;
@@ -259,49 +259,49 @@ void wxGLCanvas::SetViewport()
parms[1] = bounds.bottom - bounds.top - ( y + height ) ;
parms[2] = width ;
parms[3] = height ;
aglSetInteger( m_glContext->m_glContext , AGL_BUFFER_RECT , parms ) ;
aglSetInteger( m_glContext->m_glContext , AGL_BUFFER_RECT , parms ) ;
}
void wxGLCanvas::OnSize(wxSizeEvent& event)
{
MacUpdateView() ;
MacUpdateView() ;
}
void wxGLCanvas::MacUpdateView()
{
if (m_glContext)
{
UpdateContext();
m_glContext->SetCurrent();
SetViewport();
}
if (m_glContext)
{
UpdateContext();
m_glContext->SetCurrent();
SetViewport();
}
}
void wxGLCanvas::MacSuperChangedPosition()
{
MacUpdateView() ;
wxWindow::MacSuperChangedPosition() ;
MacUpdateView() ;
wxWindow::MacSuperChangedPosition() ;
}
void wxGLCanvas::MacTopLevelWindowChangedPosition()
{
MacUpdateView() ;
wxWindow::MacTopLevelWindowChangedPosition() ;
MacUpdateView() ;
wxWindow::MacTopLevelWindowChangedPosition() ;
}
void wxGLCanvas::SetCurrent()
{
if (m_glContext)
{
m_glContext->SetCurrent();
}
if (m_glContext)
{
m_glContext->SetCurrent();
}
}
void wxGLCanvas::SetColour(const char *colour)
{
if (m_glContext)
m_glContext->SetColour(colour);
if (m_glContext)
m_glContext->SetColour(colour);
}

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -47,7 +47,7 @@ bool wxXXXXHelpController::LoadFile(const wxString& file)
bool wxXXXXHelpController::DisplayContents()
{
// TODO
return FALSE;
return FALSE;
}
bool wxXXXXHelpController::DisplaySection(int section)

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -59,16 +59,16 @@ wxIcon::~wxIcon()
bool wxIcon::LoadFile(const wxString& filename, wxBitmapType type,
int desiredWidth, int desiredHeight)
{
UnRef();
m_refData = new wxBitmapRefData;
wxBitmapHandler *handler = FindHandler((wxBitmapType)type);
if ( handler )
return handler->LoadFile(this, filename, type, desiredWidth, desiredHeight);
else
return FALSE;
UnRef();
m_refData = new wxBitmapRefData;
wxBitmapHandler *handler = FindHandler((wxBitmapType)type);
if ( handler )
return handler->LoadFile(this, filename, type, desiredWidth, desiredHeight);
else
return FALSE;
}
void wxIcon::CopyFromBitmap(const wxBitmap& bmp)
@@ -80,9 +80,9 @@ void wxIcon::CopyFromBitmap(const wxBitmap& bmp)
IMPLEMENT_DYNAMIC_CLASS(wxICONResourceHandler, wxBitmapHandler)
bool wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight)
int desiredWidth, int desiredHeight)
{
short theId = -1 ;
short theId = -1 ;
if ( name == "wxICON_INFORMATION" )
{
theId = kNoteIcon ;
@@ -93,46 +93,46 @@ bool wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, lo
}
else if ( name == "wxICON_WARNING" )
{
theId = kCautionIcon ;
}
theId = kCautionIcon ;
}
else if ( name == "wxICON_ERROR" )
{
theId = kStopIcon ;
}
else
{
Str255 theName ;
OSType theType ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) theName , name ) ;
#else
strcpy( (char *) theName , name ) ;
c2pstr( (char *) theName ) ;
#endif
Handle resHandle = GetNamedResource( 'cicn' , theName ) ;
if ( resHandle != 0L )
{
GetResInfo( resHandle , &theId , &theType , theName ) ;
ReleaseResource( resHandle ) ;
}
Str255 theName ;
OSType theType ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) theName , name ) ;
#else
strcpy( (char *) theName , name ) ;
c2pstr( (char *) theName ) ;
#endif
Handle resHandle = GetNamedResource( 'cicn' , theName ) ;
if ( resHandle != 0L )
{
GetResInfo( resHandle , &theId , &theType , theName ) ;
ReleaseResource( resHandle ) ;
}
}
if ( theId != -1 )
{
CIconHandle theIcon = (CIconHandle ) GetCIcon( theId ) ;
if ( theIcon )
{
M_BITMAPHANDLERDATA->m_hIcon = theIcon ;
M_BITMAPHANDLERDATA->m_width = 32 ;
M_BITMAPHANDLERDATA->m_height = 32 ;
M_BITMAPHANDLERDATA->m_depth = 8 ;
M_BITMAPHANDLERDATA->m_ok = true ;
M_BITMAPHANDLERDATA->m_numColors = 256 ;
M_BITMAPHANDLERDATA->m_bitmapType = kMacBitmapTypeIcon ;
return TRUE ;
}
}
return FALSE ;
if ( theId != -1 )
{
CIconHandle theIcon = (CIconHandle ) GetCIcon( theId ) ;
if ( theIcon )
{
M_BITMAPHANDLERDATA->m_hIcon = theIcon ;
M_BITMAPHANDLERDATA->m_width = 32 ;
M_BITMAPHANDLERDATA->m_height = 32 ;
M_BITMAPHANDLERDATA->m_depth = 8 ;
M_BITMAPHANDLERDATA->m_ok = true ;
M_BITMAPHANDLERDATA->m_numColors = 256 ;
M_BITMAPHANDLERDATA->m_bitmapType = kMacBitmapTypeIcon ;
return TRUE ;
}
}
return FALSE ;
}

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -282,5 +282,5 @@ bool wxJoystick::ReleaseCapture()
}
#endif
// wxUSE_JOYSTICK
// wxUSE_JOYSTICK

View File

@@ -24,11 +24,11 @@
#include "wx/utils.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
BEGIN_EVENT_TABLE(wxListBox, wxControl)
EVT_SIZE( wxListBox::OnSize )
EVT_CHAR( wxListBox::OnChar )
EVT_SIZE( wxListBox::OnSize )
EVT_CHAR( wxListBox::OnChar )
END_EVENT_TABLE()
#endif
@@ -43,8 +43,8 @@ END_EVENT_TABLE()
#endif
typedef struct {
unsigned short instruction;
void (*function)();
unsigned short instruction;
void (*function)();
} ldefRec, *ldefPtr, **ldefHandle;
#if PRAGMA_STRUCT_ALIGN
@@ -77,105 +77,105 @@ static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect
RgnHandle savedClipRegion;
SInt32 savedPenMode;
wxListBox* list;
GetPort(&savePort);
SetPort((**listHandle).port);
grafPtr = (**listHandle).port ;
GetPort(&savePort);
SetPort((**listHandle).port);
grafPtr = (**listHandle).port ;
// typecast our refCon
list = (wxListBox*) GetControlReference( (ControlHandle) GetListRefCon(listHandle) );
// Calculate the cell rect.
switch( message ) {
case lInitMsg:
break;
case lCloseMsg:
break;
case lDrawMsg:
case lInitMsg:
break;
case lCloseMsg:
break;
case lDrawMsg:
{
const wxString text = list->m_stringArray[cell.v] ;
// Save the current clip region, and set the clip region to the area we are about
// to draw.
savedClipRegion = NewRgn();
GetClip( savedClipRegion );
ClipRect( drawRect );
EraseRect( drawRect );
wxFontRefData * font = (wxFontRefData*) list->GetFont().GetRefData() ;
if ( font )
{
::TextFont( font->m_macFontNum ) ;
::TextSize( short(font->m_macFontSize) ) ;
::TextFace( font->m_macFontStyle ) ;
}
else
{
::TextFont( kFontIDMonaco ) ;
::TextSize( 9 );
::TextFace( 0 ) ;
}
wxFontRefData * font = (wxFontRefData*) list->GetFont().GetRefData() ;
if ( font )
{
::TextFont( font->m_macFontNum ) ;
::TextSize( short(font->m_macFontSize) ) ;
::TextFace( font->m_macFontStyle ) ;
}
else
{
::TextFont( kFontIDMonaco ) ;
::TextSize( 9 );
::TextFace( 0 ) ;
}
#if TARGET_CARBON
bool useDrawThemeText = ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
if ( useDrawThemeText )
{
Rect frame = { drawRect->top, drawRect->left + 4,
drawRect->top + kwxMacListItemHeight, drawRect->right + 10000 } ;
bool useDrawThemeText = ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
if ( useDrawThemeText )
{
Rect frame = { drawRect->top, drawRect->left + 4,
drawRect->top + kwxMacListItemHeight, drawRect->right + 10000 } ;
CFStringRef sString = CFStringCreateWithBytes( NULL , (UInt8*) text.c_str(), text.Length(), CFStringGetSystemEncoding(), false ) ;
CFMutableStringRef mString = CFStringCreateMutableCopy( NULL , 0 , sString ) ;
CFRelease( sString ) ;
::TruncateThemeText( mString , kThemeCurrentPortFont, kThemeStateActive, drawRect->right - drawRect->left , truncEnd , NULL ) ;
::DrawThemeTextBox( mString,
kThemeCurrentPortFont,
kThemeStateActive,
false,
&frame,
teJustLeft,
nil );
CFRelease( mString ) ;
CFRelease( sString ) ;
::TruncateThemeText( mString , kThemeCurrentPortFont, kThemeStateActive, drawRect->right - drawRect->left , truncEnd , NULL ) ;
::DrawThemeTextBox( mString,
kThemeCurrentPortFont,
kThemeStateActive,
false,
&frame,
teJustLeft,
nil );
CFRelease( mString ) ;
}
else
else
#endif
{
MoveTo(drawRect->left + 4 , drawRect->top + 10 );
DrawText(text, 0 , text.Length());
}
{
MoveTo(drawRect->left + 4 , drawRect->top + 10 );
DrawText(text, 0 , text.Length());
}
// If the cell is hilited, do the hilite now. Paint the cell contents with the
// appropriate QuickDraw transform mode.
if( isSelected ) {
savedPenMode = GetPortPenMode( (CGrafPtr) grafPtr );
SetPortPenMode( (CGrafPtr)grafPtr, hilitetransfermode );
PaintRect( drawRect );
SetPortPenMode( (CGrafPtr)grafPtr, savedPenMode );
}
// Restore the saved clip region.
SetClip( savedClipRegion );
DisposeRgn( savedClipRegion );
}
break;
case lHiliteMsg:
// Hilite or unhilite the cell. Paint the cell contents with the
// appropriate QuickDraw transform mode.
GetPort( &grafPtr );
savedPenMode = GetPortPenMode( (CGrafPtr)grafPtr );
SetPortPenMode( (CGrafPtr)grafPtr, hilitetransfermode );
PaintRect( drawRect );
SetPortPenMode( (CGrafPtr)grafPtr, savedPenMode );
break;
default :
break ;
}
break;
case lHiliteMsg:
// Hilite or unhilite the cell. Paint the cell contents with the
// appropriate QuickDraw transform mode.
GetPort( &grafPtr );
savedPenMode = GetPortPenMode( (CGrafPtr)grafPtr );
SetPortPenMode( (CGrafPtr)grafPtr, hilitetransfermode );
PaintRect( drawRect );
SetPortPenMode( (CGrafPtr)grafPtr, savedPenMode );
break;
default :
break ;
}
SetPort(savePort);
}
@@ -212,27 +212,27 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
Rect bounds ;
Str255 title ;
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
ListDefSpec listDef;
listDef.defType = kListDefUserProcType;
if ( macListDefUPP == NULL )
{
macListDefUPP = NewListDefUPP( wxMacListDefinition );
macListDefUPP = NewListDefUPP( wxMacListDefinition );
}
listDef.u.userProc = macListDefUPP ;
listDef.u.userProc = macListDefUPP ;
Str255 fontName ;
SInt16 fontSize ;
Style fontStyle ;
SInt16 fontNum ;
SInt16 fontNum ;
#if TARGET_CARBON
GetThemeFont(kThemeViewsFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
GetThemeFont(kThemeViewsFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
#else
GetFontName( kFontIDMonaco , fontName ) ;
fontSize = 9 ;
fontStyle = normal ;
GetFontName( kFontIDMonaco , fontName ) ;
fontSize = 9 ;
fontStyle = normal ;
#endif
CopyPascalStringToC( fontName , (char*) fontName ) ;
SetFont( wxFont (fontSize, wxSWISS, wxNORMAL, wxNORMAL , false , fontName ) ) ;
@@ -307,8 +307,8 @@ wxListBox::~wxListBox()
if ( m_macList )
{
#if !TARGET_CARBON
DisposeHandle( (**(ListHandle)m_macList).listDefProc ) ;
(**(ListHandle)m_macList).listDefProc = NULL ;
DisposeHandle( (**(ListHandle)m_macList).listDefProc ) ;
(**(ListHandle)m_macList).listDefProc = NULL ;
#endif
m_macList = NULL ;
}
@@ -406,25 +406,25 @@ int wxListBox::DoAppend(const wxString& item)
void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
{
MacSetRedraw( false ) ;
Clear() ;
int n = choices.GetCount();
for( int i = 0 ; i < n ; ++i )
{
if ( clientData )
MacSetRedraw( false ) ;
Clear() ;
int n = choices.GetCount();
for( int i = 0 ; i < n ; ++i )
{
if ( clientData )
{
#if wxUSE_OWNER_DRAWN
wxASSERT_MSG(clientData[i] == NULL,
wxT("Can't use client data with owner-drawn listboxes"));
wxT("Can't use client data with owner-drawn listboxes"));
#else // !wxUSE_OWNER_DRAWN
Append( choices[i] , clientData[i] ) ;
#endif
Append( choices[i] , clientData[i] ) ;
#endif
}
else
Append( choices[i] ) ;
}
else
Append( choices[i] ) ;
}
#if wxUSE_OWNER_DRAWN
if ( m_windowStyle & wxLB_OWNERDRAW ) {
// first delete old items
@@ -434,7 +434,7 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
m_aItems[ui] = NULL;
}
m_aItems.Empty();
// then create new ones
for ( ui = 0; ui < (size_t)m_noItems; ui++ ) {
wxOwnerDrawn *pNewItem = CreateItem(ui);
@@ -443,7 +443,7 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
}
}
#endif // wxUSE_OWNER_DRAWN
MacSetRedraw( true ) ;
MacSetRedraw( true ) ;
}
bool wxListBox::HasMultipleSelection() const
@@ -460,20 +460,20 @@ int wxListBox::FindString(const wxString& st) const
}
else
s = st ;
if ( s.Right(1) == "*" )
{
wxString search = s.Left( s.Length() - 1 ) ;
int len = search.Length() ;
Str255 s1 , s2 ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) s2 , search.c_str() ) ;
#else
strcpy( (char *) s2 , search.c_str() ) ;
c2pstr( (char *) s2 ) ;
#endif
for ( int i = 0 ; i < m_noItems ; ++ i )
{
#if TARGET_CARBON
@@ -495,19 +495,19 @@ int wxListBox::FindString(const wxString& st) const
return i ;
}
}
}
else
{
Str255 s1 , s2 ;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) s2 , s.c_str() ) ;
#else
strcpy( (char *) s2 , s.c_str() ) ;
c2pstr( (char *) s2 ) ;
#endif
for ( int i = 0 ; i < m_noItems ; ++ i )
{
#if TARGET_CARBON
@@ -519,40 +519,40 @@ int wxListBox::FindString(const wxString& st) const
if ( EqualString( s1 , s2 , false , false ) )
return i ;
}
}
return -1;
}
return -1;
}
void wxListBox::Clear()
{
FreeData();
m_noItems = 0;
m_stringArray.Empty() ;
m_dataArray.Empty() ;
MacClear() ;
FreeData();
m_noItems = 0;
m_stringArray.Empty() ;
m_dataArray.Empty() ;
MacClear() ;
}
void wxListBox::SetSelection(int N, bool select)
{
wxCHECK_RET( N >= 0 && N < m_noItems,
"invalid index in wxListBox::SetSelection" );
MacSetSelection( N , select ) ;
GetSelections( m_selectionPreImage ) ;
"invalid index in wxListBox::SetSelection" );
MacSetSelection( N , select ) ;
GetSelections( m_selectionPreImage ) ;
}
bool wxListBox::IsSelected(int N) const
{
wxCHECK_MSG( N >= 0 && N < m_noItems, FALSE,
"invalid index in wxListBox::Selected" );
return MacIsSelected( N ) ;
"invalid index in wxListBox::Selected" );
return MacIsSelected( N ) ;
}
void *wxListBox::DoGetItemClientData(int N) const
{
wxCHECK_MSG( N >= 0 && N < m_noItems, NULL,
wxT("invalid index in wxListBox::GetClientData"));
wxT("invalid index in wxListBox::GetClientData"));
return (void *)m_dataArray[N];
}
@@ -564,8 +564,8 @@ wxClientData *wxListBox::DoGetItemClientObject(int N) const
void wxListBox::DoSetItemClientData(int N, void *Client_data)
{
wxCHECK_RET( N >= 0 && N < m_noItems,
"invalid index in wxListBox::SetClientData" );
"invalid index in wxListBox::SetClientData" );
#if wxUSE_OWNER_DRAWN
if ( m_windowStyle & wxLB_OWNERDRAW )
{
@@ -575,7 +575,7 @@ void wxListBox::DoSetItemClientData(int N, void *Client_data)
}
#endif // wxUSE_OWNER_DRAWN
wxASSERT_MSG( m_dataArray.GetCount() >= (size_t) N , "invalid client_data array" ) ;
if ( m_dataArray.GetCount() > (size_t) N )
{
m_dataArray[N] = (char*) Client_data ;
@@ -617,17 +617,17 @@ wxString wxListBox::GetString(int N) const
void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
{
wxCHECK_RET( pos >= 0 && pos <= m_noItems,
wxT("invalid index in wxListBox::InsertItems") );
wxT("invalid index in wxListBox::InsertItems") );
int nItems = items.GetCount();
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] ) ;
}
m_noItems += nItems;
}
@@ -649,44 +649,44 @@ wxSize wxListBox::DoGetBestSize() const
int lbWidth = 100; // some defaults
int lbHeight = 110;
int wLine;
{
wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ;
wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
if ( font )
{
::TextFont( font->m_macFontNum ) ;
::TextSize( short(font->m_macFontSize) ) ;
::TextFace( font->m_macFontStyle ) ;
}
else
{
::TextFont( kFontIDMonaco ) ;
::TextSize( 9 );
::TextFace( 0 ) ;
}
// Find the widest line
for(int i = 0; i < GetCount(); i++) {
wxString str(GetString(i));
wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
lbWidth = wxMax(lbWidth, wLine);
}
// Add room for the scrollbar
lbWidth += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
// And just a bit more
int cy = 12 ;
int cx = ::TextWidth( "X" , 0 , 1 ) ;
lbWidth += cx ;
// don't make the listbox too tall (limit height to around 10 items) but don't
// make it too small neither
lbHeight = (cy+4) * wxMin(wxMax(GetCount(), 3), 10);
}
{
wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ;
wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
if ( font )
{
::TextFont( font->m_macFontNum ) ;
::TextSize( short(font->m_macFontSize) ) ;
::TextFace( font->m_macFontStyle ) ;
}
else
{
::TextFont( kFontIDMonaco ) ;
::TextSize( 9 );
::TextFace( 0 ) ;
}
// Find the widest line
for(int i = 0; i < GetCount(); i++) {
wxString str(GetString(i));
wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
lbWidth = wxMax(lbWidth, wLine);
}
// Add room for the scrollbar
lbWidth += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
// And just a bit more
int cy = 12 ;
int cx = ::TextWidth( "X" , 0 , 1 ) ;
lbWidth += cx ;
// don't make the listbox too tall (limit height to around 10 items) but don't
// make it too small neither
lbHeight = (cy+4) * wxMin(wxMax(GetCount(), 3), 10);
}
return wxSize(lbWidth, lbHeight);
}
@@ -704,7 +704,7 @@ void wxListBox::SetupColours()
void wxListBox::Refresh(bool eraseBack, const wxRect *rect)
{
wxControl::Refresh( eraseBack , rect ) ;
// MacRedrawControl() ;
// MacRedrawControl() ;
}
#if wxUSE_OWNER_DRAWN
@@ -735,18 +735,18 @@ wxOwnerDrawn *wxListBox::CreateItem(size_t n)
/*
void MacDrawStringCell(Rect *cellRect, Cell lCell, ListHandle theList, long refCon)
{
wxListBox* list;
// typecast our refCon
list = (wxListBox*)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());
}
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 )
{
@@ -759,7 +759,7 @@ void wxListBox::MacInsert( int n , const char * text)
Cell cell = { 0 , 0 } ;
cell.v = n ;
LAddRow( 1 , cell.v , (ListHandle)m_macList ) ;
// LSetCell(text, strlen(text), cell, m_macList);
// LSetCell(text, strlen(text), cell, m_macList);
Refresh();
}
@@ -768,7 +768,7 @@ void wxListBox::MacAppend( const char * text)
Cell cell = { 0 , 0 } ;
cell.v = (**(ListHandle)m_macList).dataBounds.bottom ;
LAddRow( 1 , cell.v , (ListHandle)m_macList ) ;
// LSetCell(text, strlen(text), cell, m_macList);
// LSetCell(text, strlen(text), cell, m_macList);
Refresh();
}
@@ -788,7 +788,7 @@ void wxListBox::MacSetSelection( int n , bool select )
LSetSelect( false , cell , (ListHandle)m_macList ) ;
}
}
cell.v = n ;
LSetSelect( select , cell , (ListHandle)m_macList ) ;
LAutoScroll( (ListHandle)m_macList ) ;
@@ -804,7 +804,7 @@ bool wxListBox::MacIsSelected( int n ) const
void wxListBox::MacDestroy()
{
// DisposeExtLDEFInfo( m_macList ) ;
// DisposeExtLDEFInfo( m_macList ) ;
}
int wxListBox::MacGetSelection() const
@@ -819,12 +819,12 @@ int wxListBox::MacGetSelection() const
int wxListBox::MacGetSelections( wxArrayInt& aSelections ) const
{
int no_sel = 0 ;
aSelections.Empty();
Cell cell = { 0 , 0 } ;
cell.v = 0 ;
while ( LGetSelect( true , &cell ,(ListHandle) m_macList ) )
{
aSelections.Add( cell.v ) ;
@@ -840,7 +840,7 @@ void wxListBox::MacSet( int n , const char * text )
// so we just have to redraw
Cell cell = { 0 , 0 } ;
cell.v = n ;
// LSetCell(text, strlen(text), cell, m_macList);
// LSetCell(text, strlen(text), cell, m_macList);
Refresh();
}
@@ -852,7 +852,7 @@ void wxListBox::MacScrollTo( int n )
void wxListBox::OnSize( const wxSizeEvent &event)
{
Point pt;
#if TARGET_CARBON
GetListCellSize((ListHandle)m_macList, &pt);
#else
@@ -866,7 +866,7 @@ void wxListBox::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
{
Boolean wasDoubleClick = false ;
long result ;
::GetControlData( (ControlHandle) m_macControl , kControlNoPart , kControlListBoxDoubleClickTag , sizeof( wasDoubleClick ) , (char*) &wasDoubleClick , &result ) ;
if ( !wasDoubleClick )
{
@@ -881,7 +881,7 @@ void wxListBox::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
void wxListBox::MacSetRedraw( bool doDraw )
{
LSetDrawingMode( doDraw , (ListHandle)m_macList ) ;
}
void wxListBox::MacDoClick()
@@ -889,7 +889,7 @@ void wxListBox::MacDoClick()
wxArrayInt aSelections;
int n ;
size_t count = GetSelections(aSelections);
if ( count == m_selectionPreImage.GetCount() )
{
bool hasChanged = false ;
@@ -906,12 +906,12 @@ void wxListBox::MacDoClick()
return ;
}
}
m_selectionPreImage = aSelections;
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
event.SetEventObject( this );
if ( count > 0 )
{
n = aSelections[0];
@@ -923,11 +923,11 @@ void wxListBox::MacDoClick()
}
else
{
n = -1;
n = -1;
}
event.m_commandInt = n;
GetEventHandler()->ProcessEvent(event);
}
@@ -935,35 +935,35 @@ void wxListBox::MacDoDoubleClick()
{
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, m_windowId);
event.SetEventObject( this );
GetEventHandler()->ProcessEvent(event) ;
GetEventHandler()->ProcessEvent(event) ;
}
void wxListBox::OnChar(wxKeyEvent& event)
{
if ( event.GetKeyCode() == WXK_RETURN || event.GetKeyCode() == WXK_NUMPAD_ENTER)
{
wxWindow* parent = GetParent() ;
while( parent && !parent->IsTopLevel() && parent->GetDefaultItem() == NULL )
parent = parent->GetParent() ;
if ( parent && parent->GetDefaultItem() )
{
wxButton *def = wxDynamicCast(parent->GetDefaultItem(),
wxButton);
if ( def && def->IsEnabled() )
{
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
event.SetEventObject(def);
def->Command(event);
return ;
}
}
event.Skip() ;
wxWindow* parent = GetParent() ;
while( parent && !parent->IsTopLevel() && parent->GetDefaultItem() == NULL )
parent = parent->GetParent() ;
if ( parent && parent->GetDefaultItem() )
{
wxButton *def = wxDynamicCast(parent->GetDefaultItem(),
wxButton);
if ( def && def->IsEnabled() )
{
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
event.SetEventObject(def);
def->Command(event);
return ;
}
}
event.Skip() ;
}
/* generate wxID_CANCEL if command-. or <esc> has been pressed (typically in dialogs) */
else if (event.GetKeyCode() == WXK_ESCAPE || (event.GetKeyCode() == '.' && event.MetaDown() ) )
{
wxWindow* win = GetParent()->FindWindow( wxID_CANCEL ) ;
wxWindow* win = GetParent()->FindWindow( wxID_CANCEL ) ;
wxCommandEvent new_event(wxEVT_COMMAND_BUTTON_CLICKED,wxID_CANCEL);
new_event.SetEventObject( win );
win->GetEventHandler()->ProcessEvent( new_event );
@@ -977,64 +977,64 @@ void wxListBox::OnChar(wxKeyEvent& event)
new_event.SetWindowChange( event.ControlDown() );
new_event.SetCurrentFocus( this );
if ( !GetEventHandler()->ProcessEvent( new_event ) )
event.Skip() ;
event.Skip() ;
}
else if ( event.GetKeyCode() == WXK_DOWN || event.GetKeyCode() == WXK_UP )
{
// perform the default key handling first
wxControl::OnKeyDown( event ) ;
else if ( event.GetKeyCode() == WXK_DOWN || event.GetKeyCode() == WXK_UP )
{
// perform the default key handling first
wxControl::OnKeyDown( event ) ;
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
event.SetEventObject( this );
wxArrayInt aSelections;
int n, count = GetSelections(aSelections);
if ( count > 0 )
{
n = aSelections[0];
if ( HasClientObjectData() )
event.SetClientObject( GetClientObject(n) );
else if ( HasClientUntypedData() )
event.SetClientData( GetClientData(n) );
event.SetString( GetString(n) );
n = aSelections[0];
if ( HasClientObjectData() )
event.SetClientObject( GetClientObject(n) );
else if ( HasClientUntypedData() )
event.SetClientData( GetClientData(n) );
event.SetString( GetString(n) );
}
else
{
n = -1;
n = -1;
}
event.m_commandInt = n;
GetEventHandler()->ProcessEvent(event);
}
else
{
if ( event.GetTimestamp() > m_lastTypeIn + 60 )
{
m_typeIn = "" ;
}
m_lastTypeIn = event.GetTimestamp() ;
m_typeIn += (char) event.GetKeyCode() ;
int line = FindString("*"+m_typeIn+"*") ;
if ( line >= 0 )
{
if ( GetSelection() != line )
{
SetSelection(line) ;
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
event.SetEventObject( this );
if ( HasClientObjectData() )
event.SetClientObject( GetClientObject( line ) );
else if ( HasClientUntypedData() )
event.SetClientData( GetClientData(line) );
event.SetString( GetString(line) );
event.m_commandInt = line ;
GetEventHandler()->ProcessEvent(event);
}
}
}
}
else
{
if ( event.GetTimestamp() > m_lastTypeIn + 60 )
{
m_typeIn = "" ;
}
m_lastTypeIn = event.GetTimestamp() ;
m_typeIn += (char) event.GetKeyCode() ;
int line = FindString("*"+m_typeIn+"*") ;
if ( line >= 0 )
{
if ( GetSelection() != line )
{
SetSelection(line) ;
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
event.SetEventObject( this );
if ( HasClientObjectData() )
event.SetClientObject( GetClientObject( line ) );
else if ( HasClientUntypedData() )
event.SetClientData( GetClientData(line) );
event.SetString( GetString(line) );
event.m_commandInt = line ;
GetEventHandler()->ProcessEvent(event);
}
}
}
}

View File

@@ -17,12 +17,12 @@ const short kMaxEvents = 1000 ;
struct wxMacNotificationEvents
{
short top ;
short bottom ;
wxMacNotificationProcPtr proc[kMaxEvents] ;
unsigned long events[kMaxEvents] ;
void* data[kMaxEvents] ;
short top ;
short bottom ;
wxMacNotificationProcPtr proc[kMaxEvents] ;
unsigned long events[kMaxEvents] ;
void* data[kMaxEvents] ;
} ;
typedef struct wxMacNotificationEvents wxMacNotificationEvents ;
@@ -32,43 +32,43 @@ ProcessSerialNumber gAppProcess ;
void wxMacWakeUp()
{
ProcessSerialNumber psn ;
Boolean isSame ;
psn.highLongOfPSN = 0 ;
psn.lowLongOfPSN = kCurrentProcess ;
SameProcess( &gAppProcess , &psn , &isSame ) ;
if ( isSame )
{
ProcessSerialNumber psn ;
Boolean isSame ;
psn.highLongOfPSN = 0 ;
psn.lowLongOfPSN = kCurrentProcess ;
SameProcess( &gAppProcess , &psn , &isSame ) ;
if ( isSame )
{
#if TARGET_CARBON
EventRef dummyEvent ;
OSStatus err = MacCreateEvent(nil, 'WXMC', 'WXMC', GetCurrentEventTime(),
EventRef dummyEvent ;
OSStatus err = MacCreateEvent(nil, 'WXMC', 'WXMC', GetCurrentEventTime(),
kEventAttributeNone, &dummyEvent);
if (err == noErr)
{
err = PostEventToQueue(GetMainEventQueue(), dummyEvent,
err = PostEventToQueue(GetMainEventQueue(), dummyEvent,
kEventPriorityHigh);
}
#else
PostEvent( nullEvent , 0 ) ;
PostEvent( nullEvent , 0 ) ;
#endif
}
else
{
WakeUpProcess( &gAppProcess ) ;
}
}
else
{
WakeUpProcess( &gAppProcess ) ;
}
}
void wxMacCreateNotifierTable()
{
GetCurrentProcess(&gAppProcess);
gMacNotificationEvents.top = 0 ;
gMacNotificationEvents.bottom = 0 ;
for ( int i = 0 ; i < kMaxEvents ; ++i )
{
gMacNotificationEvents.proc[i] = NULL ;
gMacNotificationEvents.events[i] = NULL ;
gMacNotificationEvents.data[i] = NULL ;
}
GetCurrentProcess(&gAppProcess);
gMacNotificationEvents.top = 0 ;
gMacNotificationEvents.bottom = 0 ;
for ( int i = 0 ; i < kMaxEvents ; ++i )
{
gMacNotificationEvents.proc[i] = NULL ;
gMacNotificationEvents.events[i] = NULL ;
gMacNotificationEvents.data[i] = NULL ;
}
}
void wxMacDestroyNotifierTable()
@@ -77,86 +77,86 @@ void wxMacDestroyNotifierTable()
wxMacNotifierTableRef wxMacGetNotifierTable()
{
return (wxMacNotifierTableRef) &gMacNotificationEvents ;
return (wxMacNotifierTableRef) &gMacNotificationEvents ;
}
void wxMacAddEvent(
wxMacNotifierTableRef table ,
wxMacNotificationProcPtr handler ,
unsigned long event ,
void* data ,
short wakeUp )
wxMacNotifierTableRef table ,
wxMacNotificationProcPtr handler ,
unsigned long event ,
void* data ,
short wakeUp )
{
wxMacNotificationEvents *e = (wxMacNotificationEvents *) table ;
wxASSERT_MSG( handler != NULL , "illegal notification proc ptr" ) ;
/* this should be protected eventually */
short index = e->top++ ;
if ( e->top == kMaxEvents )
e->top = 0 ;
wxMacNotificationEvents *e = (wxMacNotificationEvents *) table ;
wxASSERT_MSG( handler != NULL , "illegal notification proc ptr" ) ;
/* this should be protected eventually */
short index = e->top++ ;
if ( e->top == kMaxEvents )
e->top = 0 ;
e->proc[index] = handler ;
e->events[index] = event ;
e->data[index] = data ;
if ( wakeUp )
wxMacWakeUp() ;
e->proc[index] = handler ;
e->events[index] = event ;
e->data[index] = data ;
if ( wakeUp )
wxMacWakeUp() ;
}
bool gInProcessing = false ;
void wxMacRemoveAllNotifiersForData( wxMacNotifierTableRef table , void* data )
{
wxMacNotificationEvents *e = (wxMacNotificationEvents *) table ;
/* this should be protected eventually */
short index = e->bottom ;
while ( e->top != index )
{
if ( index == kMaxEvents )
index = 0 ;
if ( e->data[index] == data )
e->data[index] = NULL ;
index++ ;
}
wxMacNotificationEvents *e = (wxMacNotificationEvents *) table ;
/* this should be protected eventually */
short index = e->bottom ;
while ( e->top != index )
{
if ( index == kMaxEvents )
index = 0 ;
if ( e->data[index] == data )
e->data[index] = NULL ;
index++ ;
}
}
void wxMacProcessNotifierEvents()
{
// if ( gInProcessing )
// return ;
gInProcessing = true ;
if ( gMacNotificationEvents.top != gMacNotificationEvents.bottom )
{
// we only should process the notifiers that were here when we entered it
// otherwise we might never get out...
short count = gMacNotificationEvents.top - gMacNotificationEvents.bottom ;
if ( count < 0 )
count += kMaxEvents ;
while ( count-- )
// if ( gInProcessing )
// return ;
gInProcessing = true ;
if ( gMacNotificationEvents.top != gMacNotificationEvents.bottom )
{
// consume event at bottom
short index = gMacNotificationEvents.bottom++ ;
if ( gMacNotificationEvents.bottom == kMaxEvents )
gMacNotificationEvents.bottom = 0 ;
void* data = gMacNotificationEvents.data[index] ;
unsigned long event = gMacNotificationEvents.events[index] ;
wxMacNotificationProcPtr handler = gMacNotificationEvents.proc[index] ;
gMacNotificationEvents.data[index] = NULL ;
gMacNotificationEvents.events[index] = NULL ;
gMacNotificationEvents.proc[index] = NULL ;
// we only should process the notifiers that were here when we entered it
// otherwise we might never get out...
short count = gMacNotificationEvents.top - gMacNotificationEvents.bottom ;
if ( count < 0 )
count += kMaxEvents ;
if ( handler )
handler( event , data ) ;
}
}
gInProcessing = false ;
while ( count-- )
{
// consume event at bottom
short index = gMacNotificationEvents.bottom++ ;
if ( gMacNotificationEvents.bottom == kMaxEvents )
gMacNotificationEvents.bottom = 0 ;
void* data = gMacNotificationEvents.data[index] ;
unsigned long event = gMacNotificationEvents.events[index] ;
wxMacNotificationProcPtr handler = gMacNotificationEvents.proc[index] ;
gMacNotificationEvents.data[index] = NULL ;
gMacNotificationEvents.events[index] = NULL ;
gMacNotificationEvents.proc[index] = NULL ;
if ( handler )
handler( event , data ) ;
}
}
gInProcessing = false ;
}
void wxMacProcessNotifierAndPendingEvents()
{
wxMacProcessNotifierEvents() ;
wxTheApp->ProcessPendingEvents() ;
wxMacProcessNotifierEvents() ;
wxTheApp->ProcessPendingEvents() ;
}

View File

@@ -6,13 +6,13 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/app.h"
WXDLLEXPORT int main(int argc, char* argv[])
{
return wxEntry(argc, argv);
return wxEntry(argc, argv);
}

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -71,33 +71,33 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
long style,
const wxString& name)
{
m_clientWindow = NULL;
m_currentChild = NULL;
// this style can be used to prevent a window from having the standard MDI
// "Window" menu
if ( style & wxFRAME_NO_WINDOW_MENU )
{
m_windowMenu = (wxMenu *)NULL;
style -= wxFRAME_NO_WINDOW_MENU ;
}
else // normal case: we have the window menu, so construct it
{
m_windowMenu = new wxMenu;
m_windowMenu->Append(IDM_WINDOWCASCADE, wxT("&Cascade"));
m_windowMenu->Append(IDM_WINDOWTILEHOR, wxT("Tile &Horizontally"));
m_windowMenu->Append(IDM_WINDOWTILEVERT, wxT("Tile &Vertically"));
m_windowMenu->AppendSeparator();
m_windowMenu->Append(IDM_WINDOWICONS, wxT("&Arrange Icons"));
m_windowMenu->Append(IDM_WINDOWNEXT, wxT("&Next"));
}
wxFrame::Create( parent , id , title , wxPoint( 2000 , 2000 ) , size , style , name ) ;
m_parentFrameActive = TRUE;
m_clientWindow = NULL;
m_currentChild = NULL;
// this style can be used to prevent a window from having the standard MDI
// "Window" menu
if ( style & wxFRAME_NO_WINDOW_MENU )
{
m_windowMenu = (wxMenu *)NULL;
style -= wxFRAME_NO_WINDOW_MENU ;
}
else // normal case: we have the window menu, so construct it
{
m_windowMenu = new wxMenu;
OnCreateClient();
m_windowMenu->Append(IDM_WINDOWCASCADE, wxT("&Cascade"));
m_windowMenu->Append(IDM_WINDOWTILEHOR, wxT("Tile &Horizontally"));
m_windowMenu->Append(IDM_WINDOWTILEVERT, wxT("Tile &Vertically"));
m_windowMenu->AppendSeparator();
m_windowMenu->Append(IDM_WINDOWICONS, wxT("&Arrange Icons"));
m_windowMenu->Append(IDM_WINDOWNEXT, wxT("&Next"));
}
wxFrame::Create( parent , id , title , wxPoint( 2000 , 2000 ) , size , style , name ) ;
m_parentFrameActive = TRUE;
OnCreateClient();
return TRUE;
}
@@ -108,13 +108,13 @@ wxMDIParentFrame::~wxMDIParentFrame()
m_frameToolBar = NULL;
m_frameStatusBar = NULL;
m_clientWindow = NULL ;
if (m_windowMenu)
{
delete m_windowMenu;
m_windowMenu = (wxMenu*) NULL;
}
if ( m_clientWindow )
{
delete m_clientWindow;
@@ -126,51 +126,51 @@ wxMDIParentFrame::~wxMDIParentFrame()
// Get size *available for subwindows* i.e. excluding menu bar.
void wxMDIParentFrame::DoGetClientSize(int *x, int *y) const
{
wxDisplaySize( x , y ) ;
wxDisplaySize( x , y ) ;
}
void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
{
wxFrame::SetMenuBar( menu_bar ) ;
wxFrame::SetMenuBar( menu_bar ) ;
}
void wxMDIParentFrame::OnSize(wxSizeEvent& event)
{
#if wxUSE_CONSTRAINTS
if (GetAutoLayout())
Layout();
Layout();
#endif
int x = 0;
int y = 0;
int width, height;
GetClientSize(&width, &height);
if ( GetClientWindow() )
GetClientWindow()->SetSize(x, y, width, height);
}
void wxMDIParentFrame::OnActivate(wxActivateEvent& event)
{
if ( m_currentChild && event.GetActive() )
{
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, m_currentChild->GetId());
event.SetEventObject( m_currentChild );
m_currentChild->GetEventHandler()->ProcessEvent(event) ;
}
else if ( event.GetActive() )
{
if ( m_frameMenuBar != NULL )
{
m_frameMenuBar->MacInstallMenuBar() ;
}
}
if ( m_currentChild && event.GetActive() )
{
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, m_currentChild->GetId());
event.SetEventObject( m_currentChild );
m_currentChild->GetEventHandler()->ProcessEvent(event) ;
}
else if ( event.GetActive() )
{
if ( m_frameMenuBar != NULL )
{
m_frameMenuBar->MacInstallMenuBar() ;
}
}
}
// Returns the active MDI child window
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
{
return m_currentChild ;
return m_currentChild ;
}
// Create the client window class (don't Create the window,
@@ -185,7 +185,7 @@ wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
{
// TODO
// Propagate the event to the non-top-level children
wxFrame::OnSysColourChanged(event);
}
@@ -227,27 +227,27 @@ void wxMDIChildFrame::Init()
}
bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name)
wxWindowID id,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name)
{
SetName(name);
if ( id > -1 )
m_windowId = id;
else
m_windowId = (int)NewControlId();
if (parent) parent->AddChild(this);
MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
wxModelessWindows.Append(this);
return FALSE;
}
@@ -262,7 +262,7 @@ wxMDIChildFrame::~wxMDIChildFrame()
void wxMDIChildFrame::SetMenuBar(wxMenuBar *menu_bar)
{
return wxFrame::SetMenuBar( menu_bar ) ;
return wxFrame::SetMenuBar( menu_bar ) ;
}
// MDI operations
@@ -295,15 +295,15 @@ wxMDIClientWindow::~wxMDIClientWindow()
bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
{
m_windowId = (int)NewControlId();
if ( parent )
{
parent->AddChild(this);
parent->AddChild(this);
}
m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE);
wxModelessWindows.Append(this);
return TRUE;
}

View File

@@ -6,10 +6,9 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "menu.h"
#pragma implementation "menuitem.h"
@@ -70,8 +69,8 @@ void wxMenu::Init()
m_startRadioGroup = -1;
// create the menu
m_macMenuId = s_macNextMenuId++;
m_hMenu = UMANewMenu(m_macMenuId, m_title);
m_macMenuId = s_macNextMenuId++;
m_hMenu = UMANewMenu(m_macMenuId, m_title);
if ( !m_hMenu )
{
@@ -88,13 +87,13 @@ void wxMenu::Init()
wxMenu::~wxMenu()
{
if (MAC_WXHMENU(m_hMenu))
::DisposeMenu(MAC_WXHMENU(m_hMenu));
if (MAC_WXHMENU(m_hMenu))
::DisposeMenu(MAC_WXHMENU(m_hMenu));
}
void wxMenu::Break()
{
// not available on the mac platform
// not available on the mac platform
}
void wxMenu::Attach(wxMenuBarBase *menubar)
@@ -110,60 +109,60 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
{
wxASSERT_MSG( pItem != NULL, "can't append NULL item to the menu" );
if ( pItem->IsSeparator() )
{
if ( pos == (size_t)-1 )
MacAppendMenu(MAC_WXHMENU(m_hMenu), "\p-");
else
MacInsertMenuItem(MAC_WXHMENU(m_hMenu), "\p-" , pos);
}
else
{
wxMenu *pSubMenu = pItem->GetSubMenu() ;
if ( pSubMenu != NULL )
{
wxASSERT_MSG( pSubMenu->m_hMenu != NULL , "invalid submenu added");
pSubMenu->m_menuParent = this ;
if (wxMenuBar::MacGetInstalledMenuBar() == m_menuBar)
::InsertMenu( MAC_WXHMENU( pSubMenu->m_hMenu ) , -1 ) ;
if ( pos == (size_t)-1 )
UMAAppendSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText(), pSubMenu->m_macMenuId);
else
UMAInsertSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText() , pos, pSubMenu->m_macMenuId);
pItem->UpdateItemBitmap() ;
pItem->UpdateItemStatus() ;
}
else
{
if ( pos == (size_t)-1 )
{
UMAAppendMenuItem(MAC_WXHMENU(m_hMenu), "a" );
pos = CountMenuItems(MAC_WXHMENU(m_hMenu)) ;
}
else
{
UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), "a" , pos);
}
if ( pItem->IsSeparator() )
{
if ( pos == (size_t)-1 )
MacAppendMenu(MAC_WXHMENU(m_hMenu), "\p-");
else
MacInsertMenuItem(MAC_WXHMENU(m_hMenu), "\p-" , pos);
}
else
{
wxMenu *pSubMenu = pItem->GetSubMenu() ;
if ( pSubMenu != NULL )
{
wxASSERT_MSG( pSubMenu->m_hMenu != NULL , "invalid submenu added");
pSubMenu->m_menuParent = this ;
if (wxMenuBar::MacGetInstalledMenuBar() == m_menuBar)
::InsertMenu( MAC_WXHMENU( pSubMenu->m_hMenu ) , -1 ) ;
if ( pos == (size_t)-1 )
UMAAppendSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText(), pSubMenu->m_macMenuId);
else
UMAInsertSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText() , pos, pSubMenu->m_macMenuId);
pItem->UpdateItemBitmap() ;
pItem->UpdateItemStatus() ;
}
else
{
if ( pos == (size_t)-1 )
{
UMAAppendMenuItem(MAC_WXHMENU(m_hMenu), "a" );
pos = CountMenuItems(MAC_WXHMENU(m_hMenu)) ;
}
else
{
UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), "a" , pos);
}
SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , pos , pItem->GetId() ) ;
pItem->UpdateItemText() ;
pItem->UpdateItemBitmap() ;
pItem->UpdateItemStatus() ;
SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , pos , pItem->GetId() ) ;
pItem->UpdateItemText() ;
pItem->UpdateItemBitmap() ;
pItem->UpdateItemStatus() ;
if ( pItem->GetId() == idMenuTitle )
{
UMAEnableMenuItem(MAC_WXHMENU(m_hMenu) , pos , false ) ;
}
}
}
if ( pItem->GetId() == idMenuTitle )
{
UMAEnableMenuItem(MAC_WXHMENU(m_hMenu) , pos , false ) ;
}
}
}
// if we're already attached to the menubar, we must update it
if ( IsAttached() )
{
m_menuBar->Refresh();
}
return TRUE ;
return TRUE ;
}
void wxMenu::EndRadioGroup()
@@ -250,7 +249,7 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
// DoRemove() (unlike Remove) can only be called for existing item!
wxCHECK_MSG( node, NULL, wxT("bug in wxMenu::Remove logic") );
::DeleteMenuItem(MAC_WXHMENU(m_hMenu) , pos + 1);
::DeleteMenuItem(MAC_WXHMENU(m_hMenu) , pos + 1);
if ( IsAttached() )
{
@@ -264,8 +263,8 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
void wxMenu::SetTitle(const wxString& label)
{
m_title = label ;
UMASetMenuTitle(MAC_WXHMENU(m_hMenu) , label ) ;
m_title = label ;
UMASetMenuTitle(MAC_WXHMENU(m_hMenu) , label ) ;
}
bool wxMenu::ProcessCommand(wxCommandEvent & event)
{
@@ -324,11 +323,11 @@ int wxMenu::MacGetIndexFromId( int id )
node = node->GetNext();
}
if (!node)
return 0;
return pos + 1 ;
return 0;
return pos + 1 ;
}
int wxMenu::MacGetIndexFromItem( wxMenuItem *pItem )
@@ -344,16 +343,16 @@ int wxMenu::MacGetIndexFromItem( wxMenuItem *pItem )
}
if (!node)
return 0;
return pos + 1 ;
return 0;
return pos + 1 ;
}
void wxMenu::MacEnableMenu( bool bDoEnable )
{
UMAEnableMenuItem(MAC_WXHMENU(m_hMenu) , 0 , bDoEnable ) ;
::DrawMenuBar() ;
UMAEnableMenuItem(MAC_WXHMENU(m_hMenu) , 0 , bDoEnable ) ;
::DrawMenuBar() ;
}
// Menu Bar
@@ -412,11 +411,11 @@ wxMenuBar::wxMenuBar(int count, wxMenu *menus[], const wxString titles[])
wxMenuBar::~wxMenuBar()
{
if (s_macInstalledMenuBar == this)
{
::ClearMenuBar();
s_macInstalledMenuBar = NULL;
}
if (s_macInstalledMenuBar == this)
{
::ClearMenuBar();
s_macInstalledMenuBar = NULL;
}
}
@@ -431,9 +430,9 @@ void wxMenuBar::MacInstallMenuBar()
{
if ( s_macInstalledMenuBar == this )
return ;
wxStAppResource resload ;
Handle menubar = ::GetNewMBar( kwxMacMenuBarResource ) ;
wxString message ;
wxCHECK_RET( menubar != NULL, "can't read MBAR resource" );
@@ -453,142 +452,142 @@ void wxMenuBar::MacInstallMenuBar()
#endif
// clean-up the help menu before adding new items
MenuHandle mh = NULL ;
if ( UMAGetHelpMenu( &mh , &firstUserHelpMenuItem) == noErr )
{
for ( int i = CountMenuItems( mh ) ; i >= firstUserHelpMenuItem ; --i )
{
DeleteMenuItem( mh , i ) ;
}
}
else
{
mh = NULL ;
}
MenuHandle mh = NULL ;
if ( UMAGetHelpMenu( &mh , &firstUserHelpMenuItem) == noErr )
{
for ( int i = CountMenuItems( mh ) ; i >= firstUserHelpMenuItem ; --i )
{
DeleteMenuItem( mh , i ) ;
}
}
else
{
mh = NULL ;
}
#if TARGET_CARBON
if ( UMAGetSystemVersion() >= 0x1000 && wxApp::s_macPreferencesMenuItemId)
{
wxMenuItem *item = FindItem( wxApp::s_macPreferencesMenuItemId , NULL ) ;
if ( item == NULL || !(item->IsEnabled()) )
DisableMenuCommand( NULL , kHICommandPreferences ) ;
else
EnableMenuCommand( NULL , kHICommandPreferences ) ;
}
if ( UMAGetSystemVersion() >= 0x1000 && wxApp::s_macPreferencesMenuItemId)
{
wxMenuItem *item = FindItem( wxApp::s_macPreferencesMenuItemId , NULL ) ;
if ( item == NULL || !(item->IsEnabled()) )
DisableMenuCommand( NULL , kHICommandPreferences ) ;
else
EnableMenuCommand( NULL , kHICommandPreferences ) ;
}
#endif
for (size_t i = 0; i < m_menus.GetCount(); i++)
{
Str255 label;
for (size_t i = 0; i < m_menus.GetCount(); i++)
{
Str255 label;
wxMenuItemList::Node *node;
wxMenuItem *item;
int pos ;
wxMenu* menu = m_menus[i] , *subMenu = NULL ;
wxMenu* menu = m_menus[i] , *subMenu = NULL ;
if( m_titles[i] == "?" || m_titles[i] == "&?" || m_titles[i] == wxApp::s_macHelpMenuTitleName )
{
if ( mh == NULL )
{
continue ;
}
for (pos = 0 , node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++)
{
item = (wxMenuItem *)node->GetData();
subMenu = item->GetSubMenu() ;
if (subMenu)
{
// we don't support hierarchical menus in the help menu yet
}
else
{
if ( item->IsSeparator() )
{
if ( mh )
MacAppendMenu(mh, "\p-" );
}
else
{
wxAcceleratorEntry* entry = wxGetAccelFromString( item->GetText() ) ;
if( m_titles[i] == "?" || m_titles[i] == "&?" || m_titles[i] == wxApp::s_macHelpMenuTitleName )
{
if ( mh == NULL )
{
continue ;
}
for (pos = 0 , node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++)
{
item = (wxMenuItem *)node->GetData();
subMenu = item->GetSubMenu() ;
if (subMenu)
{
// we don't support hierarchical menus in the help menu yet
}
else
{
if ( item->IsSeparator() )
{
if ( mh )
MacAppendMenu(mh, "\p-" );
}
else
{
wxAcceleratorEntry* entry = wxGetAccelFromString( item->GetText() ) ;
if ( item->GetId() == wxApp::s_macAboutMenuItemId )
{
UMASetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetText() );
UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 , true );
SetMenuItemCommandID( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetId() ) ;
UMASetMenuItemShortcut( GetMenuHandle( kwxMacAppleMenuId ) , 1 , entry ) ;
}
else
{
if ( mh )
{
UMAAppendMenuItem(mh, item->GetText() , entry );
SetMenuItemCommandID( mh , CountMenuItems(mh) , item->GetId() ) ;
}
}
delete entry ;
}
}
}
}
else
{
UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , m_titles[i] ) ;
wxArrayPtrVoid submenus ;
wxMenuItem* previousItem = NULL ;
for (pos = 0, node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++)
{
item = (wxMenuItem *)node->GetData();
subMenu = item->GetSubMenu() ;
if (subMenu)
{
submenus.Add(subMenu) ;
}
else
{
if ( item->GetId() == wxApp::s_macAboutMenuItemId )
{
UMASetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetText() );
UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 , true );
SetMenuItemCommandID( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetId() ) ;
UMASetMenuItemShortcut( GetMenuHandle( kwxMacAppleMenuId ) , 1 , entry ) ;
}
else
{
if ( mh )
{
UMAAppendMenuItem(mh, item->GetText() , entry );
SetMenuItemCommandID( mh , CountMenuItems(mh) , item->GetId() ) ;
}
}
delete entry ;
}
}
}
}
else
{
UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , m_titles[i] ) ;
wxArrayPtrVoid submenus ;
wxMenuItem* previousItem = NULL ;
for (pos = 0, node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++)
{
item = (wxMenuItem *)node->GetData();
subMenu = item->GetSubMenu() ;
if (subMenu)
{
submenus.Add(subMenu) ;
}
else
{
#if TARGET_CARBON
if ( UMAGetSystemVersion() >= 0x1000 )
{
if ( item->GetId() == wxApp::s_macPreferencesMenuItemId || item->GetId() == wxApp::s_macExitMenuItemId)
{
ChangeMenuItemAttributes( MAC_WXHMENU( menu->GetHMenu() ) , pos + 1, kMenuItemAttrHidden, 0 );
if ( menu->GetMenuItems().GetCount() == pos + 1 && previousItem != NULL && previousItem->IsSeparator() )
{
ChangeMenuItemAttributes( MAC_WXHMENU( menu->GetHMenu() ) , pos , kMenuItemAttrHidden, 0 );
}
}
}
#endif
}
previousItem = item ;
}
::InsertMenu(MAC_WXHMENU(m_menus[i]->GetHMenu()), 0);
for ( size_t i = 0 ; i < submenus.GetCount() ; ++i )
{
wxMenu* submenu = (wxMenu*) submenus[i] ;
wxMenuItemList::Node *subnode;
wxMenuItem *subitem;
int subpos ;
if ( UMAGetSystemVersion() >= 0x1000 )
{
if ( item->GetId() == wxApp::s_macPreferencesMenuItemId || item->GetId() == wxApp::s_macExitMenuItemId)
{
ChangeMenuItemAttributes( MAC_WXHMENU( menu->GetHMenu() ) , pos + 1, kMenuItemAttrHidden, 0 );
if ( menu->GetMenuItems().GetCount() == pos + 1 && previousItem != NULL && previousItem->IsSeparator() )
{
ChangeMenuItemAttributes( MAC_WXHMENU( menu->GetHMenu() ) , pos , kMenuItemAttrHidden, 0 );
}
}
}
#endif
}
previousItem = item ;
}
::InsertMenu(MAC_WXHMENU(m_menus[i]->GetHMenu()), 0);
for ( size_t i = 0 ; i < submenus.GetCount() ; ++i )
{
wxMenu* submenu = (wxMenu*) submenus[i] ;
wxMenuItemList::Node *subnode;
wxMenuItem *subitem;
int subpos ;
for ( subpos = 0 , subnode = submenu->GetMenuItems().GetFirst(); subnode; subnode = subnode->GetNext(), subpos++)
{
subitem = (wxMenuItem *)subnode->GetData();
wxMenu* itsSubMenu = subitem->GetSubMenu() ;
if (itsSubMenu)
{
submenus.Add(itsSubMenu) ;
}
}
::InsertMenu( MAC_WXHMENU(submenu->GetHMenu()) , -1 ) ;
}
}
}
::DrawMenuBar() ;
s_macInstalledMenuBar = this;
{
subitem = (wxMenuItem *)subnode->GetData();
wxMenu* itsSubMenu = subitem->GetSubMenu() ;
if (itsSubMenu)
{
submenus.Add(itsSubMenu) ;
}
}
::InsertMenu( MAC_WXHMENU(submenu->GetHMenu()) , -1 ) ;
}
}
}
::DrawMenuBar() ;
s_macInstalledMenuBar = this;
}
void wxMenuBar::EnableTop(size_t pos, bool enable)
{
wxCHECK_RET( IsAttached(), wxT("doesn't work with unattached menubars") );
m_menus[pos]->MacEnableMenu( enable ) ;
m_menus[pos]->MacEnableMenu( enable ) ;
Refresh();
}
@@ -604,11 +603,11 @@ void wxMenuBar::SetLabelTop(size_t pos, const wxString& label)
}
m_menus[pos]->SetTitle( label ) ;
if (wxMenuBar::s_macInstalledMenuBar == this) // are we currently installed ?
{
::SetMenuBar( GetMenuBar() ) ;
::InvalMenuBar() ;
}
if (wxMenuBar::s_macInstalledMenuBar == this) // are we currently installed ?
{
::SetMenuBar( GetMenuBar() ) ;
::InvalMenuBar() ;
}
}
wxString wxMenuBar::GetLabelTop(size_t pos) const
@@ -653,21 +652,21 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
if ( IsAttached() )
{
if (s_macInstalledMenuBar == this)
{
::DeleteMenu( menuOld->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
{
UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
if ( pos == m_menus.GetCount() - 1)
{
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
}
else
{
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , m_menus[pos+1]->MacGetMenuId() ) ;
}
}
}
if (s_macInstalledMenuBar == this)
{
::DeleteMenu( menuOld->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
{
UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
if ( pos == m_menus.GetCount() - 1)
{
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
}
else
{
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , m_menus[pos+1]->MacGetMenuId() ) ;
}
}
}
Refresh();
}
@@ -682,18 +681,18 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
m_titles.Insert(title, pos);
UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
if ( IsAttached() )
{
if ( pos == (size_t) -1 || pos + 1 == m_menus.GetCount() )
{
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
}
else
{
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , m_menus[pos+1]->MacGetMenuId() ) ;
}
if ( pos == (size_t) -1 || pos + 1 == m_menus.GetCount() )
{
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
}
else
{
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , m_menus[pos+1]->MacGetMenuId() ) ;
}
Refresh();
}
@@ -708,10 +707,10 @@ wxMenu *wxMenuBar::Remove(size_t pos)
if ( IsAttached() )
{
if (s_macInstalledMenuBar == this)
{
::DeleteMenu( menu->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
}
if (s_macInstalledMenuBar == this)
{
::DeleteMenu( menu->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
}
menu->Detach();
@@ -733,14 +732,14 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
m_titles.Add(title);
UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
if ( IsAttached() )
{
if (s_macInstalledMenuBar == this)
{
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
}
if (s_macInstalledMenuBar == this)
{
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
}
Refresh();
}

View File

@@ -66,144 +66,144 @@ wxMenuItem::~wxMenuItem()
void wxMenuItem::SetBitmap(const wxBitmap& bitmap)
{
m_bitmap = bitmap;
UpdateItemBitmap() ;
m_bitmap = bitmap;
UpdateItemBitmap() ;
}
void wxMenuItem::UpdateItemBitmap()
{
if ( !m_parentMenu )
return ;
MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
if( mhandle == NULL || index == 0)
return ;
if ( m_bitmap.Ok() )
{
ControlButtonContentInfo info ;
wxMacCreateBitmapButton( &info , m_bitmap , kControlContentCIconHandle ) ;
if ( info.contentType != kControlNoContent )
{
if ( info.contentType == kControlContentCIconHandle )
SetMenuItemIconHandle( mhandle , index ,
kMenuColorIconType , (Handle) info.u.cIconHandle ) ;
}
}
if ( !m_parentMenu )
return ;
MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
if( mhandle == NULL || index == 0)
return ;
if ( m_bitmap.Ok() )
{
ControlButtonContentInfo info ;
wxMacCreateBitmapButton( &info , m_bitmap , kControlContentCIconHandle ) ;
if ( info.contentType != kControlNoContent )
{
if ( info.contentType == kControlContentCIconHandle )
SetMenuItemIconHandle( mhandle , index ,
kMenuColorIconType , (Handle) info.u.cIconHandle ) ;
}
}
}
void wxMenuItem::UpdateItemStatus()
{
if ( !m_parentMenu )
return ;
MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
if( mhandle == NULL || index == 0)
return ;
if ( !m_parentMenu )
return ;
MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
if( mhandle == NULL || index == 0)
return ;
UMAEnableMenuItem( mhandle , index , m_isEnabled ) ;
if ( IsCheckable() && IsChecked() )
::SetItemMark( mhandle , index , 0x12 ) ; // checkmark
else
::SetItemMark( mhandle , index , 0 ) ; // no mark
UMAEnableMenuItem( mhandle , index , m_isEnabled ) ;
if ( IsCheckable() && IsChecked() )
::SetItemMark( mhandle , index , 0x12 ) ; // checkmark
else
::SetItemMark( mhandle , index , 0 ) ; // no mark
UMASetMenuItemText( mhandle , index , m_text ) ;
wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ;
UMASetMenuItemShortcut( mhandle , index , entry ) ;
delete entry ;
UMASetMenuItemText( mhandle , index , m_text ) ;
wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ;
UMASetMenuItemShortcut( mhandle , index , entry ) ;
delete entry ;
}
void wxMenuItem::UpdateItemText()
{
if ( !m_parentMenu )
return ;
MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
if( mhandle == NULL || index == 0)
return ;
if ( !m_parentMenu )
return ;
MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
if( mhandle == NULL || index == 0)
return ;
UMASetMenuItemText( mhandle , index , m_text ) ;
wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ;
UMASetMenuItemShortcut( mhandle , index , entry ) ;
delete entry ;
UMASetMenuItemText( mhandle , index , m_text ) ;
wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ;
UMASetMenuItemShortcut( mhandle , index , entry ) ;
delete entry ;
}
void wxMenuItem::Enable(bool bDoEnable)
{
if ( m_isEnabled != bDoEnable )
{
wxMenuItemBase::Enable( bDoEnable ) ;
UpdateItemStatus() ;
}
if ( m_isEnabled != bDoEnable )
{
wxMenuItemBase::Enable( bDoEnable ) ;
UpdateItemStatus() ;
}
}
void wxMenuItem::UncheckRadio()
{
if ( m_isChecked )
{
wxMenuItemBase::Check( false ) ;
UpdateItemStatus() ;
}
if ( m_isChecked )
{
wxMenuItemBase::Check( false ) ;
UpdateItemStatus() ;
}
}
void wxMenuItem::Check(bool bDoCheck)
{
wxCHECK_RET( IsCheckable(), "only checkable items may be checked" );
wxCHECK_RET( IsCheckable(), "only checkable items may be checked" );
if ( m_isChecked != bDoCheck )
{
if ( GetKind() == wxITEM_RADIO )
{
if ( bDoCheck )
{
wxMenuItemBase::Check( bDoCheck ) ;
UpdateItemStatus() ;
// get the index of this item in the menu
const wxMenuItemList& items = m_parentMenu->GetMenuItems();
int pos = items.IndexOf(this);
wxCHECK_RET( pos != wxNOT_FOUND,
_T("menuitem not found in the menu items list?") );
if ( m_isChecked != bDoCheck )
{
if ( GetKind() == wxITEM_RADIO )
{
if ( bDoCheck )
{
wxMenuItemBase::Check( bDoCheck ) ;
UpdateItemStatus() ;
// get the index of this item in the menu
const wxMenuItemList& items = m_parentMenu->GetMenuItems();
int pos = items.IndexOf(this);
wxCHECK_RET( pos != wxNOT_FOUND,
_T("menuitem not found in the menu items list?") );
// get the radio group range
int start,
end;
// get the radio group range
int start,
end;
if ( m_isRadioGroupStart )
{
// we already have all information we need
start = pos;
end = m_radioGroup.end;
}
else // next radio group item
{
// get the radio group end from the start item
start = m_radioGroup.start;
end = items.Item(start)->GetData()->m_radioGroup.end;
}
if ( m_isRadioGroupStart )
{
// we already have all information we need
start = pos;
end = m_radioGroup.end;
}
else // next radio group item
{
// get the radio group end from the start item
start = m_radioGroup.start;
end = items.Item(start)->GetData()->m_radioGroup.end;
}
// also uncheck all the other items in this radio group
wxMenuItemList::Node *node = items.Item(start);
for ( int n = start; n <= end && node; n++ )
{
if ( n != pos )
{
((wxMenuItem*)node->GetData())->UncheckRadio();
}
node = node->GetNext();
}
}
}
else
{
wxMenuItemBase::Check( bDoCheck ) ;
UpdateItemStatus() ;
}
}
// also uncheck all the other items in this radio group
wxMenuItemList::Node *node = items.Item(start);
for ( int n = start; n <= end && node; n++ )
{
if ( n != pos )
{
((wxMenuItem*)node->GetData())->UncheckRadio();
}
node = node->GetNext();
}
}
}
else
{
wxMenuItemBase::Check( bDoCheck ) ;
UpdateItemStatus() ;
}
}
}
void wxMenuItem::SetText(const wxString& text)

View File

@@ -6,7 +6,7 @@
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -61,7 +61,7 @@ wxMetafileRefData::~wxMetafileRefData(void)
{
if (m_metafile)
{
KillPicture( (PicHandle) m_metafile ) ;
KillPicture( (PicHandle) m_metafile ) ;
m_metafile = 0;
}
}
@@ -86,10 +86,10 @@ wxMetaFile::~wxMetaFile()
bool wxMetaFile::SetClipboard(int width, int height)
{
#if wxUSE_DRAG_AND_DROP
//TODO finishi this port , we need the data obj first
//TODO finishi this port , we need the data obj first
if (!m_refData)
return FALSE;
bool alreadyOpen=wxTheClipboard->IsOpened() ;
if (!alreadyOpen)
{
@@ -97,11 +97,11 @@ bool wxMetaFile::SetClipboard(int width, int height)
wxTheClipboard->Clear();
}
wxDataObject *data =
new wxMetafileDataObject( *this) ;
new wxMetafileDataObject( *this) ;
bool success = wxTheClipboard->SetData(data);
if (!alreadyOpen)
wxTheClipboard->Close();
return (bool) success;
wxTheClipboard->Close();
return (bool) success;
#endif
return TRUE ;
}
@@ -116,17 +116,17 @@ void wxMetafile::SetHMETAFILE(WXHMETAFILE mf)
bool wxMetaFile::Play(wxDC *dc)
{
if (!m_refData)
return FALSE;
if (!dc->Ok() )
return FALSE;
{
wxMacPortSetter helper( dc ) ;
PicHandle pict = (PicHandle) GetHMETAFILE() ;
DrawPicture( pict , &(**pict).picFrame ) ;
}
if (!m_refData)
return FALSE;
if (!dc->Ok() )
return FALSE;
{
wxMacPortSetter helper( dc ) ;
PicHandle pict = (PicHandle) GetHMETAFILE() ;
DrawPicture( pict , &(**pict).picFrame ) ;
}
return TRUE;
}
@@ -139,22 +139,22 @@ bool wxMetaFile::Play(wxDC *dc)
// *DO* give origin/extent arguments to wxMakeMetaFilePlaceable.
wxMetaFileDC::wxMetaFileDC(const wxString& file)
{
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,1000,1000} ;
m_metaFile->SetHMETAFILE( OpenPicture( &r ) ) ;
::GetPort( (GrafPtr*) &m_macPort ) ;
m_ok = TRUE ;
SetMapMode(wxMM_TEXT);
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,1000,1000} ;
m_metaFile->SetHMETAFILE( OpenPicture( &r ) ) ;
::GetPort( (GrafPtr*) &m_macPort ) ;
m_ok = TRUE ;
SetMapMode(wxMM_TEXT);
}
// New constructor that takes origin and extent. If you use this, don't
@@ -162,21 +162,21 @@ wxMetaFileDC::wxMetaFileDC(const wxString& file)
wxMetaFileDC::wxMetaFileDC(const wxString& file, int xext, int yext, int xorg, int yorg)
{
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( (GrafPtr*) &m_macPort ) ;
m_ok = TRUE ;
SetMapMode(wxMM_TEXT);
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( (GrafPtr*) &m_macPort ) ;
m_ok = TRUE ;
SetMapMode(wxMM_TEXT);
}
wxMetaFileDC::~wxMetaFileDC()
@@ -185,29 +185,29 @@ wxMetaFileDC::~wxMetaFileDC()
wxMetaFile *wxMetaFileDC::Close()
{
ClosePicture() ;
return m_metaFile;
ClosePicture() ;
return m_metaFile;
}
#if wxUSE_DATAOBJ
size_t wxMetafileDataObject::GetDataSize() const
{
return GetHandleSize( (Handle) (*((wxMetafile*)&m_metafile)).GetHMETAFILE() ) ;
return GetHandleSize( (Handle) (*((wxMetafile*)&m_metafile)).GetHMETAFILE() ) ;
}
bool wxMetafileDataObject::GetDataHere(void *buf) const
{
memcpy( buf , (*(PicHandle)(*((wxMetafile*)&m_metafile)).GetHMETAFILE()) ,
GetHandleSize( (Handle) (*((wxMetafile*)&m_metafile)).GetHMETAFILE() ) ) ;
return true ;
memcpy( buf , (*(PicHandle)(*((wxMetafile*)&m_metafile)).GetHMETAFILE()) ,
GetHandleSize( (Handle) (*((wxMetafile*)&m_metafile)).GetHMETAFILE() ) ) ;
return true ;
}
bool wxMetafileDataObject::SetData(size_t len, const void *buf)
{
Handle handle = (Handle) m_metafile.GetHMETAFILE() ;
SetHandleSize( handle , len ) ;
memcpy( *handle , buf , len ) ;
return true ;
Handle handle = (Handle) m_metafile.GetHMETAFILE() ;
SetHandleSize( handle , len ) ;
memcpy( *handle , buf , len ) ;
return true ;
}
#endif

View File

@@ -105,7 +105,7 @@ bool wxFileTypeImpl::GetDescription(wxString *desc) const
size_t
wxFileTypeImpl::GetAllCommands(wxArrayString * verbs, wxArrayString * commands,
const wxFileType::MessageParameters& params) const
const wxFileType::MessageParameters& params) const
{
wxFAIL_MSG( _T("wxFileTypeImpl::GetAllCommands() not yet implemented") );
return 0;

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__

View File

@@ -6,7 +6,7 @@
// Created: 04/01/98
// RCS-ID: $$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -27,33 +27,33 @@ short language = 0 ;
void wxMacConvertNewlines( const char *source , char * destination ) ;
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 ;
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)
long style, const wxPoint& pos)
{
m_caption = caption;
m_message = message;
@@ -63,252 +63,252 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent, const wxString& message, cons
int wxMessageDialog::ShowModal()
{
int resultbutton = wxID_CANCEL ;
short result ;
wxASSERT_MSG( ( m_dialogStyle & 0x3F ) != wxYES , "this style is not supported on mac" ) ;
AlertType alertType = kAlertPlainAlert ;
if (m_dialogStyle & wxICON_EXCLAMATION)
alertType = kAlertNoteAlert ;
else if (m_dialogStyle & wxICON_HAND)
alertType = kAlertStopAlert ;
else if (m_dialogStyle & wxICON_INFORMATION)
alertType = kAlertNoteAlert ;
else if (m_dialogStyle & wxICON_QUESTION)
alertType = kAlertCautionAlert ;
int resultbutton = wxID_CANCEL ;
short result ;
wxASSERT_MSG( ( m_dialogStyle & 0x3F ) != wxYES , "this style is not supported on mac" ) ;
AlertType alertType = kAlertPlainAlert ;
if (m_dialogStyle & wxICON_EXCLAMATION)
alertType = kAlertNoteAlert ;
else if (m_dialogStyle & wxICON_HAND)
alertType = kAlertStopAlert ;
else if (m_dialogStyle & wxICON_INFORMATION)
alertType = kAlertNoteAlert ;
else if (m_dialogStyle & wxICON_QUESTION)
alertType = kAlertCautionAlert ;
#if TARGET_CARBON
if ( UMAGetSystemVersion() >= 0x1000 )
{
AlertStdCFStringAlertParamRec param ;
CFStringRef cfNoString = NULL ;
CFStringRef cfYesString = NULL ;
CFStringRef cfTitle = NULL;
CFStringRef cfText = NULL;
cfTitle = wxMacCreateCFString( m_caption ) ;
cfText = wxMacCreateCFString( m_message ) ;
cfNoString = wxMacCreateCFString( _("No") ) ;
cfYesString = wxMacCreateCFString( _("Yes") ) ;
param.movable = true;
param.flags = 0 ;
bool skipDialog = false ;
if (m_dialogStyle & wxYES_NO)
{
if (m_dialogStyle & wxCANCEL)
{
param.defaultText = cfYesString ;
param.cancelText = (CFStringRef) kAlertDefaultCancelText;
param.otherText = cfNoString ;
param.helpButton = false ;
param.defaultButton = kAlertStdAlertOKButton;
param.cancelButton = kAlertStdAlertCancelButton;
}
else
{
param.defaultText = cfYesString ;
param.cancelText = NULL;
param.otherText = cfNoString ;
param.helpButton = false ;
param.defaultButton = kAlertStdAlertOKButton;
param.cancelButton = 0;
}
}
else if (m_dialogStyle & wxOK)
{
if (m_dialogStyle & wxCANCEL)
{
// thats a cancel missing
param.defaultText = (CFStringRef) kAlertDefaultOKText ;
param.cancelText = NULL;
param.otherText = NULL;
param.helpButton = false ;
param.defaultButton = kAlertStdAlertOKButton;
param.cancelButton = 0;
}
else
{
param.defaultText = (CFStringRef) kAlertDefaultOKText ;
param.cancelText = NULL;
param.otherText = NULL;
param.helpButton = false ;
param.defaultButton = kAlertStdAlertOKButton;
param.cancelButton = 0;
}
}
else
{
skipDialog = true ;
}
param.position = kWindowDefaultPosition;
if ( !skipDialog )
{
DialogRef alertRef ;
CreateStandardAlert( alertType , cfTitle , cfText , &param , &alertRef ) ;
RunStandardAlert( alertRef , NULL , &result ) ;
}
if(cfTitle != NULL)
CFRelease(cfTitle);
if(cfText != NULL)
CFRelease(cfText);
if(cfNoString != NULL)
CFRelease(cfNoString);
if(cfYesString != NULL)
CFRelease(cfYesString);
if ( skipDialog )
return wxID_CANCEL ;
}
else
if ( UMAGetSystemVersion() >= 0x1000 )
{
AlertStdCFStringAlertParamRec param ;
CFStringRef cfNoString = NULL ;
CFStringRef cfYesString = NULL ;
CFStringRef cfTitle = NULL;
CFStringRef cfText = NULL;
cfTitle = wxMacCreateCFString( m_caption ) ;
cfText = wxMacCreateCFString( m_message ) ;
cfNoString = wxMacCreateCFString( _("No") ) ;
cfYesString = wxMacCreateCFString( _("Yes") ) ;
param.movable = true;
param.flags = 0 ;
bool skipDialog = false ;
if (m_dialogStyle & wxYES_NO)
{
if (m_dialogStyle & wxCANCEL)
{
param.defaultText = cfYesString ;
param.cancelText = (CFStringRef) kAlertDefaultCancelText;
param.otherText = cfNoString ;
param.helpButton = false ;
param.defaultButton = kAlertStdAlertOKButton;
param.cancelButton = kAlertStdAlertCancelButton;
}
else
{
param.defaultText = cfYesString ;
param.cancelText = NULL;
param.otherText = cfNoString ;
param.helpButton = false ;
param.defaultButton = kAlertStdAlertOKButton;
param.cancelButton = 0;
}
}
else if (m_dialogStyle & wxOK)
{
if (m_dialogStyle & wxCANCEL)
{
// thats a cancel missing
param.defaultText = (CFStringRef) kAlertDefaultOKText ;
param.cancelText = NULL;
param.otherText = NULL;
param.helpButton = false ;
param.defaultButton = kAlertStdAlertOKButton;
param.cancelButton = 0;
}
else
{
param.defaultText = (CFStringRef) kAlertDefaultOKText ;
param.cancelText = NULL;
param.otherText = NULL;
param.helpButton = false ;
param.defaultButton = kAlertStdAlertOKButton;
param.cancelButton = 0;
}
}
else
{
skipDialog = true ;
}
param.position = kWindowDefaultPosition;
if ( !skipDialog )
{
DialogRef alertRef ;
CreateStandardAlert( alertType , cfTitle , cfText , &param , &alertRef ) ;
RunStandardAlert( alertRef , NULL , &result ) ;
}
if(cfTitle != NULL)
CFRelease(cfTitle);
if(cfText != NULL)
CFRelease(cfText);
if(cfNoString != NULL)
CFRelease(cfNoString);
if(cfYesString != NULL)
CFRelease(cfYesString);
if ( skipDialog )
return wxID_CANCEL ;
}
else
#endif
{
AlertStdAlertParamRec param;
char cText[2048] ;
if (wxApp::s_macDefaultEncodingIsPC)
{
strcpy(cText , wxMacMakeMacStringFromPC( m_message) ) ;
}
else
{
strcpy( cText , m_message ) ;
}
wxMacConvertNewlines( cText , cText ) ;
Str255 yesPString ;
Str255 noPString ;
Str255 pascalTitle ;
Str255 pascalText ;
wxMacStringToPascal( m_caption , pascalTitle ) ;
wxMacStringToPascal( _("Yes") , yesPString ) ;
wxMacStringToPascal( _("No") , noPString ) ;
CopyCStringToPascal( cText , pascalText ) ;
param.movable = true;
param.filterProc = NULL ;
if (m_dialogStyle & wxYES_NO)
{
if (m_dialogStyle & wxCANCEL)
{
param.defaultText = yesPString ;
param.cancelText = (StringPtr) kAlertDefaultCancelText;
param.otherText = noPString ;
param.helpButton = false ;
param.defaultButton = kAlertStdAlertOKButton;
param.cancelButton = kAlertStdAlertCancelButton;
}
else
{
param.defaultText = yesPString ;
param.cancelText = NULL;
param.otherText = noPString ;
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;
StandardAlert( alertType, 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 ;
{
AlertStdAlertParamRec param;
char cText[2048] ;
if (wxApp::s_macDefaultEncodingIsPC)
{
strcpy(cText , wxMacMakeMacStringFromPC( m_message) ) ;
}
else
{
strcpy( cText , m_message ) ;
}
wxMacConvertNewlines( cText , cText ) ;
Str255 yesPString ;
Str255 noPString ;
Str255 pascalTitle ;
Str255 pascalText ;
wxMacStringToPascal( m_caption , pascalTitle ) ;
wxMacStringToPascal( _("Yes") , yesPString ) ;
wxMacStringToPascal( _("No") , noPString ) ;
CopyCStringToPascal( cText , pascalText ) ;
param.movable = true;
param.filterProc = NULL ;
if (m_dialogStyle & wxYES_NO)
{
if (m_dialogStyle & wxCANCEL)
{
param.defaultText = yesPString ;
param.cancelText = (StringPtr) kAlertDefaultCancelText;
param.otherText = noPString ;
param.helpButton = false ;
param.defaultButton = kAlertStdAlertOKButton;
param.cancelButton = kAlertStdAlertCancelButton;
}
else
{
param.defaultText = yesPString ;
param.cancelText = NULL;
param.otherText = noPString ;
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;
StandardAlert( alertType, 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 ;
}

View File

@@ -10,7 +10,7 @@
///////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "notebook.h"
#pragma implementation "notebook.h"
#endif
// ============================================================================
@@ -35,10 +35,10 @@
static bool constantsSet = false ;
short kwxMacTabLeftMargin = 0 ;
short kwxMacTabTopMargin = 0 ;
short kwxMacTabRightMargin = 0 ;
short kwxMacTabBottomMargin = 0 ;
short kwxMacTabLeftMargin = 0 ;
short kwxMacTabTopMargin = 0 ;
short kwxMacTabRightMargin = 0 ;
short kwxMacTabBottomMargin = 0 ;
// ----------------------------------------------------------------------------
// event table
@@ -49,12 +49,12 @@ DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)
BEGIN_EVENT_TABLE(wxNotebook, wxControl)
EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
EVT_MOUSE_EVENTS(wxNotebook::OnMouse)
EVT_SIZE(wxNotebook::OnSize)
EVT_SET_FOCUS(wxNotebook::OnSetFocus)
EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
EVT_MOUSE_EVENTS(wxNotebook::OnMouse)
EVT_SIZE(wxNotebook::OnSize)
EVT_SET_FOCUS(wxNotebook::OnSetFocus)
EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
@@ -76,7 +76,7 @@ void wxNotebook::Init()
{
if ( UMAHasAquaLayout() )
{
// I got these values for Mac OS X from the Appearance mgr docs. (Mark Newsam)
// I got these values for Mac OS X from the Appearance mgr docs. (Mark Newsam)
kwxMacTabLeftMargin = 20 ;
kwxMacTabTopMargin = 38 ;
kwxMacTabRightMargin = 20 ;
@@ -96,7 +96,7 @@ void wxNotebook::Init()
m_macHorizontalBorder = 7;
m_macVerticalBorder = 8;
}
m_nSelection = -1;
}
@@ -115,7 +115,7 @@ wxNotebook::wxNotebook(wxWindow *parent,
const wxString& name)
{
Init();
Create(parent, id, pos, size, style, name);
}
@@ -127,31 +127,31 @@ bool wxNotebook::Create(wxWindow *parent,
long style,
const wxString& name)
{
Rect bounds ;
Str255 title ;
MacPreControlCreate( parent , id , "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
int tabstyle = kControlTabSmallNorthProc ;
if ( HasFlag(wxNB_LEFT) )
tabstyle = kControlTabSmallWestProc ;
else if ( HasFlag( wxNB_RIGHT ) )
tabstyle = kControlTabSmallEastProc ;
else if ( HasFlag( wxNB_BOTTOM ) )
tabstyle = kControlTabSmallSouthProc ;
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
tabstyle , (long) this ) ;
MacPostControlCreate() ;
return TRUE ;
Rect bounds ;
Str255 title ;
MacPreControlCreate( parent , id , "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
int tabstyle = kControlTabSmallNorthProc ;
if ( HasFlag(wxNB_LEFT) )
tabstyle = kControlTabSmallWestProc ;
else if ( HasFlag( wxNB_RIGHT ) )
tabstyle = kControlTabSmallEastProc ;
else if ( HasFlag( wxNB_BOTTOM ) )
tabstyle = kControlTabSmallSouthProc ;
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
tabstyle , (long) this ) ;
MacPostControlCreate() ;
return TRUE ;
}
// dtor
wxNotebook::~wxNotebook()
{
m_macControl = NULL ;
m_macControl = NULL ;
}
wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage)
@@ -162,7 +162,7 @@ wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage)
wxGetOsVersion( &major, &minor );
// Mac has large notebook borders. Aqua even more so.
if ( HasFlag(wxNB_LEFT) || HasFlag(wxNB_RIGHT) )
{
sizeTotal.x += 90;
@@ -185,7 +185,7 @@ wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage)
sizeTotal.y += 44;
}
}
return sizeTotal;
}
@@ -195,7 +195,7 @@ wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage)
void wxNotebook::SetPadding(const wxSize& padding)
{
wxFAIL_MSG( wxT("wxNotebook::SetPadding not implemented") );
wxFAIL_MSG( wxT("wxNotebook::SetPadding not implemented") );
}
void wxNotebook::SetTabSize(const wxSize& sz)
@@ -210,12 +210,12 @@ void wxNotebook::SetPageSize(const wxSize& size)
int wxNotebook::SetSelection(int nPage)
{
if( !IS_VALID_PAGE(nPage) )
return m_nSelection ;
if( !IS_VALID_PAGE(nPage) )
return m_nSelection ;
ChangePage(m_nSelection, nPage);
SetControl32BitValue( (ControlHandle) m_macControl , m_nSelection + 1 ) ;
SetControl32BitValue( (ControlHandle) m_macControl , m_nSelection + 1 ) ;
Refresh();
return m_nSelection;
}
@@ -223,18 +223,18 @@ int wxNotebook::SetSelection(int nPage)
bool wxNotebook::SetPageText(int nPage, const wxString& strText)
{
wxASSERT( IS_VALID_PAGE(nPage) );
wxNotebookPage *page = m_pages[nPage];
page->SetLabel(strText);
MacSetupTabs();
return true;
}
wxString wxNotebook::GetPageText(int nPage) const
{
wxASSERT( IS_VALID_PAGE(nPage) );
wxNotebookPage *page = m_pages[nPage];
return page->GetLabel();
}
@@ -242,27 +242,27 @@ wxString wxNotebook::GetPageText(int nPage) const
int wxNotebook::GetPageImage(int nPage) const
{
wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, _T("invalid notebook page") );
return m_images[nPage];
}
bool wxNotebook::SetPageImage(int nPage, int nImage)
{
wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, _T("invalid notebook page") );
wxCHECK_MSG( m_imageList && nImage < m_imageList->GetImageCount(), FALSE,
_T("invalid image index in SetPageImage()") );
_T("invalid image index in SetPageImage()") );
if ( nImage != m_images[nPage] )
{
// if the item didn't have an icon before or, on the contrary, did have
// it but has lost it now, its size will change - but if the icon just
// changes, it won't
m_images[nPage] = nImage;
MacSetupTabs() ;
MacSetupTabs() ;
}
return TRUE;
}
@@ -276,9 +276,9 @@ wxNotebookPage* wxNotebook::DoRemovePage(int nPage)
wxCHECK( IS_VALID_PAGE(nPage), NULL );
wxNotebookPage* page = m_pages[nPage] ;
m_pages.RemoveAt(nPage);
MacSetupTabs();
if(m_nSelection >= GetPageCount()) {
m_nSelection = GetPageCount() - 1;
}
@@ -292,10 +292,10 @@ wxNotebookPage* wxNotebook::DoRemovePage(int nPage)
bool wxNotebook::DeleteAllPages()
{
// TODO: delete native widget pages
WX_CLEAR_ARRAY(m_pages) ;
MacSetupTabs();
return TRUE;
}
@@ -309,16 +309,16 @@ bool wxNotebook::InsertPage(int nPage,
{
wxASSERT( pPage != NULL );
wxCHECK( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), FALSE );
pPage->SetLabel(strText);
// save the pointer to the page
m_pages.Insert(pPage, nPage);
m_images.Insert(imageId, nPage);
MacSetupTabs();
if ( bSelect ) {
m_nSelection = nPage;
}
@@ -330,69 +330,69 @@ bool wxNotebook::InsertPage(int nPage,
}
// don't show pages by default (we'll need to adjust their size first)
pPage->Show( false ) ;
int h, w;
GetSize(&w, &h);
pPage->SetSize(kwxMacTabLeftMargin, kwxMacTabTopMargin,
w - kwxMacTabLeftMargin - kwxMacTabRightMargin,
h - kwxMacTabTopMargin - kwxMacTabBottomMargin );
w - kwxMacTabLeftMargin - kwxMacTabRightMargin,
h - kwxMacTabTopMargin - kwxMacTabBottomMargin );
if ( pPage->GetAutoLayout() ) {
pPage->Layout();
}
return true;
}
/* Added by Mark Newsam
* When a page is added or deleted to the notebook this function updates
* information held in the m_macControl so that it matches the order
* the user would expect.
*/
* When a page is added or deleted to the notebook this function updates
* information held in the m_macControl so that it matches the order
* the user would expect.
*/
void wxNotebook::MacSetupTabs()
{
SetControl32BitMaximum( (ControlHandle) m_macControl , GetPageCount() ) ;
wxNotebookPage *page;
ControlTabInfoRec info;
for(int ii = 0; ii < GetPageCount(); ii++)
{
page = m_pages[ii];
info.version = 0;
info.iconSuiteID = 0;
#if TARGET_CARBON
c2pstrcpy( (StringPtr) info.name , page->GetLabel() ) ;
c2pstrcpy( (StringPtr) info.name , page->GetLabel() ) ;
#else
strcpy( (char *) info.name , page->GetLabel() ) ;
c2pstr( (char *) info.name ) ;
strcpy( (char *) info.name , page->GetLabel() ) ;
c2pstr( (char *) info.name ) ;
#endif
SetControlData( (ControlHandle) m_macControl, ii+1, kControlTabInfoTag,
sizeof( ControlTabInfoRec) , (char*) &info ) ;
sizeof( ControlTabInfoRec) , (char*) &info ) ;
SetTabEnabled( (ControlHandle) m_macControl , ii+1 , true ) ;
#if TARGET_CARBON
if ( GetImageList() && GetPageImage(ii) >= 0 && UMAGetSystemVersion() >= 0x1020 )
{
// tab controls only support very specific types of images, therefore we are doing an odyssee
// accross the icon worlds (even Apple DTS did not find a shorter path)
// in order not to pollute the icon registry we put every icon into (OSType) 1 and immediately
// afterwards Unregister it (IconRef is ref counted, so it will stay on the tab even if we
// unregister it) in case this will ever lead to having the same icon everywhere add some kind
// of static counter
ControlButtonContentInfo info ;
wxMacCreateBitmapButton( &info , *GetImageList()->GetBitmap( GetPageImage(ii ) ) , kControlContentPictHandle) ;
IconFamilyHandle iconFamily = (IconFamilyHandle) NewHandle(0) ;
OSErr err = SetIconFamilyData( iconFamily, 'PICT' , (Handle) info.u.picture ) ;
// tab controls only support very specific types of images, therefore we are doing an odyssee
// accross the icon worlds (even Apple DTS did not find a shorter path)
// in order not to pollute the icon registry we put every icon into (OSType) 1 and immediately
// afterwards Unregister it (IconRef is ref counted, so it will stay on the tab even if we
// unregister it) in case this will ever lead to having the same icon everywhere add some kind
// of static counter
ControlButtonContentInfo info ;
wxMacCreateBitmapButton( &info , *GetImageList()->GetBitmap( GetPageImage(ii ) ) , kControlContentPictHandle) ;
IconFamilyHandle iconFamily = (IconFamilyHandle) NewHandle(0) ;
OSErr err = SetIconFamilyData( iconFamily, 'PICT' , (Handle) info.u.picture ) ;
wxASSERT_MSG( err == noErr , "Error when adding bitmap" ) ;
IconRef iconRef ;
err = RegisterIconRefFromIconFamily( 'WXNG' , (OSType) 1 , iconFamily, &iconRef ) ;
IconRef iconRef ;
err = RegisterIconRefFromIconFamily( 'WXNG' , (OSType) 1 , iconFamily, &iconRef ) ;
wxASSERT_MSG( err == noErr , "Error when adding bitmap" ) ;
info.contentType = kControlContentIconRef ;
info.u.iconRef = iconRef ;
SetControlData( (ControlHandle) m_macControl, ii+1,kControlTabImageContentTag,
sizeof( info ), (Ptr)&info );
info.contentType = kControlContentIconRef ;
info.u.iconRef = iconRef ;
SetControlData( (ControlHandle) m_macControl, ii+1,kControlTabImageContentTag,
sizeof( info ), (Ptr)&info );
wxASSERT_MSG( err == noErr , "Error when setting icon on tab" ) ;
UnregisterIconRef( 'WXNG' , (OSType) 1 ) ;
UnregisterIconRef( 'WXNG' , (OSType) 1 ) ;
ReleaseIconRef( iconRef ) ;
DisposeHandle( (Handle) iconFamily ) ;
}
@@ -416,22 +416,22 @@ void wxNotebook::OnSize(wxSizeEvent& event)
int nSel = m_nSelection;
m_nSelection = -1;
SetSelection(nSel);
// fit the notebook page to the tab control's display area
int w, h;
GetSize(&w, &h);
unsigned int nCount = m_pages.Count();
for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) {
wxNotebookPage *pPage = m_pages[nPage];
pPage->SetSize(kwxMacTabLeftMargin, kwxMacTabTopMargin,
w - kwxMacTabLeftMargin - kwxMacTabRightMargin,
h - kwxMacTabTopMargin - kwxMacTabBottomMargin );
w - kwxMacTabLeftMargin - kwxMacTabRightMargin,
h - kwxMacTabTopMargin - kwxMacTabBottomMargin );
if ( pPage->GetAutoLayout() ) {
pPage->Layout();
}
}
// Processing continues to next OnSize
event.Skip();
}
@@ -441,7 +441,7 @@ void wxNotebook::OnSelChange(wxNotebookEvent& event)
// is it our tab control?
if ( event.GetEventObject() == this )
ChangePage(event.GetOldSelection(), event.GetSelection());
// we want to give others a chance to process this message as well
event.Skip();
}
@@ -451,7 +451,7 @@ void wxNotebook::OnSetFocus(wxFocusEvent& event)
// set focus to the currently selected page if any
if ( m_nSelection != -1 )
m_pages[m_nSelection]->SetFocus();
event.Skip();
}
@@ -509,93 +509,93 @@ void wxNotebook::ChangePage(int nOldSel, int nSel)
pPage->SetFocus();
return;
}
// Hide previous page
if ( nOldSel != -1 ) {
m_pages[nOldSel]->Show(FALSE);
}
wxNotebookPage *pPage = m_pages[nSel];
pPage->Show(TRUE);
pPage->SetFocus();
m_nSelection = nSel;
}
void wxNotebook::OnMouse( wxMouseEvent &event )
{
if ( (ControlHandle) m_macControl == NULL )
{
event.Skip() ;
return ;
}
if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
{
int x = event.m_x ;
int y = event.m_y ;
MacClientToRootWindow( &x , &y ) ;
ControlHandle control ;
Point localwhere ;
SInt16 controlpart ;
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 ;
control = (ControlHandle) m_macControl ;
if ( control && ::IsControlActive( control ) )
{
{
wxNotebookEvent changing(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_windowId,
::GetControl32BitValue(control) - 1, m_nSelection);
changing.SetEventObject(this);
ProcessEvent(changing);
if(changing.IsAllowed())
{
controlpart = ::HandleControlClick(control, localwhere, modifiers,
(ControlActionUPP) -1);
wxTheApp->s_lastMouseDown = 0 ;
wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId,
::GetControl32BitValue(control) - 1, m_nSelection);
event.SetEventObject(this);
ProcessEvent(event);
}
}
}
}
if ( (ControlHandle) m_macControl == NULL )
{
event.Skip() ;
return ;
}
if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
{
int x = event.m_x ;
int y = event.m_y ;
MacClientToRootWindow( &x , &y ) ;
ControlHandle control ;
Point localwhere ;
SInt16 controlpart ;
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 ;
control = (ControlHandle) m_macControl ;
if ( control && ::IsControlActive( control ) )
{
{
wxNotebookEvent changing(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_windowId,
::GetControl32BitValue(control) - 1, m_nSelection);
changing.SetEventObject(this);
ProcessEvent(changing);
if(changing.IsAllowed())
{
controlpart = ::HandleControlClick(control, localwhere, modifiers,
(ControlActionUPP) -1);
wxTheApp->s_lastMouseDown = 0 ;
wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId,
::GetControl32BitValue(control) - 1, m_nSelection);
event.SetEventObject(this);
ProcessEvent(event);
}
}
}
}
}
void wxNotebook::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
{
#if 0
wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId , ::GetControl32BitValue((ControlHandle)m_macControl) - 1, m_nSelection);
event.SetEventObject(this);
ProcessEvent(event);
wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId , ::GetControl32BitValue((ControlHandle)m_macControl) - 1, m_nSelection);
event.SetEventObject(this);
ProcessEvent(event);
#endif
}

View File

@@ -6,7 +6,7 @@
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -30,8 +30,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject)
wxPaletteRefData::wxPaletteRefData()
{
m_palette = NULL ;
m_count = 0 ;
m_palette = NULL ;
m_count = 0 ;
}
wxPaletteRefData::~wxPaletteRefData()
@@ -57,41 +57,41 @@ wxPalette::~wxPalette()
bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue)
{
UnRef();
m_refData = new wxPaletteRefData;
M_PALETTEDATA->m_count = n ;
M_PALETTEDATA->m_palette = new wxColour[n] ;
for ( int i = 0 ; i < n ; ++i)
{
M_PALETTEDATA->m_palette[i].Set( red[i] , green[i] , blue[i] ) ;
}
return FALSE;
UnRef();
m_refData = new wxPaletteRefData;
M_PALETTEDATA->m_count = n ;
M_PALETTEDATA->m_palette = new wxColour[n] ;
for ( int i = 0 ; i < n ; ++i)
{
M_PALETTEDATA->m_palette[i].Set( red[i] , green[i] , blue[i] ) ;
}
return FALSE;
}
int wxPalette::GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const
{
if ( !m_refData )
return -1;
return -1;
long bestdiff = 3 * 256 ;
long bestpos = 0 ;
long currentdiff ;
for ( int i = 0 ; i < M_PALETTEDATA->m_count ; ++i )
{
const wxColour& col = &M_PALETTEDATA->m_palette[i] ;
currentdiff = abs ( col.Red() - red ) + abs( col.Green() - green ) + abs ( col.Blue() - blue ) ;
if ( currentdiff < bestdiff )
{
bestdiff = currentdiff ;
bestpos = i ;
if ( bestdiff == 0 )
break ;
}
const wxColour& col = &M_PALETTEDATA->m_palette[i] ;
currentdiff = abs ( col.Red() - red ) + abs( col.Green() - green ) + abs ( col.Blue() - blue ) ;
if ( currentdiff < bestdiff )
{
bestdiff = currentdiff ;
bestpos = i ;
if ( bestdiff == 0 )
break ;
}
}
return bestpos;
@@ -100,11 +100,11 @@ int wxPalette::GetPixel(const unsigned char red, const unsigned char green, cons
bool wxPalette::GetRGB(int index, unsigned char *red, unsigned char *green, unsigned char *blue) const
{
if ( !m_refData )
return FALSE;
return FALSE;
if (index < 0 || index >= M_PALETTEDATA->m_count)
return FALSE;
const wxColour& col = &M_PALETTEDATA->m_palette[index] ;
*red = col.Red() ;
*green = col.Green() ;
@@ -114,5 +114,5 @@ bool wxPalette::GetRGB(int index, unsigned char *red, unsigned char *green, unsi
}
#endif
// wxUSE_PALETTE
// wxUSE_PALETTE

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