post wxUniv merge fixes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10719 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor 2001-06-29 16:19:53 +00:00
parent bf7b3e2b9d
commit 90b959aee4
30 changed files with 186 additions and 429 deletions

View File

@ -170,12 +170,10 @@ WXDLLEXPORT void wxUnix2DosFilename(wxChar *s);
#if defined(__WXMAC__) && !defined(__UNIX__)
WXDLLEXPORT wxString wxMacFSSpec2MacFilename( const FSSpec *spec ) ;
WXDLLEXPORT void wxMacFilename2FSSpec( const char *path , FSSpec *spec ) ;
/*
WXDLLEXPORT wxString wxMacFSSpec2UnixFilename( const FSSpec *spec ) ;
WXDLLEXPORT void wxUnixFilename2FSSpec( const char *path , FSSpec *spec ) ;
WXDLLEXPORT wxString wxMac2UnixFilename( const char *s) ;
WXDLLEXPORT wxString wxUnix2MacFilename( const char *s);
*/
#endif
// Strip the extension, in situ

View File

@ -20,7 +20,7 @@
// without tons of #ifdefs.
// ----------------------------------------------------------------------------
#if wxUSE_SPINBTN
#if wxUSE_SPINBTN && !defined(__WXMAC__)
#ifdef __GNUG__
#pragma interface "spinctlg.h"

View File

@ -74,9 +74,6 @@ public:
// get the menu handle
WXHMENU GetHMenu() const { return m_hMenu; }
// attach/detach menu to/from wxMenuBar
void Attach(wxMenuBar *menubar);
void Detach();
short MacGetMenuId() { return m_macMenuId ; }
#if wxUSE_ACCEL
// called by wxMenuBar to build its accel table from the accels of all menus
@ -192,8 +189,6 @@ protected:
wxArrayString m_titles;
wxFrame *m_menuBarFrame;
#if wxUSE_ACCEL
// the accelerator table for all accelerators in all our menus
wxAcceleratorTable m_accelTable;

View File

@ -37,7 +37,7 @@ class WXDLLEXPORT wxWindow;
// @@@ this class should really derive from wxTabCtrl, but the interface is not
// exactly the same, so I can't do it right now and instead we reimplement
// part of wxTabCtrl here
class wxNotebook : public wxControl
class wxNotebook : public wxNotebookBase
{
public:
// ctors
@ -63,15 +63,10 @@ public:
// accessors
// ---------
// get number of pages in the dialog
int GetPageCount() const;
// set the currently selected page, return the index of the previously
// selected one (or -1 on error)
// NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
int SetSelection(int nPage);
// cycle thru the tabs
void AdvanceSelection(bool bForward = TRUE);
// get the currently selected page
int GetSelection() const { return m_nSelection; }
@ -79,53 +74,44 @@ public:
bool SetPageText(int nPage, const wxString& strText);
wxString GetPageText(int nPage) const;
// image list stuff: each page may have an image associated with it. All
// the images belong to an image list, so you have to
// 1) create an image list
// 2) associate it with the notebook
// 3) set for each page it's image
// associate image list with a control
void SetImageList(wxImageList* imageList);
// get pointer (may be NULL) to the associated image list
wxImageList* GetImageList() const { return m_pImageList; }
// sets/returns item's image index in the current image list
int GetPageImage(int nPage) const;
bool SetPageImage(int nPage, int nImage);
// currently it's always 1 because wxGTK doesn't support multi-row
// tab controls
int GetRowCount() const;
// control the appearance of the notebook pages
// set the size (the same for all pages)
void SetPageSize(const wxSize& size);
// set the padding between tabs (in pixels)
void SetPadding(const wxSize& padding);
// sets the size of the tabs (assumes all tabs are the same size)
void SetTabSize(const wxSize& sz);
/*
// get number of pages in the dialog
int GetPageCount() const;
// cycle thru the tabs
void AdvanceSelection(bool bForward = TRUE);
// currently it's always 1 because wxGTK doesn't support multi-row
// tab controls
int GetRowCount() const;
*/
// operations
// ----------
// remove one page from the notebook
bool DeletePage(int nPage);
// remove one page from the notebook, without deleting
bool RemovePage(int nPage);
// remove all pages
bool DeleteAllPages();
// adds a new page to the notebook (it will be deleted ny the notebook,
// don't delete it yourself). If bSelect, this page becomes active.
bool AddPage(wxNotebookPage *pPage,
const wxString& strText,
bool bSelect = FALSE,
int imageId = -1);
// the same as AddPage(), but adds it at the specified position
bool InsertPage(int nPage,
wxNotebookPage *pPage,
const wxString& strText,
bool bSelect = FALSE,
int imageId = -1);
/*
// get the panel which represents the given page
wxNotebookPage *GetPage(int nPage) { return m_aPages[nPage]; }
*/
// callbacks
// ---------
void OnSize(wxSizeEvent& event);
@ -133,13 +119,21 @@ public:
void OnSetFocus(wxFocusEvent& event);
void OnNavigationKey(wxNavigationKeyEvent& event);
// base class virtuals
// -------------------
virtual void Command(wxCommandEvent& event);
// implementation
// --------------
#if wxUSE_CONSTRAINTS
virtual void SetConstraintSizes(bool recurse = TRUE);
virtual bool DoPhase(int nPhase);
#endif
// base class virtuals
// -------------------
virtual void Command(wxCommandEvent& event);
protected:
virtual wxNotebookPage *DoRemovePage(int page) ;
virtual void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
// common part of all ctors
void Init();
@ -148,8 +142,8 @@ protected:
void ChangePage(int nOldSel, int nSel); // change pages
void MacSetupTabs();
wxImageList *m_pImageList; // we can have an associated image list
wxArrayPages m_aPages; // array of pages
// wxImageList *m_pImageList; // we can have an associated image list
// wxArrayPages m_aPages; // array of pages
int m_nSelection; // the current selection (-1 if none)

View File

@ -43,21 +43,25 @@ public:
const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr);
// Specific functions (in wxWindows2 reference)
bool Enable(bool enable);
void Enable(int item, bool enable);
int FindString(const wxString& s) const;
wxString GetLabel() const;
wxString GetLabel(int item) const;
int GetSelection() const;
wxString GetString(int item) const;
virtual wxString GetStringSelection() const;
virtual void SetSelection(int item);
virtual int GetSelection() const;
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 ;
bool Enable(bool enable);
wxString GetLabel() const;
void SetLabel(const wxString& label) ;
void SetLabel(int item, const wxString& label) ;
void SetSelection(int item);
virtual bool SetStringSelection(const wxString& s);
bool Show(bool show);
void Show(int item, bool show) ;
// Other external functions
void Command(wxCommandEvent& event);
@ -79,8 +83,6 @@ protected:
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO);
int GetNumHor() const;
int GetNumVer() const;
DECLARE_EVENT_TABLE()
};

View File

@ -414,7 +414,7 @@
#define wxUSE_STATTEXT 1 // wxStaticText
#define wxUSE_STATBMP 1 // wxStaticBitmap
#define wxUSE_TEXTCTRL 1 // wxTextCtrl
#define wxUSE_TOGGLEBTN 1 // requires wxButton
#define wxUSE_TOGGLEBTN 0 // requires wxButton
#define wxUSE_TREECTRL 1 // wxTreeCtrl
// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR
@ -546,15 +546,6 @@
// common dialogs
// ----------------------------------------------------------------------------
// Define 1 to use generic dialogs in Windows, even though they duplicate
// native common dialog (e.g. wxColourDialog). This is mainly useful for
// testing.
//
// Default is 0
//
// Recommended setting: 0
#define wxUSE_GENERIC_DIALOGS_IN_MSW 0
// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g.
// file selector, printer dialog). Switching this off also switches off the
// printing architecture and interactive wxPrinterDC.
@ -717,17 +708,6 @@
#define wxUSE_SPLINES 1
// 0 for no splines
#define wxUSE_XPM_IN_MSW 1
// 0 for no XPM support in wxBitmap.
// Default is 1, as XPM is now fully
// supported this makes easier the issue
// of portable icons and bitmaps.
#define wxUSE_IMAGE_LOADING_IN_MSW 1
// Use dynamic DIB loading/saving code in utils/dib under MSW.
#define wxUSE_RESOURCE_LOADING_IN_MSW 1
// Use dynamic icon/cursor loading/saving code
// under MSW.
#define wxUSE_WX_RESOURCES 1
// Use .wxr resource mechanism (requires PrologIO library)
@ -744,10 +724,6 @@
// Set to 1 to use font metric files in GetTextExtent
#define wxUSE_AFM_FOR_POSTSCRIPT 0
// Set to 0 to disable PostScript print/preview architecture code under Windows
// (just use Windows printing).
#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1
// ----------------------------------------------------------------------------
// database classes
// ----------------------------------------------------------------------------

View File

@ -900,11 +900,13 @@ bool wxYield()
#endif
EventRecord event ;
long sleepTime = 0 ; //::GetCaretTime();
long sleepTime = 1 ; //::GetCaretTime();
while ( !wxTheApp->IsExiting() && WaitNextEvent(everyEvent, &event,sleepTime, wxApp::s_macCursorRgn))
{
wxTheApp->MacHandleOneEvent( &event );
if ( event.what != kHighLevelEvent )
SetRectRgn( wxApp::s_macCursorRgn , event.where.h , event.where.v , event.where.h + 1 , event.where.v + 1 ) ;
}
wxMacProcessNotifierAndPendingEvents() ;

View File

@ -26,6 +26,8 @@
#if !USE_SHARED_LIBRARIES
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxBitmapBase , wxGDIObject )
IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandlerBase, wxObject )
#endif
#ifdef __UNIX__
@ -241,6 +243,12 @@ wxBitmapRefData::~wxBitmapRefData()
wxList wxBitmap::sm_handlers;
bool wxBitmap::CopyFromIcon(const wxIcon& icon)
{
Ref(icon) ;
}
wxBitmap::wxBitmap()
{
m_refData = NULL;

View File

@ -900,11 +900,13 @@ bool wxYield()
#endif
EventRecord event ;
long sleepTime = 0 ; //::GetCaretTime();
long sleepTime = 1 ; //::GetCaretTime();
while ( !wxTheApp->IsExiting() && WaitNextEvent(everyEvent, &event,sleepTime, wxApp::s_macCursorRgn))
{
wxTheApp->MacHandleOneEvent( &event );
if ( event.what != kHighLevelEvent )
SetRectRgn( wxApp::s_macCursorRgn , event.where.h , event.where.v , event.where.h + 1 , event.where.v + 1 ) ;
}
wxMacProcessNotifierAndPendingEvents() ;

View File

@ -26,6 +26,8 @@
#if !USE_SHARED_LIBRARIES
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxBitmapBase , wxGDIObject )
IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandlerBase, wxObject )
#endif
#ifdef __UNIX__
@ -241,6 +243,12 @@ wxBitmapRefData::~wxBitmapRefData()
wxList wxBitmap::sm_handlers;
bool wxBitmap::CopyFromIcon(const wxIcon& icon)
{
Ref(icon) ;
}
wxBitmap::wxBitmap()
{
m_refData = NULL;

View File

@ -61,7 +61,7 @@ bool wxIcon::LoadFile(const wxString& filename, long type,
m_refData = new wxBitmapRefData;
wxBitmapHandler *handler = FindHandler(type);
wxBitmapHandler *handler = FindHandler((wxBitmapType)type);
if ( handler )
return handler->LoadFile(this, filename, type, desiredWidth, desiredHeight);

View File

@ -347,22 +347,6 @@ bool wxMenu::ProcessCommand(wxCommandEvent & event)
// other
// ---------------------------------------------------------------------------
void wxMenu::Attach(wxMenuBar *menubar)
{
// menu can be in at most one menubar because otherwise they would both
// delete the menu pointer
wxASSERT_MSG( !m_menuBar, wxT("menu belongs to 2 menubars, expect a crash") );
m_menuBar = menubar;
}
void wxMenu::Detach()
{
wxASSERT_MSG( m_menuBar, wxT("can't detach menu if it's not attached") );
m_menuBar = NULL;
}
wxWindow *wxMenu::GetWindow() const
{
if ( m_invokingWindow != NULL )
@ -979,8 +963,6 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
if ( !wxMenuBarBase::Append(menu, title) )
return FALSE;
menu->Attach(this);
m_titles.Add(title);
if ( IsAttached() )
@ -1004,11 +986,14 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
return TRUE;
}
void wxMenuBar::Detach()
{
wxMenuBarBase::Detach() ;
}
void wxMenuBar::Attach(wxFrame *frame)
{
// wxASSERT_MSG( !IsAttached(), wxT("menubar already attached!") );
m_menuBarFrame = frame;
wxMenuBarBase::Attach( frame ) ;
#if wxUSE_ACCEL
RebuildAccelTable();

View File

@ -80,7 +80,6 @@ void wxNotebook::Init()
m_macHorizontalBorder = 7;
m_macVerticalBorder = 8;
#endif
m_pImageList = NULL;
m_nSelection = -1;
}
@ -132,14 +131,17 @@ wxNotebook::~wxNotebook()
// ----------------------------------------------------------------------------
// wxNotebook accessors
// ----------------------------------------------------------------------------
int wxNotebook::GetPageCount() const
void wxNotebook::SetPadding(const wxSize& padding)
{
return m_aPages.Count();
}
int wxNotebook::GetRowCount() const
void wxNotebook::SetTabSize(const wxSize& sz)
{
}
void wxNotebook::SetPageSize(const wxSize& size)
{
return 1;
}
int wxNotebook::SetSelection(int nPage)
@ -152,24 +154,11 @@ int wxNotebook::SetSelection(int nPage)
return m_nSelection;
}
void wxNotebook::AdvanceSelection(bool bForward)
{
if (GetPageCount() == 0) {
return;
}
int nSel = GetSelection();
int nMax = GetPageCount() - 1;
if ( bForward )
SetSelection(nSel == nMax ? 0 : nSel + 1);
else
SetSelection(nSel == 0 ? nMax : nSel - 1);
}
bool wxNotebook::SetPageText(int nPage, const wxString& strText)
{
wxASSERT( IS_VALID_PAGE(nPage) );
wxNotebookPage *page = m_aPages[nPage];
wxNotebookPage *page = m_pages[nPage];
page->SetLabel(strText);
MacSetupTabs();
@ -180,7 +169,7 @@ wxString wxNotebook::GetPageText(int nPage) const
{
wxASSERT( IS_VALID_PAGE(nPage) );
wxNotebookPage *page = m_aPages[nPage];
wxNotebookPage *page = m_pages[nPage];
return page->GetLabel();
}
@ -200,23 +189,16 @@ bool wxNotebook::SetPageImage(int nPage, int nImage)
return FALSE;
}
void wxNotebook::SetImageList(wxImageList* imageList)
{
m_pImageList = imageList;
// TODO
}
// ----------------------------------------------------------------------------
// wxNotebook operations
// ----------------------------------------------------------------------------
// remove one page from the notebook
bool wxNotebook::DeletePage(int nPage)
// remove one page from the notebook, without deleting the window
wxNotebookPage* wxNotebook::DoRemovePage(int nPage)
{
wxCHECK( IS_VALID_PAGE(nPage), FALSE );
delete m_aPages[nPage];
m_aPages.Remove(nPage);
wxCHECK( IS_VALID_PAGE(nPage), NULL );
wxNotebookPage* page = m_pages[nPage] ;
m_pages.Remove(nPage);
MacSetupTabs();
@ -224,20 +206,9 @@ bool wxNotebook::DeletePage(int nPage)
m_nSelection = GetPageCount() - 1;
}
if(m_nSelection >= 0) {
m_aPages[m_nSelection]->Show(true);
m_pages[m_nSelection]->Show(true);
}
return true;
}
// remove one page from the notebook, without deleting the window
bool wxNotebook::RemovePage(int nPage)
{
wxCHECK( IS_VALID_PAGE(nPage), FALSE );
m_aPages.Remove(nPage);
return TRUE;
return page;
}
// remove all pages
@ -245,26 +216,12 @@ bool wxNotebook::DeleteAllPages()
{
// TODO: delete native widget pages
int nPageCount = GetPageCount();
int nPage;
for ( nPage = 0; nPage < nPageCount; nPage++ )
delete m_aPages[nPage];
m_aPages.Clear();
WX_CLEAR_ARRAY(m_pages) ;
MacSetupTabs();
return TRUE;
}
// add a page to the notebook
bool wxNotebook::AddPage(wxNotebookPage *pPage,
const wxString& strText,
bool bSelect,
int imageId)
{
return InsertPage(GetPageCount(), pPage, strText, bSelect, imageId);
}
// same as AddPage() but does it at given position
bool wxNotebook::InsertPage(int nPage,
@ -279,7 +236,7 @@ bool wxNotebook::InsertPage(int nPage,
pPage->SetLabel(strText);
// save the pointer to the page
m_aPages.Insert(pPage, nPage);
m_pages.Insert(pPage, nPage);
MacSetupTabs();
@ -321,7 +278,7 @@ void wxNotebook::MacSetupTabs()
Boolean enabled = true;
for(int ii = 0; ii < GetPageCount(); ii++)
{
page = m_aPages[ii];
page = m_pages[ii];
info.version = 0;
info.iconSuiteID = 0;
#if TARGET_CARBON
@ -366,9 +323,9 @@ void wxNotebook::OnSize(wxSizeEvent& event)
int w, h;
GetSize(&w, &h);
unsigned int nCount = m_aPages.Count();
unsigned int nCount = m_pages.Count();
for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) {
wxNotebookPage *pPage = m_aPages[nPage];
wxNotebookPage *pPage = m_pages[nPage];
pPage->SetSize(kwxMacTabLeftMargin, kwxMacTabTopMargin,
w - kwxMacTabLeftMargin - kwxMacTabRightMargin,
h - kwxMacTabTopMargin - kwxMacTabBottomMargin );
@ -395,7 +352,7 @@ void wxNotebook::OnSetFocus(wxFocusEvent& event)
{
// set focus to the currently selected page if any
if ( m_nSelection != -1 )
m_aPages[m_nSelection]->SetFocus();
m_pages[m_nSelection]->SetFocus();
event.Skip();
}
@ -448,7 +405,7 @@ void wxNotebook::ChangePage(int nOldSel, int nSel)
// and it may happen - just do nothing
if ( nSel == nOldSel )
{
wxNotebookPage *pPage = m_aPages[nSel];
wxNotebookPage *pPage = m_pages[nSel];
pPage->Show(FALSE);
pPage->Show(TRUE);
pPage->SetFocus();
@ -457,10 +414,10 @@ void wxNotebook::ChangePage(int nOldSel, int nSel)
// Hide previous page
if ( nOldSel != -1 ) {
m_aPages[nOldSel]->Show(FALSE);
m_pages[nOldSel]->Show(FALSE);
}
wxNotebookPage *pPage = m_aPages[nSel];
wxNotebookPage *pPage = m_pages[nSel];
pPage->Show(TRUE);
pPage->SetFocus();

View File

@ -181,28 +181,6 @@ void wxRadioBox::Enable(int item, bool enable)
}
}
//-------------------------------------------------------------------------------------
// ¥ FindString
//-------------------------------------------------------------------------------------
// Finds a button matching the given string, returning the position if found
// or -1 if not found
int wxRadioBox::FindString(const wxString& s) const
{
int i;
wxRadioButton *current;
current=m_radioButtonCycle;
for (i = 0; i < m_noItems; i++)
{
if (s == current->GetLabel())
return i;
current=current->NextInCycle();
}
return -1;
}
//-------------------------------------------------------------------------------------
// ¥ GetLabel()
//-------------------------------------------------------------------------------------
@ -218,7 +196,7 @@ wxString wxRadioBox::GetLabel() const
//-------------------------------------------------------------------------------------
// Returns the label for the given button
wxString wxRadioBox::GetLabel(int item) const
wxString wxRadioBox::GetString(int item) const
{
int i;
wxRadioButton *current;
@ -254,31 +232,6 @@ int wxRadioBox::GetSelection() const
return i;
}
//-------------------------------------------------------------------------------------
// ¥ GetString
//-------------------------------------------------------------------------------------
// Find string for position
wxString wxRadioBox::GetString(int item) const
{
return GetLabel(item);
}
//-------------------------------------------------------------------------------------
// ¥ GetStringSelection
//-------------------------------------------------------------------------------------
// Returns the selected string
wxString wxRadioBox::GetStringSelection () const
{
int sel = GetSelection ();
if (sel > -1)
return this->GetString (sel);
else
return wxString("");
}
//-------------------------------------------------------------------------------------
// ¥ Number
//-------------------------------------------------------------------------------------
@ -302,7 +255,7 @@ void wxRadioBox::SetLabel(const wxString& label)
//-------------------------------------------------------------------------------------
// Sets the label of a given button
void wxRadioBox::SetLabel(int item,const wxString& label)
void wxRadioBox::SetString(int item,const wxString& label)
{
int i;
wxRadioButton *current;
@ -341,24 +294,6 @@ void wxRadioBox::SetSelection(int item)
}
//-------------------------------------------------------------------------------------
// ¥ SetStringSelection
//-------------------------------------------------------------------------------------
// Sets a button by passing the desired string. This does not cause
// wxEVT_COMMAND_RADIOBOX_SELECTED event to get emitted
bool wxRadioBox::SetStringSelection (const wxString& s)
{
int sel = FindString (s);
if (sel > -1)
{
SetSelection (sel);
return TRUE;
}
else
return FALSE;
}
//-------------------------------------------------------------------------------------
// ¥ Show(bool)
//-------------------------------------------------------------------------------------
@ -479,15 +414,15 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
maxHeight=-1;
for (i = 0 ; i < m_noItems; i++)
{
GetTextExtent(GetLabel(i), &eachWidth[i], &eachHeight[i]);
GetTextExtent(GetString(i), &eachWidth[i], &eachHeight[i]);
eachWidth[i] = (int)(eachWidth[i] + RADIO_SIZE);
eachHeight[i] = (int)((3*eachHeight[i])/2);
if (maxWidth<eachWidth[i]) maxWidth = eachWidth[i];
if (maxHeight<eachHeight[i]) maxHeight = eachHeight[i];
}
totHeight = GetNumVer() * (maxHeight + charHeight/2) + charHeight*3/2;
totWidth = GetNumHor() * (maxWidth + charWidth) + charWidth;
totHeight = GetRowCount() * (maxHeight + charHeight/2) + charHeight*3/2;
totWidth = GetColumnCount() * (maxWidth + charWidth) + charWidth;
// only change our width/height if asked for
if ( width == -1 )
@ -550,7 +485,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
//-------------------------------------------------------------------------------------
// return the number of buttons in the vertical direction
int wxRadioBox::GetNumVer() const
int wxRadioBox::GetRowCount() const
{
if ( m_windowStyle & wxRA_SPECIFY_ROWS )
{
@ -567,7 +502,7 @@ int wxRadioBox::GetNumVer() const
//-------------------------------------------------------------------------------------
// return the number of buttons in the horizontal direction
int wxRadioBox::GetNumHor() const
int wxRadioBox::GetColumnCount() const
{
if ( m_windowStyle & wxRA_SPECIFY_ROWS )
{

View File

@ -84,11 +84,6 @@ int wxSpinButton::GetValue() const
void wxSpinButton::SetValue(int val)
{
m_value = val ;
wxScrollEvent event(wxEVT_SCROLL_THUMBTRACK, m_windowId);
event.SetPosition(m_value);
event.SetEventObject( this );
GetEventHandler()->ProcessEvent(event);
}
void wxSpinButton::SetRange(int minVal, int maxVal)

View File

@ -23,7 +23,7 @@
// wxSpinCtrl
//-----------------------------------------------------------------------------
#if wxUSE_SPINBTN
#if wxUSE_SPINBTN && !defined(__WXMAC__)
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl,wxControl)

View File

@ -19,7 +19,7 @@
#include "wx/dcclient.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxStaticBitmapBase)
IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
#endif
/*

View File

@ -23,7 +23,7 @@
#include <stdio.h>
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxStaticTextBase)
IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
#endif
#include <wx/mac/uma.h>

View File

@ -107,7 +107,16 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
MacPreControlCreate( parent , id , "" , pos , mySize ,style, validator , name , &bounds , title ) ;
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , false , 0 , 0 , 1,
if ( m_windowStyle & wxTE_MULTILINE )
{
wxASSERT_MSG( !(m_windowStyle & wxTE_PROCESS_ENTER),
wxT("wxTE_PROCESS_ENTER style is ignored for multiline text controls (they always process it)") );
m_windowStyle |= wxTE_PROCESS_ENTER;
}
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , true , 0 , 0 , 1,
( style & wxTE_PASSWORD ) ? kControlEditTextPasswordProc : kControlEditTextProc , (long) this ) ;
MacPostControlCreate() ;
@ -653,7 +662,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
keychar = short(ev->message & charCodeMask);
keycode = short(ev->message & keyCodeMask) >> 8 ;
UMAHandleControlKey( m_macControl , keycode , keychar , ev->modifiers ) ;
if ( keychar >= 0x20 || event.KeyCode() == WXK_RETURN)
if ( keychar >= 0x20 || event.KeyCode() == WXK_RETURN || event.KeyCode() == WXK_DELETE || event.KeyCode() == WXK_BACK)
{
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
event.SetString( GetValue() ) ;

View File

@ -296,6 +296,11 @@ void wxWindow::CaptureMouse()
wxTheApp->s_captureWindow = this ;
}
wxWindow* wxWindowBase::GetCapture()
{
return wxTheApp->s_captureWindow ;
}
void wxWindow::ReleaseMouse()
{
wxTheApp->s_captureWindow = NULL ;

View File

@ -61,7 +61,7 @@ bool wxIcon::LoadFile(const wxString& filename, long type,
m_refData = new wxBitmapRefData;
wxBitmapHandler *handler = FindHandler(type);
wxBitmapHandler *handler = FindHandler((wxBitmapType)type);
if ( handler )
return handler->LoadFile(this, filename, type, desiredWidth, desiredHeight);

View File

@ -347,22 +347,6 @@ bool wxMenu::ProcessCommand(wxCommandEvent & event)
// other
// ---------------------------------------------------------------------------
void wxMenu::Attach(wxMenuBar *menubar)
{
// menu can be in at most one menubar because otherwise they would both
// delete the menu pointer
wxASSERT_MSG( !m_menuBar, wxT("menu belongs to 2 menubars, expect a crash") );
m_menuBar = menubar;
}
void wxMenu::Detach()
{
wxASSERT_MSG( m_menuBar, wxT("can't detach menu if it's not attached") );
m_menuBar = NULL;
}
wxWindow *wxMenu::GetWindow() const
{
if ( m_invokingWindow != NULL )
@ -979,8 +963,6 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
if ( !wxMenuBarBase::Append(menu, title) )
return FALSE;
menu->Attach(this);
m_titles.Add(title);
if ( IsAttached() )
@ -1004,11 +986,14 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
return TRUE;
}
void wxMenuBar::Detach()
{
wxMenuBarBase::Detach() ;
}
void wxMenuBar::Attach(wxFrame *frame)
{
// wxASSERT_MSG( !IsAttached(), wxT("menubar already attached!") );
m_menuBarFrame = frame;
wxMenuBarBase::Attach( frame ) ;
#if wxUSE_ACCEL
RebuildAccelTable();

View File

@ -80,7 +80,6 @@ void wxNotebook::Init()
m_macHorizontalBorder = 7;
m_macVerticalBorder = 8;
#endif
m_pImageList = NULL;
m_nSelection = -1;
}
@ -132,14 +131,17 @@ wxNotebook::~wxNotebook()
// ----------------------------------------------------------------------------
// wxNotebook accessors
// ----------------------------------------------------------------------------
int wxNotebook::GetPageCount() const
void wxNotebook::SetPadding(const wxSize& padding)
{
return m_aPages.Count();
}
int wxNotebook::GetRowCount() const
void wxNotebook::SetTabSize(const wxSize& sz)
{
}
void wxNotebook::SetPageSize(const wxSize& size)
{
return 1;
}
int wxNotebook::SetSelection(int nPage)
@ -152,24 +154,11 @@ int wxNotebook::SetSelection(int nPage)
return m_nSelection;
}
void wxNotebook::AdvanceSelection(bool bForward)
{
if (GetPageCount() == 0) {
return;
}
int nSel = GetSelection();
int nMax = GetPageCount() - 1;
if ( bForward )
SetSelection(nSel == nMax ? 0 : nSel + 1);
else
SetSelection(nSel == 0 ? nMax : nSel - 1);
}
bool wxNotebook::SetPageText(int nPage, const wxString& strText)
{
wxASSERT( IS_VALID_PAGE(nPage) );
wxNotebookPage *page = m_aPages[nPage];
wxNotebookPage *page = m_pages[nPage];
page->SetLabel(strText);
MacSetupTabs();
@ -180,7 +169,7 @@ wxString wxNotebook::GetPageText(int nPage) const
{
wxASSERT( IS_VALID_PAGE(nPage) );
wxNotebookPage *page = m_aPages[nPage];
wxNotebookPage *page = m_pages[nPage];
return page->GetLabel();
}
@ -200,23 +189,16 @@ bool wxNotebook::SetPageImage(int nPage, int nImage)
return FALSE;
}
void wxNotebook::SetImageList(wxImageList* imageList)
{
m_pImageList = imageList;
// TODO
}
// ----------------------------------------------------------------------------
// wxNotebook operations
// ----------------------------------------------------------------------------
// remove one page from the notebook
bool wxNotebook::DeletePage(int nPage)
// remove one page from the notebook, without deleting the window
wxNotebookPage* wxNotebook::DoRemovePage(int nPage)
{
wxCHECK( IS_VALID_PAGE(nPage), FALSE );
delete m_aPages[nPage];
m_aPages.Remove(nPage);
wxCHECK( IS_VALID_PAGE(nPage), NULL );
wxNotebookPage* page = m_pages[nPage] ;
m_pages.Remove(nPage);
MacSetupTabs();
@ -224,20 +206,9 @@ bool wxNotebook::DeletePage(int nPage)
m_nSelection = GetPageCount() - 1;
}
if(m_nSelection >= 0) {
m_aPages[m_nSelection]->Show(true);
m_pages[m_nSelection]->Show(true);
}
return true;
}
// remove one page from the notebook, without deleting the window
bool wxNotebook::RemovePage(int nPage)
{
wxCHECK( IS_VALID_PAGE(nPage), FALSE );
m_aPages.Remove(nPage);
return TRUE;
return page;
}
// remove all pages
@ -245,26 +216,12 @@ bool wxNotebook::DeleteAllPages()
{
// TODO: delete native widget pages
int nPageCount = GetPageCount();
int nPage;
for ( nPage = 0; nPage < nPageCount; nPage++ )
delete m_aPages[nPage];
m_aPages.Clear();
WX_CLEAR_ARRAY(m_pages) ;
MacSetupTabs();
return TRUE;
}
// add a page to the notebook
bool wxNotebook::AddPage(wxNotebookPage *pPage,
const wxString& strText,
bool bSelect,
int imageId)
{
return InsertPage(GetPageCount(), pPage, strText, bSelect, imageId);
}
// same as AddPage() but does it at given position
bool wxNotebook::InsertPage(int nPage,
@ -279,7 +236,7 @@ bool wxNotebook::InsertPage(int nPage,
pPage->SetLabel(strText);
// save the pointer to the page
m_aPages.Insert(pPage, nPage);
m_pages.Insert(pPage, nPage);
MacSetupTabs();
@ -321,7 +278,7 @@ void wxNotebook::MacSetupTabs()
Boolean enabled = true;
for(int ii = 0; ii < GetPageCount(); ii++)
{
page = m_aPages[ii];
page = m_pages[ii];
info.version = 0;
info.iconSuiteID = 0;
#if TARGET_CARBON
@ -366,9 +323,9 @@ void wxNotebook::OnSize(wxSizeEvent& event)
int w, h;
GetSize(&w, &h);
unsigned int nCount = m_aPages.Count();
unsigned int nCount = m_pages.Count();
for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) {
wxNotebookPage *pPage = m_aPages[nPage];
wxNotebookPage *pPage = m_pages[nPage];
pPage->SetSize(kwxMacTabLeftMargin, kwxMacTabTopMargin,
w - kwxMacTabLeftMargin - kwxMacTabRightMargin,
h - kwxMacTabTopMargin - kwxMacTabBottomMargin );
@ -395,7 +352,7 @@ void wxNotebook::OnSetFocus(wxFocusEvent& event)
{
// set focus to the currently selected page if any
if ( m_nSelection != -1 )
m_aPages[m_nSelection]->SetFocus();
m_pages[m_nSelection]->SetFocus();
event.Skip();
}
@ -448,7 +405,7 @@ void wxNotebook::ChangePage(int nOldSel, int nSel)
// and it may happen - just do nothing
if ( nSel == nOldSel )
{
wxNotebookPage *pPage = m_aPages[nSel];
wxNotebookPage *pPage = m_pages[nSel];
pPage->Show(FALSE);
pPage->Show(TRUE);
pPage->SetFocus();
@ -457,10 +414,10 @@ void wxNotebook::ChangePage(int nOldSel, int nSel)
// Hide previous page
if ( nOldSel != -1 ) {
m_aPages[nOldSel]->Show(FALSE);
m_pages[nOldSel]->Show(FALSE);
}
wxNotebookPage *pPage = m_aPages[nSel];
wxNotebookPage *pPage = m_pages[nSel];
pPage->Show(TRUE);
pPage->SetFocus();

View File

@ -181,28 +181,6 @@ void wxRadioBox::Enable(int item, bool enable)
}
}
//-------------------------------------------------------------------------------------
// ¥ FindString
//-------------------------------------------------------------------------------------
// Finds a button matching the given string, returning the position if found
// or -1 if not found
int wxRadioBox::FindString(const wxString& s) const
{
int i;
wxRadioButton *current;
current=m_radioButtonCycle;
for (i = 0; i < m_noItems; i++)
{
if (s == current->GetLabel())
return i;
current=current->NextInCycle();
}
return -1;
}
//-------------------------------------------------------------------------------------
// ¥ GetLabel()
//-------------------------------------------------------------------------------------
@ -218,7 +196,7 @@ wxString wxRadioBox::GetLabel() const
//-------------------------------------------------------------------------------------
// Returns the label for the given button
wxString wxRadioBox::GetLabel(int item) const
wxString wxRadioBox::GetString(int item) const
{
int i;
wxRadioButton *current;
@ -254,31 +232,6 @@ int wxRadioBox::GetSelection() const
return i;
}
//-------------------------------------------------------------------------------------
// ¥ GetString
//-------------------------------------------------------------------------------------
// Find string for position
wxString wxRadioBox::GetString(int item) const
{
return GetLabel(item);
}
//-------------------------------------------------------------------------------------
// ¥ GetStringSelection
//-------------------------------------------------------------------------------------
// Returns the selected string
wxString wxRadioBox::GetStringSelection () const
{
int sel = GetSelection ();
if (sel > -1)
return this->GetString (sel);
else
return wxString("");
}
//-------------------------------------------------------------------------------------
// ¥ Number
//-------------------------------------------------------------------------------------
@ -302,7 +255,7 @@ void wxRadioBox::SetLabel(const wxString& label)
//-------------------------------------------------------------------------------------
// Sets the label of a given button
void wxRadioBox::SetLabel(int item,const wxString& label)
void wxRadioBox::SetString(int item,const wxString& label)
{
int i;
wxRadioButton *current;
@ -341,24 +294,6 @@ void wxRadioBox::SetSelection(int item)
}
//-------------------------------------------------------------------------------------
// ¥ SetStringSelection
//-------------------------------------------------------------------------------------
// Sets a button by passing the desired string. This does not cause
// wxEVT_COMMAND_RADIOBOX_SELECTED event to get emitted
bool wxRadioBox::SetStringSelection (const wxString& s)
{
int sel = FindString (s);
if (sel > -1)
{
SetSelection (sel);
return TRUE;
}
else
return FALSE;
}
//-------------------------------------------------------------------------------------
// ¥ Show(bool)
//-------------------------------------------------------------------------------------
@ -479,15 +414,15 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
maxHeight=-1;
for (i = 0 ; i < m_noItems; i++)
{
GetTextExtent(GetLabel(i), &eachWidth[i], &eachHeight[i]);
GetTextExtent(GetString(i), &eachWidth[i], &eachHeight[i]);
eachWidth[i] = (int)(eachWidth[i] + RADIO_SIZE);
eachHeight[i] = (int)((3*eachHeight[i])/2);
if (maxWidth<eachWidth[i]) maxWidth = eachWidth[i];
if (maxHeight<eachHeight[i]) maxHeight = eachHeight[i];
}
totHeight = GetNumVer() * (maxHeight + charHeight/2) + charHeight*3/2;
totWidth = GetNumHor() * (maxWidth + charWidth) + charWidth;
totHeight = GetRowCount() * (maxHeight + charHeight/2) + charHeight*3/2;
totWidth = GetColumnCount() * (maxWidth + charWidth) + charWidth;
// only change our width/height if asked for
if ( width == -1 )
@ -550,7 +485,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
//-------------------------------------------------------------------------------------
// return the number of buttons in the vertical direction
int wxRadioBox::GetNumVer() const
int wxRadioBox::GetRowCount() const
{
if ( m_windowStyle & wxRA_SPECIFY_ROWS )
{
@ -567,7 +502,7 @@ int wxRadioBox::GetNumVer() const
//-------------------------------------------------------------------------------------
// return the number of buttons in the horizontal direction
int wxRadioBox::GetNumHor() const
int wxRadioBox::GetColumnCount() const
{
if ( m_windowStyle & wxRA_SPECIFY_ROWS )
{

View File

@ -84,11 +84,6 @@ int wxSpinButton::GetValue() const
void wxSpinButton::SetValue(int val)
{
m_value = val ;
wxScrollEvent event(wxEVT_SCROLL_THUMBTRACK, m_windowId);
event.SetPosition(m_value);
event.SetEventObject( this );
GetEventHandler()->ProcessEvent(event);
}
void wxSpinButton::SetRange(int minVal, int maxVal)

View File

@ -23,7 +23,7 @@
// wxSpinCtrl
//-----------------------------------------------------------------------------
#if wxUSE_SPINBTN
#if wxUSE_SPINBTN && !defined(__WXMAC__)
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl,wxControl)

View File

@ -19,7 +19,7 @@
#include "wx/dcclient.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxStaticBitmapBase)
IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
#endif
/*

View File

@ -23,7 +23,7 @@
#include <stdio.h>
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxStaticTextBase)
IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
#endif
#include <wx/mac/uma.h>

View File

@ -107,7 +107,16 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
MacPreControlCreate( parent , id , "" , pos , mySize ,style, validator , name , &bounds , title ) ;
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , false , 0 , 0 , 1,
if ( m_windowStyle & wxTE_MULTILINE )
{
wxASSERT_MSG( !(m_windowStyle & wxTE_PROCESS_ENTER),
wxT("wxTE_PROCESS_ENTER style is ignored for multiline text controls (they always process it)") );
m_windowStyle |= wxTE_PROCESS_ENTER;
}
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , true , 0 , 0 , 1,
( style & wxTE_PASSWORD ) ? kControlEditTextPasswordProc : kControlEditTextProc , (long) this ) ;
MacPostControlCreate() ;
@ -653,7 +662,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
keychar = short(ev->message & charCodeMask);
keycode = short(ev->message & keyCodeMask) >> 8 ;
UMAHandleControlKey( m_macControl , keycode , keychar , ev->modifiers ) ;
if ( keychar >= 0x20 || event.KeyCode() == WXK_RETURN)
if ( keychar >= 0x20 || event.KeyCode() == WXK_RETURN || event.KeyCode() == WXK_DELETE || event.KeyCode() == WXK_BACK)
{
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
event.SetString( GetValue() ) ;

View File

@ -296,6 +296,11 @@ void wxWindow::CaptureMouse()
wxTheApp->s_captureWindow = this ;
}
wxWindow* wxWindowBase::GetCapture()
{
return wxTheApp->s_captureWindow ;
}
void wxWindow::ReleaseMouse()
{
wxTheApp->s_captureWindow = NULL ;