diff --git a/src/mac/carbon/imaglist.cpp b/src/mac/carbon/imaglist.cpp deleted file mode 100644 index 4b8ffc372e..0000000000 --- a/src/mac/carbon/imaglist.cpp +++ /dev/null @@ -1,125 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: imaglist.cpp -// Purpose: wxImageList. You may wish to use the generic version. -// Author: AUTHOR -// Modified by: -// Created: ??/??/98 -// RCS-ID: $Id$ -// Copyright: (c) AUTHOR -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "imaglist.h" -#endif - -#include "wx/stubs/imaglist.h" - -#if !USE_SHARED_LIBRARY -IMPLEMENT_DYNAMIC_CLASS(wxImageList, wxObject) -#endif - -wxImageList::wxImageList() -{ - // TODO: init image list handle, if any -} - -wxImageList::~wxImageList() -{ - // TODO: destroy image list handle, if any -} - -// Attributes -//////////////////////////////////////////////////////////////////////////// - -// Returns the number of images in the image list. -int wxImageList::GetImageCount() const -{ - // TODO - return 0; -} - -#if 0 -bool wxImageList::GetSize(int index, int &width, int &hieght) const -{ - // TODO - return false; -} -#endif - -// Operations -//////////////////////////////////////////////////////////////////////////// - -// Creates an image list -bool wxImageList::Create(int width, int height, bool mask, int initial) -{ - // TODO - return FALSE; -} - -// Adds a bitmap, and optionally a mask bitmap. -// Note that wxImageList creates new bitmaps, so you may delete -// 'bitmap' and 'mask'. -int wxImageList::Add(const wxBitmap& bitmap, const wxBitmap& mask) -{ - // TODO - return 0; -} - -// Adds a bitmap, using the specified colour to create the mask bitmap -// Note that wxImageList creates new bitmaps, so you may delete -// 'bitmap'. -int wxImageList::Add(const wxBitmap& bitmap, const wxColour& maskColour) -{ - // TODO - return 0; -} - -// Adds a bitmap and mask from an icon. -int wxImageList::Add(const wxIcon& icon) -{ - // TODO - return 0; -} - -// Replaces a bitmap, optionally passing a mask bitmap. -// Note that wxImageList creates new bitmaps, so you may delete -// 'bitmap' and 'mask'. -bool wxImageList::Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask) -{ - // TODO - return 0; -} - -// Replaces a bitmap and mask from an icon. -bool wxImageList::Replace(int index, const wxIcon& icon) -{ - // TODO - return 0; -} - -// Removes the image at the given index. -bool wxImageList::Remove(int index) -{ - // TODO - return FALSE; -} - -// Remove all images -bool wxImageList::RemoveAll() -{ - // TODO - return FALSE; -} - -// Draws the given image on a dc at the specified position. -// If 'solidBackground' is TRUE, Draw sets the image list background -// colour to the background colour of the wxDC, to speed up -// drawing by eliminating masked drawing where possible. -bool wxImageList::Draw(int index, wxDC& dc, int x, int y, - int flags, bool solidBackground) -{ - // TODO - return FALSE; -} - diff --git a/src/mac/carbon/listctrl.cpp b/src/mac/carbon/listctrl.cpp deleted file mode 100644 index d1d8445652..0000000000 --- a/src/mac/carbon/listctrl.cpp +++ /dev/null @@ -1,596 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: listctrl.cpp -// Purpose: wxListCtrl. See also Robert's generic wxListCtrl -// Author: AUTHOR -// Modified by: -// Created: ??/??/98 -// RCS-ID: $Id$ -// Copyright: (c) AUTHOR -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "listctrl.h" -#endif - -#include "wx/stubs/textctrl.h" -#include "wx/stubs/listctrl.h" - -#if !USE_SHARED_LIBRARY -IMPLEMENT_DYNAMIC_CLASS(wxListCtrl, wxControl) -IMPLEMENT_DYNAMIC_CLASS(wxListItem, wxObject) - -#endif - -wxListCtrl::wxListCtrl() -{ - m_imageListNormal = NULL; - m_imageListSmall = NULL; - m_imageListState = NULL; - m_baseStyle = 0; - m_colCount = 0; -} - -bool wxListCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, - long style, const wxValidator& validator, const wxString& name) -{ - m_imageListNormal = NULL; - m_imageListSmall = NULL; - m_imageListState = NULL; - m_colCount = 0; - - SetValidator(validator); - SetName(name); - - m_windowStyle = style; - - SetParent(parent); - - m_windowId = (id == -1) ? NewControlId() : id; - - if (parent) parent->AddChild(this); - - // TODO create list control - return TRUE; -} - -wxListCtrl::~wxListCtrl() -{ -} - -// Add or remove a single window style -void wxListCtrl::SetSingleStyle(long style, bool add) -{ - long flag = GetWindowStyleFlag(); - - // Get rid of conflicting styles - if ( add ) - { - if ( style & wxLC_MASK_TYPE) - flag = flag & ~wxLC_MASK_TYPE ; - if ( style & wxLC_MASK_ALIGN ) - flag = flag & ~wxLC_MASK_ALIGN ; - if ( style & wxLC_MASK_SORT ) - flag = flag & ~wxLC_MASK_SORT ; - } - - if ( flag & style ) - { - if ( !add ) - flag -= style; - } - else - { - if ( add ) - { - flag |= style; - } - } - - m_windowStyle = flag; - - /* TODO RecreateWindow(); */ -} - -// Set the whole window style -void wxListCtrl::SetWindowStyleFlag(long flag) -{ - m_windowStyle = flag; - - /* TODO RecreateWindow(); */ -} - - -// Gets information about this column -bool wxListCtrl::GetColumn(int col, wxListItem& item) const -{ - // TODO - return FALSE; -} - -// Sets information about this column -bool wxListCtrl::SetColumn(int col, wxListItem& item) -{ - // TODO - return FALSE; -} - -// Gets the column width -int wxListCtrl::GetColumnWidth(int col) const -{ - // TODO - return 0; -} - -// Sets the column width -bool wxListCtrl::SetColumnWidth(int col, int width) -{ - // TODO - return FALSE; -} - -// Gets the number of items that can fit vertically in the -// visible area of the list control (list or report view) -// or the total number of items in the list control (icon -// or small icon view) -int wxListCtrl::GetCountPerPage() const -{ - // TODO - return 0; -} - -// Gets the edit control for editing labels. -wxTextCtrl* wxListCtrl::GetEditControl() const -{ - return m_textCtrl; -} - -// Gets information about the item -bool wxListCtrl::GetItem(wxListItem& info) const -{ - // TODO - return FALSE; -} - -// Sets information about the item -bool wxListCtrl::SetItem(wxListItem& info) -{ - // TODO - return FALSE; -} - -long wxListCtrl::SetItem(long index, int col, const wxString& label, int imageId) -{ - wxListItem info; - info.m_text = label; - info.m_mask = wxLIST_MASK_TEXT; - info.m_itemId = index; - info.m_col = col; - if ( imageId > -1 ) - { - info.m_image = imageId; - info.m_mask |= wxLIST_MASK_IMAGE; - } - return SetItem(info); -} - - -// Gets the item state -int wxListCtrl::GetItemState(long item, long stateMask) const -{ - wxListItem info; - - info.m_mask = wxLIST_MASK_STATE ; - info.m_stateMask = stateMask; - info.m_itemId = item; - - if (!GetItem(info)) - return 0; - - return info.m_state; -} - -// Sets the item state -bool wxListCtrl::SetItemState(long item, long state, long stateMask) -{ - wxListItem info; - - info.m_mask = wxLIST_MASK_STATE ; - info.m_state = state; - info.m_stateMask = stateMask; - info.m_itemId = item; - - return SetItem(info); -} - -// Sets the item image -bool wxListCtrl::SetItemImage(long item, int image, int selImage) -{ - wxListItem info; - - info.m_mask = wxLIST_MASK_IMAGE ; - info.m_image = image; - info.m_itemId = item; - - return SetItem(info); -} - -// Gets the item text -wxString wxListCtrl::GetItemText(long item) const -{ - wxListItem info; - - info.m_mask = wxLIST_MASK_TEXT ; - info.m_itemId = item; - - if (!GetItem(info)) - return wxString(""); - return info.m_text; -} - -// Sets the item text -void wxListCtrl::SetItemText(long item, const wxString& str) -{ - wxListItem info; - - info.m_mask = wxLIST_MASK_TEXT ; - info.m_itemId = item; - info.m_text = str; - - SetItem(info); -} - -// Gets the item data -long wxListCtrl::GetItemData(long item) const -{ - wxListItem info; - - info.m_mask = wxLIST_MASK_DATA ; - info.m_itemId = item; - - if (!GetItem(info)) - return 0; - return info.m_data; -} - -// Sets the item data -bool wxListCtrl::SetItemData(long item, long data) -{ - wxListItem info; - - info.m_mask = wxLIST_MASK_DATA ; - info.m_itemId = item; - info.m_data = data; - - return SetItem(info); -} - -// Gets the item rectangle -bool wxListCtrl::GetItemRect(long item, wxRect& rect, int code) const -{ - // TODO - return FALSE; -} - -// Gets the item position -bool wxListCtrl::GetItemPosition(long item, wxPoint& pos) const -{ - // TODO - return FALSE; -} - -// Sets the item position. -bool wxListCtrl::SetItemPosition(long item, const wxPoint& pos) -{ - // TODO - return FALSE; -} - -// Gets the number of items in the list control -int wxListCtrl::GetItemCount() const -{ - // TODO - return FALSE; -} - -// Retrieves the spacing between icons in pixels. -// If small is TRUE, gets the spacing for the small icon -// view, otherwise the large icon view. -int wxListCtrl::GetItemSpacing(bool isSmall) const -{ - // TODO - return FALSE; -} - -// Gets the number of selected items in the list control -int wxListCtrl::GetSelectedItemCount() const -{ - // TODO - return FALSE; -} - -// Gets the text colour of the listview -wxColour wxListCtrl::GetTextColour() const -{ - // TODO - return wxColour(); -} - -// Sets the text colour of the listview -void wxListCtrl::SetTextColour(const wxColour& col) -{ - // TODO -} - -// Gets the index of the topmost visible item when in -// list or report view -long wxListCtrl::GetTopItem() const -{ - // TODO - return 0; -} - -// Searches for an item, starting from 'item'. -// 'geometry' is one of -// wxLIST_NEXT_ABOVE/ALL/BELOW/LEFT/RIGHT. -// 'state' is a state bit flag, one or more of -// wxLIST_STATE_DROPHILITED/FOCUSED/SELECTED/CUT. -// item can be -1 to find the first item that matches the -// specified flags. -// Returns the item or -1 if unsuccessful. -long wxListCtrl::GetNextItem(long item, int geom, int state) const -{ - // TODO - return 0; -} - -wxImageList *wxListCtrl::GetImageList(int which) const -{ - if ( which == wxIMAGE_LIST_NORMAL ) - { - return m_imageListNormal; - } - else if ( which == wxIMAGE_LIST_SMALL ) - { - return m_imageListSmall; - } - else if ( which == wxIMAGE_LIST_STATE ) - { - return m_imageListState; - } - return NULL; -} - -void wxListCtrl::SetImageList(wxImageList *imageList, int which) -{ - int flags = 0; - if ( which == wxIMAGE_LIST_NORMAL ) - { - m_imageListNormal = imageList; - } - else if ( which == wxIMAGE_LIST_SMALL ) - { - m_imageListSmall = imageList; - } - else if ( which == wxIMAGE_LIST_STATE ) - { - m_imageListState = imageList; - } - // TODO set image list -} - -// Operations -//////////////////////////////////////////////////////////////////////////// - -// Arranges the items -bool wxListCtrl::Arrange(int flag) -{ - // TODO - return FALSE; -} - -// Deletes an item -bool wxListCtrl::DeleteItem(long item) -{ - // TODO - return FALSE; -} - -// Deletes all items -bool wxListCtrl::DeleteAllItems() -{ - // TODO - return FALSE; -} - -// Deletes all items -bool wxListCtrl::DeleteAllColumns() -{ - // TODO - return FALSE; -} - -// Deletes a column -bool wxListCtrl::DeleteColumn(int col) -{ - // TODO - return FALSE; -} - -// Clears items, and columns if there are any. -void wxListCtrl::ClearAll() -{ - DeleteAllItems(); - if ( m_colCount > 0 ) - DeleteAllColumns(); -} - -// Edit the label -wxTextCtrl* wxListCtrl::EditLabel(long item, wxClassInfo* textControlClass) -{ - // TODO - return NULL; -} - -// End label editing, optionally cancelling the edit -bool wxListCtrl::EndEditLabel(bool cancel) -{ - // TODO - return FALSE; -} - -// Ensures this item is visible -bool wxListCtrl::EnsureVisible(long item) -{ - // TODO - return FALSE; -} - -// Find an item whose label matches this string, starting from the item after 'start' -// or the beginning if 'start' is -1. -long wxListCtrl::FindItem(long start, const wxString& str, bool partial) -{ - // TODO - return FALSE; -} - -// Find an item whose data matches this data, starting from the item after 'start' -// or the beginning if 'start' is -1. -long wxListCtrl::FindItem(long start, long data) -{ - // TODO - return 0; -} - -// Find an item nearest this position in the specified direction, starting from -// the item after 'start' or the beginning if 'start' is -1. -long wxListCtrl::FindItem(long start, const wxPoint& pt, int direction) -{ - // TODO - return 0; -} - -// Determines which item (if any) is at the specified point, -// giving details in 'flags' (see wxLIST_HITTEST_... flags above) -long wxListCtrl::HitTest(const wxPoint& point, int& flags) -{ - // TODO - return 0; -} - -// Inserts an item, returning the index of the new item if successful, -// -1 otherwise. -long wxListCtrl::InsertItem(wxListItem& info) -{ - // TODO - return 0; -} - -long wxListCtrl::InsertItem(long index, const wxString& label) -{ - wxListItem info; - info.m_text = label; - info.m_mask = wxLIST_MASK_TEXT; - info.m_itemId = index; - return InsertItem(info); -} - -// Inserts an image item -long wxListCtrl::InsertItem(long index, int imageIndex) -{ - wxListItem info; - info.m_image = imageIndex; - info.m_mask = wxLIST_MASK_IMAGE; - info.m_itemId = index; - return InsertItem(info); -} - -// Inserts an image/string item -long wxListCtrl::InsertItem(long index, const wxString& label, int imageIndex) -{ - wxListItem info; - info.m_image = imageIndex; - info.m_text = label; - info.m_mask = wxLIST_MASK_IMAGE | wxLIST_MASK_TEXT; - info.m_itemId = index; - return InsertItem(info); -} - -// For list view mode (only), inserts a column. -long wxListCtrl::InsertColumn(long col, wxListItem& item) -{ - // TODO - return 0; -} - -long wxListCtrl::InsertColumn(long col, const wxString& heading, int format, - int width) -{ - wxListItem item; - item.m_mask = wxLIST_MASK_TEXT | wxLIST_MASK_FORMAT; - item.m_text = heading; - if ( width > -1 ) - { - item.m_mask |= wxLIST_MASK_WIDTH; - item.m_width = width; - } - item.m_format = format; - - return InsertColumn(col, item); -} - -// Scrolls the list control. If in icon, small icon or report view mode, -// x specifies the number of pixels to scroll. If in list view mode, x -// specifies the number of columns to scroll. -// If in icon, small icon or list view mode, y specifies the number of pixels -// to scroll. If in report view mode, y specifies the number of lines to scroll. -bool wxListCtrl::ScrollList(int dx, int dy) -{ - // TODO - return FALSE; -} - -// Sort items. - -// fn is a function which takes 3 long arguments: item1, item2, data. -// item1 is the long data associated with a first item (NOT the index). -// item2 is the long data associated with a second item (NOT the index). -// data is the same value as passed to SortItems. -// The return value is a negative number if the first item should precede the second -// item, a positive number of the second item should precede the first, -// or zero if the two items are equivalent. - -// data is arbitrary data to be passed to the sort function. -bool wxListCtrl::SortItems(wxListCtrlCompare fn, long data) -{ - // TODO - return FALSE; -} - -// List item structure -wxListItem::wxListItem() -{ - m_mask = 0; - m_itemId = 0; - m_col = 0; - m_state = 0; - m_stateMask = 0; - m_image = 0; - m_data = 0; - - m_format = wxLIST_FORMAT_CENTRE; - m_width = 0; -} - -// List event -IMPLEMENT_DYNAMIC_CLASS(wxListEvent, wxCommandEvent) - -wxListEvent::wxListEvent(wxEventType commandType, int id): - wxCommandEvent(commandType, id) -{ - m_code = 0; - m_itemIndex = 0; - m_col = 0; - m_cancelled = FALSE; -} - diff --git a/src/mac/carbon/statusbr.cpp b/src/mac/carbon/statusbr.cpp deleted file mode 100644 index 4ff42994c0..0000000000 --- a/src/mac/carbon/statusbr.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: statbar.cpp -// Purpose: native implementation of wxStatusBar (optional) -// Author: AUTHOR -// Modified by: -// Created: ??/??/98 -// RCS-ID: $Id$ -// Copyright: (c) 1998 AUTHOR -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "statusbr.h" -#endif - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" -#include "wx/statusbr.h" - -IMPLEMENT_DYNAMIC_CLASS(wxStatusBarMac, wxStatusBar); - -BEGIN_EVENT_TABLE(wxStatusBarMac, wxStatusBar) - EVT_SIZE(wxStatusBarMac::OnSize) -END_EVENT_TABLE() - - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxStatusBarMac class -// ---------------------------------------------------------------------------- - -wxStatusBarMac::wxStatusBarMac() -{ - SetParent(NULL); -} - -bool wxStatusBarMac::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name = wxPanelNameStr) -{ - SetParent(parent); - - if (id == -1) - m_windowId = NewControlId(); - else - m_windowId = id; - - // TODO: create status bar - return FALSE; -} - -void wxStatusBarMac::SetFieldsCount(int nFields, const int widths[]) -{ - wxASSERT( (nFields > 0) && (nFields < 255) ); - - m_nFields = nFields; - - CopyFieldsWidth(widths); - SetFieldsWidth(); -} - -void wxStatusBarMac::SetStatusWidths(int n, const int widths[]) -{ - wxASSERT( n == m_nFields ); - - CopyFieldsWidth(widths); - SetFieldsWidth(); -} - -void wxStatusBarMac::CopyFieldsWidth(const int widths[]) -{ - if (widths && !m_statusWidths) - m_statusWidths = new int[m_nFields]; - - if ( widths != NULL ) { - for ( int i = 0; i < m_nFields; i++ ) - m_statusWidths[i] = widths[i]; - } - else { - delete [] m_statusWidths; - m_statusWidths = NULL; - } -} - -void wxStatusBarMac::SetFieldsWidth() -{ - int *pWidths = new int[m_nFields]; - - int nWindowWidth, y; - GetClientSize(&nWindowWidth, &y); - - if ( m_statusWidths == NULL ) { - // default: all fields have the same width - int nWidth = nWindowWidth / m_nFields; - for ( int i = 0; i < m_nFields; i++ ) - pWidths[i] = (i + 1) * nWidth; - } - else { - // -1 doesn't mean the same thing for wxWindows and Win32, recalc - int nTotalWidth = 0, - nVarCount = 0, - i; - for ( i = 0; i < m_nFields; i++ ) { - if ( m_statusWidths[i] == -1 ) - nVarCount++; - else - nTotalWidth += m_statusWidths[i]; - } - - if ( nVarCount == 0 ) { - // wrong! at least one field must be of variable width - wxFAIL; - - nVarCount++; - } - - int nVarWidth = (nWindowWidth - nTotalWidth) / nVarCount; - - // do fill the array - int nCurPos = 0; - for ( i = 0; i < m_nFields; i++ ) { - if ( m_statusWidths[i] == -1 ) - nCurPos += nVarWidth; - else - nCurPos += m_statusWidths[i]; - pWidths[i] = nCurPos; - } - } - - // TODO: set widths - - delete [] pWidths; -} - -void wxStatusBarMac::SetStatusText(const wxString& strText, int nField) -{ - // TODO -} - -wxString wxStatusBarMac::GetStatusText(int nField) const -{ - wxASSERT( (nField > -1) && (nField < m_nFields) ); - - // TODO - return wxString(""); -} - -void wxStatusBarMac::OnSize(wxSizeEvent& event) -{ - // adjust fields widths to the new size - SetFieldsWidth(); -} diff --git a/src/mac/imaglist.cpp b/src/mac/imaglist.cpp deleted file mode 100644 index 4b8ffc372e..0000000000 --- a/src/mac/imaglist.cpp +++ /dev/null @@ -1,125 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: imaglist.cpp -// Purpose: wxImageList. You may wish to use the generic version. -// Author: AUTHOR -// Modified by: -// Created: ??/??/98 -// RCS-ID: $Id$ -// Copyright: (c) AUTHOR -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "imaglist.h" -#endif - -#include "wx/stubs/imaglist.h" - -#if !USE_SHARED_LIBRARY -IMPLEMENT_DYNAMIC_CLASS(wxImageList, wxObject) -#endif - -wxImageList::wxImageList() -{ - // TODO: init image list handle, if any -} - -wxImageList::~wxImageList() -{ - // TODO: destroy image list handle, if any -} - -// Attributes -//////////////////////////////////////////////////////////////////////////// - -// Returns the number of images in the image list. -int wxImageList::GetImageCount() const -{ - // TODO - return 0; -} - -#if 0 -bool wxImageList::GetSize(int index, int &width, int &hieght) const -{ - // TODO - return false; -} -#endif - -// Operations -//////////////////////////////////////////////////////////////////////////// - -// Creates an image list -bool wxImageList::Create(int width, int height, bool mask, int initial) -{ - // TODO - return FALSE; -} - -// Adds a bitmap, and optionally a mask bitmap. -// Note that wxImageList creates new bitmaps, so you may delete -// 'bitmap' and 'mask'. -int wxImageList::Add(const wxBitmap& bitmap, const wxBitmap& mask) -{ - // TODO - return 0; -} - -// Adds a bitmap, using the specified colour to create the mask bitmap -// Note that wxImageList creates new bitmaps, so you may delete -// 'bitmap'. -int wxImageList::Add(const wxBitmap& bitmap, const wxColour& maskColour) -{ - // TODO - return 0; -} - -// Adds a bitmap and mask from an icon. -int wxImageList::Add(const wxIcon& icon) -{ - // TODO - return 0; -} - -// Replaces a bitmap, optionally passing a mask bitmap. -// Note that wxImageList creates new bitmaps, so you may delete -// 'bitmap' and 'mask'. -bool wxImageList::Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask) -{ - // TODO - return 0; -} - -// Replaces a bitmap and mask from an icon. -bool wxImageList::Replace(int index, const wxIcon& icon) -{ - // TODO - return 0; -} - -// Removes the image at the given index. -bool wxImageList::Remove(int index) -{ - // TODO - return FALSE; -} - -// Remove all images -bool wxImageList::RemoveAll() -{ - // TODO - return FALSE; -} - -// Draws the given image on a dc at the specified position. -// If 'solidBackground' is TRUE, Draw sets the image list background -// colour to the background colour of the wxDC, to speed up -// drawing by eliminating masked drawing where possible. -bool wxImageList::Draw(int index, wxDC& dc, int x, int y, - int flags, bool solidBackground) -{ - // TODO - return FALSE; -} - diff --git a/src/mac/listctrl.cpp b/src/mac/listctrl.cpp deleted file mode 100644 index d1d8445652..0000000000 --- a/src/mac/listctrl.cpp +++ /dev/null @@ -1,596 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: listctrl.cpp -// Purpose: wxListCtrl. See also Robert's generic wxListCtrl -// Author: AUTHOR -// Modified by: -// Created: ??/??/98 -// RCS-ID: $Id$ -// Copyright: (c) AUTHOR -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "listctrl.h" -#endif - -#include "wx/stubs/textctrl.h" -#include "wx/stubs/listctrl.h" - -#if !USE_SHARED_LIBRARY -IMPLEMENT_DYNAMIC_CLASS(wxListCtrl, wxControl) -IMPLEMENT_DYNAMIC_CLASS(wxListItem, wxObject) - -#endif - -wxListCtrl::wxListCtrl() -{ - m_imageListNormal = NULL; - m_imageListSmall = NULL; - m_imageListState = NULL; - m_baseStyle = 0; - m_colCount = 0; -} - -bool wxListCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, - long style, const wxValidator& validator, const wxString& name) -{ - m_imageListNormal = NULL; - m_imageListSmall = NULL; - m_imageListState = NULL; - m_colCount = 0; - - SetValidator(validator); - SetName(name); - - m_windowStyle = style; - - SetParent(parent); - - m_windowId = (id == -1) ? NewControlId() : id; - - if (parent) parent->AddChild(this); - - // TODO create list control - return TRUE; -} - -wxListCtrl::~wxListCtrl() -{ -} - -// Add or remove a single window style -void wxListCtrl::SetSingleStyle(long style, bool add) -{ - long flag = GetWindowStyleFlag(); - - // Get rid of conflicting styles - if ( add ) - { - if ( style & wxLC_MASK_TYPE) - flag = flag & ~wxLC_MASK_TYPE ; - if ( style & wxLC_MASK_ALIGN ) - flag = flag & ~wxLC_MASK_ALIGN ; - if ( style & wxLC_MASK_SORT ) - flag = flag & ~wxLC_MASK_SORT ; - } - - if ( flag & style ) - { - if ( !add ) - flag -= style; - } - else - { - if ( add ) - { - flag |= style; - } - } - - m_windowStyle = flag; - - /* TODO RecreateWindow(); */ -} - -// Set the whole window style -void wxListCtrl::SetWindowStyleFlag(long flag) -{ - m_windowStyle = flag; - - /* TODO RecreateWindow(); */ -} - - -// Gets information about this column -bool wxListCtrl::GetColumn(int col, wxListItem& item) const -{ - // TODO - return FALSE; -} - -// Sets information about this column -bool wxListCtrl::SetColumn(int col, wxListItem& item) -{ - // TODO - return FALSE; -} - -// Gets the column width -int wxListCtrl::GetColumnWidth(int col) const -{ - // TODO - return 0; -} - -// Sets the column width -bool wxListCtrl::SetColumnWidth(int col, int width) -{ - // TODO - return FALSE; -} - -// Gets the number of items that can fit vertically in the -// visible area of the list control (list or report view) -// or the total number of items in the list control (icon -// or small icon view) -int wxListCtrl::GetCountPerPage() const -{ - // TODO - return 0; -} - -// Gets the edit control for editing labels. -wxTextCtrl* wxListCtrl::GetEditControl() const -{ - return m_textCtrl; -} - -// Gets information about the item -bool wxListCtrl::GetItem(wxListItem& info) const -{ - // TODO - return FALSE; -} - -// Sets information about the item -bool wxListCtrl::SetItem(wxListItem& info) -{ - // TODO - return FALSE; -} - -long wxListCtrl::SetItem(long index, int col, const wxString& label, int imageId) -{ - wxListItem info; - info.m_text = label; - info.m_mask = wxLIST_MASK_TEXT; - info.m_itemId = index; - info.m_col = col; - if ( imageId > -1 ) - { - info.m_image = imageId; - info.m_mask |= wxLIST_MASK_IMAGE; - } - return SetItem(info); -} - - -// Gets the item state -int wxListCtrl::GetItemState(long item, long stateMask) const -{ - wxListItem info; - - info.m_mask = wxLIST_MASK_STATE ; - info.m_stateMask = stateMask; - info.m_itemId = item; - - if (!GetItem(info)) - return 0; - - return info.m_state; -} - -// Sets the item state -bool wxListCtrl::SetItemState(long item, long state, long stateMask) -{ - wxListItem info; - - info.m_mask = wxLIST_MASK_STATE ; - info.m_state = state; - info.m_stateMask = stateMask; - info.m_itemId = item; - - return SetItem(info); -} - -// Sets the item image -bool wxListCtrl::SetItemImage(long item, int image, int selImage) -{ - wxListItem info; - - info.m_mask = wxLIST_MASK_IMAGE ; - info.m_image = image; - info.m_itemId = item; - - return SetItem(info); -} - -// Gets the item text -wxString wxListCtrl::GetItemText(long item) const -{ - wxListItem info; - - info.m_mask = wxLIST_MASK_TEXT ; - info.m_itemId = item; - - if (!GetItem(info)) - return wxString(""); - return info.m_text; -} - -// Sets the item text -void wxListCtrl::SetItemText(long item, const wxString& str) -{ - wxListItem info; - - info.m_mask = wxLIST_MASK_TEXT ; - info.m_itemId = item; - info.m_text = str; - - SetItem(info); -} - -// Gets the item data -long wxListCtrl::GetItemData(long item) const -{ - wxListItem info; - - info.m_mask = wxLIST_MASK_DATA ; - info.m_itemId = item; - - if (!GetItem(info)) - return 0; - return info.m_data; -} - -// Sets the item data -bool wxListCtrl::SetItemData(long item, long data) -{ - wxListItem info; - - info.m_mask = wxLIST_MASK_DATA ; - info.m_itemId = item; - info.m_data = data; - - return SetItem(info); -} - -// Gets the item rectangle -bool wxListCtrl::GetItemRect(long item, wxRect& rect, int code) const -{ - // TODO - return FALSE; -} - -// Gets the item position -bool wxListCtrl::GetItemPosition(long item, wxPoint& pos) const -{ - // TODO - return FALSE; -} - -// Sets the item position. -bool wxListCtrl::SetItemPosition(long item, const wxPoint& pos) -{ - // TODO - return FALSE; -} - -// Gets the number of items in the list control -int wxListCtrl::GetItemCount() const -{ - // TODO - return FALSE; -} - -// Retrieves the spacing between icons in pixels. -// If small is TRUE, gets the spacing for the small icon -// view, otherwise the large icon view. -int wxListCtrl::GetItemSpacing(bool isSmall) const -{ - // TODO - return FALSE; -} - -// Gets the number of selected items in the list control -int wxListCtrl::GetSelectedItemCount() const -{ - // TODO - return FALSE; -} - -// Gets the text colour of the listview -wxColour wxListCtrl::GetTextColour() const -{ - // TODO - return wxColour(); -} - -// Sets the text colour of the listview -void wxListCtrl::SetTextColour(const wxColour& col) -{ - // TODO -} - -// Gets the index of the topmost visible item when in -// list or report view -long wxListCtrl::GetTopItem() const -{ - // TODO - return 0; -} - -// Searches for an item, starting from 'item'. -// 'geometry' is one of -// wxLIST_NEXT_ABOVE/ALL/BELOW/LEFT/RIGHT. -// 'state' is a state bit flag, one or more of -// wxLIST_STATE_DROPHILITED/FOCUSED/SELECTED/CUT. -// item can be -1 to find the first item that matches the -// specified flags. -// Returns the item or -1 if unsuccessful. -long wxListCtrl::GetNextItem(long item, int geom, int state) const -{ - // TODO - return 0; -} - -wxImageList *wxListCtrl::GetImageList(int which) const -{ - if ( which == wxIMAGE_LIST_NORMAL ) - { - return m_imageListNormal; - } - else if ( which == wxIMAGE_LIST_SMALL ) - { - return m_imageListSmall; - } - else if ( which == wxIMAGE_LIST_STATE ) - { - return m_imageListState; - } - return NULL; -} - -void wxListCtrl::SetImageList(wxImageList *imageList, int which) -{ - int flags = 0; - if ( which == wxIMAGE_LIST_NORMAL ) - { - m_imageListNormal = imageList; - } - else if ( which == wxIMAGE_LIST_SMALL ) - { - m_imageListSmall = imageList; - } - else if ( which == wxIMAGE_LIST_STATE ) - { - m_imageListState = imageList; - } - // TODO set image list -} - -// Operations -//////////////////////////////////////////////////////////////////////////// - -// Arranges the items -bool wxListCtrl::Arrange(int flag) -{ - // TODO - return FALSE; -} - -// Deletes an item -bool wxListCtrl::DeleteItem(long item) -{ - // TODO - return FALSE; -} - -// Deletes all items -bool wxListCtrl::DeleteAllItems() -{ - // TODO - return FALSE; -} - -// Deletes all items -bool wxListCtrl::DeleteAllColumns() -{ - // TODO - return FALSE; -} - -// Deletes a column -bool wxListCtrl::DeleteColumn(int col) -{ - // TODO - return FALSE; -} - -// Clears items, and columns if there are any. -void wxListCtrl::ClearAll() -{ - DeleteAllItems(); - if ( m_colCount > 0 ) - DeleteAllColumns(); -} - -// Edit the label -wxTextCtrl* wxListCtrl::EditLabel(long item, wxClassInfo* textControlClass) -{ - // TODO - return NULL; -} - -// End label editing, optionally cancelling the edit -bool wxListCtrl::EndEditLabel(bool cancel) -{ - // TODO - return FALSE; -} - -// Ensures this item is visible -bool wxListCtrl::EnsureVisible(long item) -{ - // TODO - return FALSE; -} - -// Find an item whose label matches this string, starting from the item after 'start' -// or the beginning if 'start' is -1. -long wxListCtrl::FindItem(long start, const wxString& str, bool partial) -{ - // TODO - return FALSE; -} - -// Find an item whose data matches this data, starting from the item after 'start' -// or the beginning if 'start' is -1. -long wxListCtrl::FindItem(long start, long data) -{ - // TODO - return 0; -} - -// Find an item nearest this position in the specified direction, starting from -// the item after 'start' or the beginning if 'start' is -1. -long wxListCtrl::FindItem(long start, const wxPoint& pt, int direction) -{ - // TODO - return 0; -} - -// Determines which item (if any) is at the specified point, -// giving details in 'flags' (see wxLIST_HITTEST_... flags above) -long wxListCtrl::HitTest(const wxPoint& point, int& flags) -{ - // TODO - return 0; -} - -// Inserts an item, returning the index of the new item if successful, -// -1 otherwise. -long wxListCtrl::InsertItem(wxListItem& info) -{ - // TODO - return 0; -} - -long wxListCtrl::InsertItem(long index, const wxString& label) -{ - wxListItem info; - info.m_text = label; - info.m_mask = wxLIST_MASK_TEXT; - info.m_itemId = index; - return InsertItem(info); -} - -// Inserts an image item -long wxListCtrl::InsertItem(long index, int imageIndex) -{ - wxListItem info; - info.m_image = imageIndex; - info.m_mask = wxLIST_MASK_IMAGE; - info.m_itemId = index; - return InsertItem(info); -} - -// Inserts an image/string item -long wxListCtrl::InsertItem(long index, const wxString& label, int imageIndex) -{ - wxListItem info; - info.m_image = imageIndex; - info.m_text = label; - info.m_mask = wxLIST_MASK_IMAGE | wxLIST_MASK_TEXT; - info.m_itemId = index; - return InsertItem(info); -} - -// For list view mode (only), inserts a column. -long wxListCtrl::InsertColumn(long col, wxListItem& item) -{ - // TODO - return 0; -} - -long wxListCtrl::InsertColumn(long col, const wxString& heading, int format, - int width) -{ - wxListItem item; - item.m_mask = wxLIST_MASK_TEXT | wxLIST_MASK_FORMAT; - item.m_text = heading; - if ( width > -1 ) - { - item.m_mask |= wxLIST_MASK_WIDTH; - item.m_width = width; - } - item.m_format = format; - - return InsertColumn(col, item); -} - -// Scrolls the list control. If in icon, small icon or report view mode, -// x specifies the number of pixels to scroll. If in list view mode, x -// specifies the number of columns to scroll. -// If in icon, small icon or list view mode, y specifies the number of pixels -// to scroll. If in report view mode, y specifies the number of lines to scroll. -bool wxListCtrl::ScrollList(int dx, int dy) -{ - // TODO - return FALSE; -} - -// Sort items. - -// fn is a function which takes 3 long arguments: item1, item2, data. -// item1 is the long data associated with a first item (NOT the index). -// item2 is the long data associated with a second item (NOT the index). -// data is the same value as passed to SortItems. -// The return value is a negative number if the first item should precede the second -// item, a positive number of the second item should precede the first, -// or zero if the two items are equivalent. - -// data is arbitrary data to be passed to the sort function. -bool wxListCtrl::SortItems(wxListCtrlCompare fn, long data) -{ - // TODO - return FALSE; -} - -// List item structure -wxListItem::wxListItem() -{ - m_mask = 0; - m_itemId = 0; - m_col = 0; - m_state = 0; - m_stateMask = 0; - m_image = 0; - m_data = 0; - - m_format = wxLIST_FORMAT_CENTRE; - m_width = 0; -} - -// List event -IMPLEMENT_DYNAMIC_CLASS(wxListEvent, wxCommandEvent) - -wxListEvent::wxListEvent(wxEventType commandType, int id): - wxCommandEvent(commandType, id) -{ - m_code = 0; - m_itemIndex = 0; - m_col = 0; - m_cancelled = FALSE; -} - diff --git a/src/mac/statusbr.cpp b/src/mac/statusbr.cpp deleted file mode 100644 index 4ff42994c0..0000000000 --- a/src/mac/statusbr.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: statbar.cpp -// Purpose: native implementation of wxStatusBar (optional) -// Author: AUTHOR -// Modified by: -// Created: ??/??/98 -// RCS-ID: $Id$ -// Copyright: (c) 1998 AUTHOR -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "statusbr.h" -#endif - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" -#include "wx/statusbr.h" - -IMPLEMENT_DYNAMIC_CLASS(wxStatusBarMac, wxStatusBar); - -BEGIN_EVENT_TABLE(wxStatusBarMac, wxStatusBar) - EVT_SIZE(wxStatusBarMac::OnSize) -END_EVENT_TABLE() - - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxStatusBarMac class -// ---------------------------------------------------------------------------- - -wxStatusBarMac::wxStatusBarMac() -{ - SetParent(NULL); -} - -bool wxStatusBarMac::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name = wxPanelNameStr) -{ - SetParent(parent); - - if (id == -1) - m_windowId = NewControlId(); - else - m_windowId = id; - - // TODO: create status bar - return FALSE; -} - -void wxStatusBarMac::SetFieldsCount(int nFields, const int widths[]) -{ - wxASSERT( (nFields > 0) && (nFields < 255) ); - - m_nFields = nFields; - - CopyFieldsWidth(widths); - SetFieldsWidth(); -} - -void wxStatusBarMac::SetStatusWidths(int n, const int widths[]) -{ - wxASSERT( n == m_nFields ); - - CopyFieldsWidth(widths); - SetFieldsWidth(); -} - -void wxStatusBarMac::CopyFieldsWidth(const int widths[]) -{ - if (widths && !m_statusWidths) - m_statusWidths = new int[m_nFields]; - - if ( widths != NULL ) { - for ( int i = 0; i < m_nFields; i++ ) - m_statusWidths[i] = widths[i]; - } - else { - delete [] m_statusWidths; - m_statusWidths = NULL; - } -} - -void wxStatusBarMac::SetFieldsWidth() -{ - int *pWidths = new int[m_nFields]; - - int nWindowWidth, y; - GetClientSize(&nWindowWidth, &y); - - if ( m_statusWidths == NULL ) { - // default: all fields have the same width - int nWidth = nWindowWidth / m_nFields; - for ( int i = 0; i < m_nFields; i++ ) - pWidths[i] = (i + 1) * nWidth; - } - else { - // -1 doesn't mean the same thing for wxWindows and Win32, recalc - int nTotalWidth = 0, - nVarCount = 0, - i; - for ( i = 0; i < m_nFields; i++ ) { - if ( m_statusWidths[i] == -1 ) - nVarCount++; - else - nTotalWidth += m_statusWidths[i]; - } - - if ( nVarCount == 0 ) { - // wrong! at least one field must be of variable width - wxFAIL; - - nVarCount++; - } - - int nVarWidth = (nWindowWidth - nTotalWidth) / nVarCount; - - // do fill the array - int nCurPos = 0; - for ( i = 0; i < m_nFields; i++ ) { - if ( m_statusWidths[i] == -1 ) - nCurPos += nVarWidth; - else - nCurPos += m_statusWidths[i]; - pWidths[i] = nCurPos; - } - } - - // TODO: set widths - - delete [] pWidths; -} - -void wxStatusBarMac::SetStatusText(const wxString& strText, int nField) -{ - // TODO -} - -wxString wxStatusBarMac::GetStatusText(int nField) const -{ - wxASSERT( (nField > -1) && (nField < m_nFields) ); - - // TODO - return wxString(""); -} - -void wxStatusBarMac::OnSize(wxSizeEvent& event) -{ - // adjust fields widths to the new size - SetFieldsWidth(); -}