#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
// without tons of #ifdefs.
// ----------------------------------------------------------------------------
-#if wxUSE_SPINBTN
+#if wxUSE_SPINBTN && !defined(__WXMAC__)
#ifdef __GNUG__
#pragma interface "spinctlg.h"
// 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
wxArrayString m_titles;
- wxFrame *m_menuBarFrame;
-
#if wxUSE_ACCEL
// the accelerator table for all accelerators in all our menus
wxAcceleratorTable m_accelTable;
// @@@ 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
// 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; }
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);
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();
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)
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 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);
- 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;
- inline virtual int GetCount() const { return m_noItems; } ;
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);
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO);
- int GetNumHor() const;
- int GetNumVer() const;
DECLARE_EVENT_TABLE()
};
#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
// 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.
#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)
// 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
// ----------------------------------------------------------------------------
#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() ;
#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__
wxList wxBitmap::sm_handlers;
+
+bool wxBitmap::CopyFromIcon(const wxIcon& icon)
+{
+ Ref(icon) ;
+}
+
wxBitmap::wxBitmap()
{
m_refData = NULL;
#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() ;
#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__
wxList wxBitmap::sm_handlers;
+
+bool wxBitmap::CopyFromIcon(const wxIcon& icon)
+{
+ Ref(icon) ;
+}
+
wxBitmap::wxBitmap()
{
m_refData = NULL;
m_refData = new wxBitmapRefData;
- wxBitmapHandler *handler = FindHandler(type);
+ wxBitmapHandler *handler = FindHandler((wxBitmapType)type);
if ( handler )
return handler->LoadFile(this, filename, type, desiredWidth, desiredHeight);
// 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 )
if ( !wxMenuBarBase::Append(menu, title) )
return FALSE;
- menu->Attach(this);
-
m_titles.Add(title);
if ( IsAttached() )
return TRUE;
}
-void wxMenuBar::Attach(wxFrame *frame)
+void wxMenuBar::Detach()
{
-// wxASSERT_MSG( !IsAttached(), wxT("menubar already attached!") );
+ wxMenuBarBase::Detach() ;
+}
- m_menuBarFrame = frame;
+void wxMenuBar::Attach(wxFrame *frame)
+{
+ wxMenuBarBase::Attach( frame ) ;
#if wxUSE_ACCEL
RebuildAccelTable();
m_macHorizontalBorder = 7;
m_macVerticalBorder = 8;
#endif
- m_pImageList = NULL;
m_nSelection = -1;
}
// ----------------------------------------------------------------------------
// wxNotebook accessors
// ----------------------------------------------------------------------------
-int wxNotebook::GetPageCount() const
+
+void wxNotebook::SetPadding(const wxSize& padding)
+{
+}
+
+void wxNotebook::SetTabSize(const wxSize& sz)
{
- return m_aPages.Count();
}
-int wxNotebook::GetRowCount() const
+void wxNotebook::SetPageSize(const wxSize& size)
{
- return 1;
}
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();
{
wxASSERT( IS_VALID_PAGE(nPage) );
- wxNotebookPage *page = m_aPages[nPage];
+ wxNotebookPage *page = m_pages[nPage];
return page->GetLabel();
}
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();
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
{
// 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,
pPage->SetLabel(strText);
// save the pointer to the page
- m_aPages.Insert(pPage, nPage);
+ m_pages.Insert(pPage, nPage);
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
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 );
{
// 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();
}
// 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();
// 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();
}
}
-
-//-------------------------------------------------------------------------------------
-// ¥ 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()
//-------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------
// Returns the label for the given button
-wxString wxRadioBox::GetLabel(int item) const
+wxString wxRadioBox::GetString(int item) const
{
int i;
wxRadioButton *current;
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
//-------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------
// 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;
}
-//-------------------------------------------------------------------------------------
-// ¥ 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)
//-------------------------------------------------------------------------------------
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 )
//-------------------------------------------------------------------------------------
// return the number of buttons in the vertical direction
-int wxRadioBox::GetNumVer() const
+int wxRadioBox::GetRowCount() const
{
if ( m_windowStyle & wxRA_SPECIFY_ROWS )
{
//-------------------------------------------------------------------------------------
// return the number of buttons in the horizontal direction
-int wxRadioBox::GetNumHor() const
+int wxRadioBox::GetColumnCount() const
{
if ( m_windowStyle & wxRA_SPECIFY_ROWS )
{
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)
// wxSpinCtrl
//-----------------------------------------------------------------------------
-#if wxUSE_SPINBTN
+#if wxUSE_SPINBTN && !defined(__WXMAC__)
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl,wxControl)
#include "wx/dcclient.h"
#if !USE_SHARED_LIBRARY
-IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxStaticBitmapBase)
+IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
#endif
/*
#include <stdio.h>
#if !USE_SHARED_LIBRARY
-IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxStaticTextBase)
+IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
#endif
#include <wx/mac/uma.h>
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() ;
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() ) ;
wxTheApp->s_captureWindow = this ;
}
+wxWindow* wxWindowBase::GetCapture()
+{
+ return wxTheApp->s_captureWindow ;
+}
+
void wxWindow::ReleaseMouse()
{
wxTheApp->s_captureWindow = NULL ;
m_refData = new wxBitmapRefData;
- wxBitmapHandler *handler = FindHandler(type);
+ wxBitmapHandler *handler = FindHandler((wxBitmapType)type);
if ( handler )
return handler->LoadFile(this, filename, type, desiredWidth, desiredHeight);
// 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 )
if ( !wxMenuBarBase::Append(menu, title) )
return FALSE;
- menu->Attach(this);
-
m_titles.Add(title);
if ( IsAttached() )
return TRUE;
}
-void wxMenuBar::Attach(wxFrame *frame)
+void wxMenuBar::Detach()
{
-// wxASSERT_MSG( !IsAttached(), wxT("menubar already attached!") );
+ wxMenuBarBase::Detach() ;
+}
- m_menuBarFrame = frame;
+void wxMenuBar::Attach(wxFrame *frame)
+{
+ wxMenuBarBase::Attach( frame ) ;
#if wxUSE_ACCEL
RebuildAccelTable();
m_macHorizontalBorder = 7;
m_macVerticalBorder = 8;
#endif
- m_pImageList = NULL;
m_nSelection = -1;
}
// ----------------------------------------------------------------------------
// wxNotebook accessors
// ----------------------------------------------------------------------------
-int wxNotebook::GetPageCount() const
+
+void wxNotebook::SetPadding(const wxSize& padding)
+{
+}
+
+void wxNotebook::SetTabSize(const wxSize& sz)
{
- return m_aPages.Count();
}
-int wxNotebook::GetRowCount() const
+void wxNotebook::SetPageSize(const wxSize& size)
{
- return 1;
}
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();
{
wxASSERT( IS_VALID_PAGE(nPage) );
- wxNotebookPage *page = m_aPages[nPage];
+ wxNotebookPage *page = m_pages[nPage];
return page->GetLabel();
}
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();
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
{
// 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,
pPage->SetLabel(strText);
// save the pointer to the page
- m_aPages.Insert(pPage, nPage);
+ m_pages.Insert(pPage, nPage);
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
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 );
{
// 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();
}
// 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();
// 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();
}
}
-
-//-------------------------------------------------------------------------------------
-// ¥ 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()
//-------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------
// Returns the label for the given button
-wxString wxRadioBox::GetLabel(int item) const
+wxString wxRadioBox::GetString(int item) const
{
int i;
wxRadioButton *current;
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
//-------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------
// 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;
}
-//-------------------------------------------------------------------------------------
-// ¥ 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)
//-------------------------------------------------------------------------------------
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 )
//-------------------------------------------------------------------------------------
// return the number of buttons in the vertical direction
-int wxRadioBox::GetNumVer() const
+int wxRadioBox::GetRowCount() const
{
if ( m_windowStyle & wxRA_SPECIFY_ROWS )
{
//-------------------------------------------------------------------------------------
// return the number of buttons in the horizontal direction
-int wxRadioBox::GetNumHor() const
+int wxRadioBox::GetColumnCount() const
{
if ( m_windowStyle & wxRA_SPECIFY_ROWS )
{
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)
// wxSpinCtrl
//-----------------------------------------------------------------------------
-#if wxUSE_SPINBTN
+#if wxUSE_SPINBTN && !defined(__WXMAC__)
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl,wxControl)
#include "wx/dcclient.h"
#if !USE_SHARED_LIBRARY
-IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxStaticBitmapBase)
+IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
#endif
/*
#include <stdio.h>
#if !USE_SHARED_LIBRARY
-IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxStaticTextBase)
+IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
#endif
#include <wx/mac/uma.h>
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() ;
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() ) ;
wxTheApp->s_captureWindow = this ;
}
+wxWindow* wxWindowBase::GetCapture()
+{
+ return wxTheApp->s_captureWindow ;
+}
+
void wxWindow::ReleaseMouse()
{
wxTheApp->s_captureWindow = NULL ;