From e6ebb51430cd8e4a9a11c6c5a5ca7c3ff9d7a72a Mon Sep 17 00:00:00 2001 From: David Webster Date: Sun, 24 Oct 1999 15:57:35 +0000 Subject: [PATCH 1/1] *** empty log message *** git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4160 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/listctrl.h | 2 +- include/wx/os2/colordlg.h | 42 - include/wx/os2/dnd.h | 2 +- include/wx/os2/frame.h | 6 +- include/wx/os2/imaglist.h | 131 --- include/wx/os2/listctrl.h | 421 --------- include/wx/os2/statline.h | 6 +- include/wx/os2/statusbr.h | 48 -- include/wx/os2/treectrl.h | 497 ----------- include/wx/propform.h | 33 +- include/wx/treectrl.h | 2 +- src/os2/choice.cpp | 5 +- src/os2/dataobj.cpp | 24 +- src/os2/dnd.cpp | 4 +- src/os2/frame.cpp | 6 +- src/os2/gauge.cpp | 5 +- src/os2/imaglist.cpp | 192 ----- src/os2/listbox.cpp | 2 +- src/os2/listctrl.cpp | 1190 -------------------------- src/os2/makefile.va | 194 +++-- src/os2/pen.cpp | 5 + src/os2/treectrl.cpp | 1689 ------------------------------------- src/os2/utils.cpp | 14 +- src/png/png.h | 30 +- src/png/pngrio.c | 5 + src/png/pngwio.c | 15 + src/zlib/adler32.c | 6 +- src/zlib/compress.c | 10 +- src/zlib/crc32.c | 8 +- src/zlib/deflate.c | 87 +- src/zlib/gzio.c | 116 ++- src/zlib/infblock.c | 33 +- src/zlib/infcodes.c | 17 +- src/zlib/inffast.c | 6 +- src/zlib/inflate.c | 42 +- src/zlib/inftrees.c | 26 +- src/zlib/infutil.c | 6 +- src/zlib/trees.c | 88 +- src/zlib/uncompr.c | 6 +- src/zlib/zconf.h | 9 +- src/zlib/zutil.c | 30 +- src/zlib/zutil.h | 7 +- 42 files changed, 664 insertions(+), 4403 deletions(-) delete mode 100644 include/wx/os2/colordlg.h delete mode 100644 include/wx/os2/imaglist.h delete mode 100644 include/wx/os2/listctrl.h delete mode 100644 include/wx/os2/statusbr.h delete mode 100644 include/wx/os2/treectrl.h delete mode 100644 src/os2/imaglist.cpp delete mode 100644 src/os2/listctrl.cpp delete mode 100644 src/os2/treectrl.cpp diff --git a/include/wx/listctrl.h b/include/wx/listctrl.h index 89f8a5ab53..cf40f4bd41 100644 --- a/include/wx/listctrl.h +++ b/include/wx/listctrl.h @@ -16,7 +16,7 @@ #elif defined(__WXMAC__) #include "wx/generic/listctrl.h" #elif defined(__WXPM__) -#include "wx/os2/listctrl.h" +#include "wx/generic/listctrl.h" #elif defined(__WXSTUBS__) #include "wx/generic/listctrl.h" #endif diff --git a/include/wx/os2/colordlg.h b/include/wx/os2/colordlg.h deleted file mode 100644 index 3d207b9b6b..0000000000 --- a/include/wx/os2/colordlg.h +++ /dev/null @@ -1,42 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: colordlg.h -// Purpose: wxColourDialog class. Use generic version if no -// platform-specific implementation. -// Author: David Webster -// Modified by: -// Created: 10/13/99 -// RCS-ID: $Id$ -// Copyright: (c) David Webster -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COLORDLG_H_ -#define _WX_COLORDLG_H_ - -#include "wx/setup.h" -#include "wx/dialog.h" -#include "wx/cmndata.h" - -/* - * Platform-specific colour dialog implementation - */ - -class WXDLLEXPORT wxColourDialog: public wxDialog -{ -DECLARE_DYNAMIC_CLASS(wxColourDialog) -public: - wxColourDialog(); - wxColourDialog(wxWindow *parent, wxColourData *data = NULL); - - bool Create(wxWindow *parent, wxColourData *data = NULL); - - int ShowModal(); - wxColourData& GetColourData() { return m_colourData; } - -protected: - wxColourData m_colourData; - wxWindow* m_dialogParent; -}; - -#endif - // _WX_COLORDLG_H_ diff --git a/include/wx/os2/dnd.h b/include/wx/os2/dnd.h index 60efc76fe8..8517e9d86c 100644 --- a/include/wx/os2/dnd.h +++ b/include/wx/os2/dnd.h @@ -33,7 +33,7 @@ public: /* constructor for setting one data object */ wxDropSource( wxDataObject& rData, - wxWindow* pWin, + wxWindow* pWin ); virtual ~wxDropSource(); diff --git a/include/wx/os2/frame.h b/include/wx/os2/frame.h index f6ed0488a0..e316c8f32c 100644 --- a/include/wx/os2/frame.h +++ b/include/wx/os2/frame.h @@ -55,9 +55,6 @@ public: virtual bool Destroy(); - virtual void ClientToScreen(int *x, int *y) const; - virtual void ScreenToClient(int *x, int *y) const; - void OnSize(wxSizeEvent& event); void OnMenuHighlight(wxMenuEvent& event); void OnActivate(wxActivateEvent& event); @@ -177,6 +174,9 @@ protected: virtual void DoSetClientSize(int width, int height); + virtual void DoClientToScreen(int *x, int *y) const; + virtual void DoScreenToClient(int *x, int *y) const; + // a plug in for MDI frame classes which need to do something special when // the menubar is set virtual void InternalSetMenuBar(); diff --git a/include/wx/os2/imaglist.h b/include/wx/os2/imaglist.h deleted file mode 100644 index 5dd12e9940..0000000000 --- a/include/wx/os2/imaglist.h +++ /dev/null @@ -1,131 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: imaglist.h -// Purpose: wxImageList class. Note: if your GUI doesn't have -// an image list equivalent, you can use the generic class -// in src/generic. -// Author: David Webster -// Modified by: -// Created: 10/09/99 -// RCS-ID: $Id$ -// Copyright: (c) David Webster -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGLIST_H_ -#define _WX_IMAGLIST_H_ - -#include "wx/bitmap.h" - -/* - * wxImageList is used for wxListCtrl, wxTreeCtrl. These controls refer to - * images for their items by an index into an image list. - * A wxImageList is capable of creating images with optional masks from - * a variety of sources - a single bitmap plus a colour to indicate the mask, - * two bitmaps, or an icon. - * - */ - -// Flags for Draw -#define wxIMAGELIST_DRAW_NORMAL 0x0001 -#define wxIMAGELIST_DRAW_TRANSPARENT 0x0002 -#define wxIMAGELIST_DRAW_SELECTED 0x0004 -#define wxIMAGELIST_DRAW_FOCUSED 0x0008 - -// Flag values for Set/GetImageList -enum { - wxIMAGE_LIST_NORMAL, // Normal icons - wxIMAGE_LIST_SMALL, // Small icons - wxIMAGE_LIST_STATE // State icons: unimplemented (see WIN32 documentation) -}; - -// Eventually we'll make this a reference-counted wxGDIObject. For -// now, the app must take care of ownership issues. That is, the -// image lists must be explicitly deleted after the control(s) that uses them -// is (are) deleted, or when the app exits. -class WXDLLEXPORT wxImageList: public wxObject -{ - DECLARE_DYNAMIC_CLASS(wxImageList) - public: - /* - * Public interface - */ - - wxImageList(); - - // Creates an image list. - // Specify the width and height of the images in the list, - // whether there are masks associated with them (e.g. if creating images - // from icons), and the initial size of the list. - inline wxImageList(int width, int height, bool mask = TRUE, int initialCount = 1) - { - Create(width, height, mask, initialCount); - } - ~wxImageList(); - - - // Attributes - //////////////////////////////////////////////////////////////////////////// - - // Returns the number of images in the image list. - int GetImageCount() const; - - // Operations - //////////////////////////////////////////////////////////////////////////// - - // Creates an image list - // width, height specify the size of the images in the list (all the same). - // mask specifies whether the images have masks or not. - // initialNumber is the initial number of images to reserve. - bool Create(int width, int height, bool mask = TRUE, int initialNumber = 1); - - // Adds a bitmap, and optionally a mask bitmap. - // Note that wxImageList creates *new* bitmaps, so you may delete - // 'bitmap' and 'mask' after calling Add. - int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap); - - // Adds a bitmap, using the specified colour to create the mask bitmap - // Note that wxImageList creates *new* bitmaps, so you may delete - // 'bitmap' after calling Add. - int Add(const wxBitmap& bitmap, const wxColour& maskColour); - - // Adds a bitmap and mask from an icon. - int Add(const wxIcon& icon); - - // Replaces a bitmap, optionally passing a mask bitmap. - // Note that wxImageList creates new bitmaps, so you may delete - // 'bitmap' and 'mask' after calling Replace. - bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap); - - // Replaces a bitmap and mask from an icon. - // You can delete 'icon' after calling Replace. - bool Replace(int index, const wxIcon& icon); - - // Removes the image at the given index. - bool Remove(int index); - - // Remove all images - bool RemoveAll(); - - // 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 Draw(int index, wxDC& dc, int x, int y, - int flags = wxIMAGELIST_DRAW_NORMAL, bool solidBackground = FALSE); - -/* TODO (optional?) - wxIcon *MakeIcon(int index); -*/ - - // Implementation - //////////////////////////////////////////////////////////////////////////// - - // Returns the native image list handle - inline WXHIMAGELIST GetHIMAGELIST() const { return m_hImageList; } - -protected: - WXHIMAGELIST m_hImageList; -}; - -#endif - // _WX_IMAGLIST_H_ diff --git a/include/wx/os2/listctrl.h b/include/wx/os2/listctrl.h deleted file mode 100644 index dd764cc1e8..0000000000 --- a/include/wx/os2/listctrl.h +++ /dev/null @@ -1,421 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: listctrl.h -// Purpose: wxListCtrl class -// Author: David Webster -// Modified by: -// Created: 10/10/99 -// RCS-ID: $Id$ -// Copyright: (c) David Webster -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LISTCTRL_H_ -#define _WX_LISTCTRL_H_ - -#include "wx/control.h" -#include "wx/event.h" -#include "wx/imaglist.h" - -/* - The wxListCtrl can show lists of items in four different modes: - wxLC_LIST: multicolumn list view, with optional small icons (icons could be - optional for some platforms). Columns are computed automatically, - i.e. you don't set columns as in wxLC_REPORT. In other words, - the list wraps, unlike a wxListBox. - wxLC_REPORT: single or multicolumn report view (with optional header) - wxLC_ICON: large icon view, with optional labels - wxLC_SMALL_ICON: small icon view, with optional labels - - You can change the style dynamically, either with SetSingleStyle or - SetWindowStyleFlag. - - Further window styles: - - wxLC_ALIGN_TOP icons align to the top (default) - wxLC_ALIGN_LEFT icons align to the left - wxLC_AUTOARRANGE icons arrange themselves - wxLC_USER_TEXT the app provides label text on demand, except for column headers - wxLC_EDIT_LABELS labels are editable: app will be notified. - wxLC_NO_HEADER no header in report mode - wxLC_NO_SORT_HEADER can't click on header - wxLC_SINGLE_SEL single selection - wxLC_SORT_ASCENDING sort ascending (must still supply a comparison callback in SortItems) - wxLC_SORT_DESCENDING sort descending (ditto) - - Items are referred to by their index (position in the list starting from zero). - - Label text is supplied via insertion/setting functions and is stored by the - control, unless the wxLC_USER_TEXT style has been specified, in which case - the app will be notified when text is required (see sample). - - Images are dealt with by (optionally) associating 3 image lists with the control. - Zero-based indexes into these image lists indicate which image is to be used for - which item. Each image in an image list can contain a mask, and can be made out - of either a bitmap, two bitmaps or an icon. See ImagList.h for more details. - - Notifications are passed via the wxWindows 2.0 event system. - - See the sample wxListCtrl app for API usage. - - */ - -// Mask flags to tell app/GUI what fields of wxListItem are valid -#define wxLIST_MASK_STATE 0x0001 -#define wxLIST_MASK_TEXT 0x0002 -#define wxLIST_MASK_IMAGE 0x0004 -#define wxLIST_MASK_DATA 0x0008 -#define wxLIST_SET_ITEM 0x0010 -#define wxLIST_MASK_WIDTH 0x0020 -#define wxLIST_MASK_FORMAT 0x0040 - -// State flags for indicating the state of an item -#define wxLIST_STATE_DONTCARE 0x0000 -#define wxLIST_STATE_DROPHILITED 0x0001 -#define wxLIST_STATE_FOCUSED 0x0002 -#define wxLIST_STATE_SELECTED 0x0004 -#define wxLIST_STATE_CUT 0x0008 - -// Hit test flags, used in HitTest -#define wxLIST_HITTEST_ABOVE 0x0001 // Above the client area. -#define wxLIST_HITTEST_BELOW 0x0002 // Below the client area. -#define wxLIST_HITTEST_NOWHERE 0x0004 // In the client area but below the last item. -#define wxLIST_HITTEST_ONITEMICON 0x0020 // On the bitmap associated with an item. -#define wxLIST_HITTEST_ONITEMLABEL 0x0080 // On the label (string) associated with an item. -#define wxLIST_HITTEST_ONITEMRIGHT 0x0100 // In the area to the right of an item. -#define wxLIST_HITTEST_ONITEMSTATEICON 0x0200 // On the state icon for a tree view item that is in a user-defined state. -#define wxLIST_HITTEST_TOLEFT 0x0400 // To the left of the client area. -#define wxLIST_HITTEST_TORIGHT 0x0800 // To the right of the client area. - -#define wxLIST_HITTEST_ONITEM (wxLIST_HITTEST_ONITEMICON | wxLIST_HITTEST_ONITEMLABEL wxLIST_HITTEST_ONITEMSTATEICON) - -// Flags for GetNextItem -enum { - wxLIST_NEXT_ABOVE, // Searches for an item above the specified item - wxLIST_NEXT_ALL, // Searches for subsequent item by index - wxLIST_NEXT_BELOW, // Searches for an item below the specified item - wxLIST_NEXT_LEFT, // Searches for an item to the left of the specified item - wxLIST_NEXT_RIGHT // Searches for an item to the right of the specified item -}; - -// Alignment flags for Arrange -enum { - wxLIST_ALIGN_DEFAULT, - wxLIST_ALIGN_LEFT, - wxLIST_ALIGN_TOP, - wxLIST_ALIGN_SNAP_TO_GRID -}; - -// Column format -enum { - wxLIST_FORMAT_LEFT, - wxLIST_FORMAT_RIGHT, - wxLIST_FORMAT_CENTRE, - wxLIST_FORMAT_CENTER = wxLIST_FORMAT_CENTRE -}; - -// Autosize values for SetColumnWidth -enum { - wxLIST_AUTOSIZE = -1, - wxLIST_AUTOSIZE_USEHEADER = -2 -}; - -// Flag values for GetItemRect -enum { - wxLIST_RECT_BOUNDS, - wxLIST_RECT_ICON, - wxLIST_RECT_LABEL -}; - -// Flag values for FindItem -enum { - wxLIST_FIND_UP, - wxLIST_FIND_DOWN, - wxLIST_FIND_LEFT, - wxLIST_FIND_RIGHT -}; - -// wxListItem: data representing an item, or report field. -// It also doubles up to represent entire column information -// when inserting or setting a column. -class WXDLLEXPORT wxListItem: public wxObject -{ - DECLARE_DYNAMIC_CLASS(wxListItem) -public: - long m_mask; // Indicates what fields are valid - long m_itemId; // The zero-based item position - int m_col; // Zero-based column, if in report mode - long m_state; // The state of the item - long m_stateMask; // Which flags of m_state are valid (uses same flags) - wxString m_text; // The label/header text - int m_image; // The zero-based index into an image list - long m_data; // App-defined data - - // For columns only - int m_format; // left, right, centre - int m_width; // width of column - - wxListItem(); -}; - -// type of compare function for wxListCtrl sort operation -typedef int (*wxListCtrlCompare)(long item1, long item2, long sortData); - -class WXDLLEXPORT wxListCtrl: public wxControl -{ - DECLARE_DYNAMIC_CLASS(wxListCtrl) - public: - /* - * Public interface - */ - - wxListCtrl(); - - inline wxListCtrl(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator, - const wxString& name = "listCtrl") - { - Create(parent, id, pos, size, style, validator, name); - } - ~wxListCtrl(); - - bool Create(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator, const wxString& name = "wxListCtrl"); - - - // Attributes - //////////////////////////////////////////////////////////////////////////// - - // Sets the background colour (GetBackgroundColour already implicit in - // wxWindow class) - bool SetBackgroundColour(const wxColour& col); - - // Gets information about this column - bool GetColumn(int col, wxListItem& item) const; - - // Sets information about this column - bool SetColumn(int col, wxListItem& item) ; - - // Gets the column width - int GetColumnWidth(int col) const; - - // Sets the column width - bool SetColumnWidth(int col, int width) ; - - // 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 GetCountPerPage() const; - - // Gets the edit control for editing labels. - wxTextCtrl* GetEditControl() const; - - // Gets information about the item - bool GetItem(wxListItem& info) const ; - - // Sets information about the item - bool SetItem(wxListItem& info) ; - - // Sets a string field at a particular column - long SetItem(long index, int col, const wxString& label, int imageId = -1); - - // Gets the item state - int GetItemState(long item, long stateMask) const ; - - // Sets the item state - bool SetItemState(long item, long state, long stateMask) ; - - // Sets the item image - bool SetItemImage(long item, int image, int selImage) ; - - // Gets the item text - wxString GetItemText(long item) const ; - - // Sets the item text - void SetItemText(long item, const wxString& str) ; - - // Gets the item data - long GetItemData(long item) const ; - - // Sets the item data - bool SetItemData(long item, long data) ; - - // Gets the item rectangle - bool GetItemRect(long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const ; - - // Gets the item position - bool GetItemPosition(long item, wxPoint& pos) const ; - - // Sets the item position - bool SetItemPosition(long item, const wxPoint& pos) ; - - // Gets the number of items in the list control - int GetItemCount() const; - - // Gets the number of columns in the list control - int GetColumnCount() const; - - // 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 GetItemSpacing(bool isSmall) const; - - // Gets the number of selected items in the list control - int GetSelectedItemCount() const; - - // Gets the text colour of the listview - wxColour GetTextColour() const; - - // Sets the text colour of the listview - void SetTextColour(const wxColour& col); - - // Gets the index of the topmost visible item when in - // list or report view - long GetTopItem() const ; - - // Add or remove a single window style - void SetSingleStyle(long style, bool add = TRUE) ; - - // Set the whole window style - void SetWindowStyleFlag(long style) ; - - // Searches for an item, starting from 'item'. - // item can be -1 to find the first item that matches the - // specified flags. - // Returns the item or -1 if unsuccessful. - long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE) const ; - - // Implementation: converts wxWindows style to OS2 style. - // Can be a single style flag or a bit list. - // oldStyle is 'normalised' so that it doesn't contain - // conflicting styles. - long ConvertToOS2Style(long& oldStyle, long style) const; - - // Gets one of the three image lists - wxImageList *GetImageList(int which) const ; - - // Sets the image list - // N.B. There's a quirk in the Win95 list view implementation. - // If in wxLC_LIST mode, it'll *still* display images by the labels if - // there's a small-icon image list set for the control - even though you - // haven't specified wxLIST_MASK_IMAGE when inserting. - // So you have to set a NULL small-icon image list to be sure that - // the wxLC_LIST mode works without icons. Of course, you may want icons... - void SetImageList(wxImageList *imageList, int which) ; - - // Operations - //////////////////////////////////////////////////////////////////////////// - - // Arranges the items - bool Arrange(int flag = wxLIST_ALIGN_DEFAULT); - - // Deletes an item - bool DeleteItem(long item); - - // Deletes all items - bool DeleteAllItems() ; - - // Deletes a column - bool DeleteColumn(int col); - - // Deletes all columns - bool DeleteAllColumns(); - - // Clears items, and columns if there are any. - void ClearAll(); - - // Edit the label - wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl)); - - // End label editing, optionally cancelling the edit - bool EndEditLabel(bool cancel); - - // Ensures this item is visible - bool EnsureVisible(long item) ; - - // Find an item whose label matches this string, starting from the item after 'start' - // or the beginning if 'start' is -1. - long FindItem(long start, const wxString& str, bool partial = FALSE); - - // Find an item whose data matches this data, starting from the item after 'start' - // or the beginning if 'start' is -1. - long FindItem(long start, long data); - - // Find an item nearest this position in the specified direction, starting from - // the item after 'start' or the beginning if 'start' is -1. - long FindItem(long start, const wxPoint& pt, int direction); - - // Determines which item (if any) is at the specified point, - // giving details in 'flags' (see wxLIST_HITTEST_... flags above) - long HitTest(const wxPoint& point, int& flags); - - // Inserts an item, returning the index of the new item if successful, - // -1 otherwise. - // TOD: Should also have some further convenience functions - // which don't require setting a wxListItem object - long InsertItem(wxListItem& info); - - // Insert a string item - long InsertItem(long index, const wxString& label); - - // Insert an image item - long InsertItem(long index, int imageIndex); - - // Insert an image/string item - long InsertItem(long index, const wxString& label, int imageIndex); - - // For list view mode (only), inserts a column. - long InsertColumn(long col, wxListItem& info); - - long InsertColumn(long col, const wxString& heading, int format = wxLIST_FORMAT_LEFT, - int width = -1); - - // 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 ScrollList(int dx, int dy); - - // 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 SortItems(wxListCtrlCompare fn, long data); - - // IMPLEMENTATION - virtual bool OS2Command(WXUINT param, WXWORD id); - virtual bool OS2OnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - - // bring the control in sync with current m_windowStyle value - void UpdateStyle(); - - // Add to pool: necessary because Windows needs to have a string - // still exist across 3 callbacks. - wxChar *AddPool(const wxString& str); - -protected: - wxTextCtrl* m_textCtrl; // The control used for editing a label - wxImageList * m_imageListNormal; // The image list for normal icons - wxImageList * m_imageListSmall; // The image list for small icons - wxImageList * m_imageListState; // The image list state icons (not implemented yet) - - long m_baseStyle; // Basic Windows style flags, for recreation purposes - wxStringList m_stringPool; // Pool of 3 strings to satisfy Windows callback - // requirements - int m_colCount; // Windows doesn't have GetColumnCount so must - // keep track of inserted/deleted columns - -private: - bool DoCreateControl(int x, int y, int w, int h); -}; - -#endif - // _WX_LISTCTRL_H_ diff --git a/include/wx/os2/statline.h b/include/wx/os2/statline.h index 0b4b2d8341..ccab4479ed 100644 --- a/include/wx/os2/statline.h +++ b/include/wx/os2/statline.h @@ -8,8 +8,8 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifndef _WX_MSW_STATLINE_H_ -#define _WX_MSW_STATLINE_H_ +#ifndef _WX_OS2_STATLINE_H_ +#define _WX_OS2_STATLINE_H_ #ifdef __GNUG__ #pragma interface @@ -45,6 +45,6 @@ public: const wxString &name = wxStaticTextNameStr ); }; -#endif // _WX_MSW_STATLINE_H_ +#endif // _WX_OS2_STATLINE_H_ diff --git a/include/wx/os2/statusbr.h b/include/wx/os2/statusbr.h deleted file mode 100644 index 3e8b21e705..0000000000 --- a/include/wx/os2/statusbr.h +++ /dev/null @@ -1,48 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: statusbr.h -// Purpose: native implementation of wxStatusBar. Optional; can use generic -// version instead. -// Author: David Webster -// Modified by: -// Created: 10/17/99 -// RCS-ID: $Id$ -// Copyright: (c) David Webster -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STATBAR_H_ -#define _WX_STATBAR_H_ - -class WXDLLEXPORT wxStatusBarPM : public wxStatusBar -{ - DECLARE_DYNAMIC_CLASS(wxStatusBarPM); - -public: - // ctors - wxStatusBarPM(); - wxStatusBarPM(wxWindow *parent, wxWindowID id = -1, long style = wxST_SIZEGRIP); - - // create status line - bool Create(wxWindow *parent, wxWindowID id = -1, long style = wxST_SIZEGRIP); - - // a status line can have several (<256) fields numbered from 0 - virtual void SetFieldsCount(int number = 1, const int widths[] = NULL); - - // each field of status line has its own text - virtual void SetStatusText(const wxString& text, int number = 0); - virtual wxString GetStatusText(int number = 0) const; - - // set status line fields' widths - virtual void SetStatusWidths(int n, const int widths_field[]); - - void OnSize(wxSizeEvent& event); - - DECLARE_EVENT_TABLE() - -protected: - void CopyFieldsWidth(const int widths[]); - void SetFieldsWidth(); -}; - -#endif // _WX_STATBAR_H_ - diff --git a/include/wx/os2/treectrl.h b/include/wx/os2/treectrl.h deleted file mode 100644 index 03a386c715..0000000000 --- a/include/wx/os2/treectrl.h +++ /dev/null @@ -1,497 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: treectrl.h -// Purpose: wxTreeCtrl class -// Author: David Webster -// Modified by: -// Created: 10/17/99 -// RCS-ID: $Id$ -// Copyright: (c) David Webster -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TREECTRL_H_ -#define _WX_TREECTRL_H_ - -#include "wx/textctrl.h" -#include "wx/dynarray.h" - -// the type for "untyped" data -typedef long wxDataType; - -// fwd decl -class WXDLLEXPORT wxImageList; -struct WXDLLEXPORT wxTreeViewItem; - -// a callback function used for sorting tree items, it should return -1 if the -// first item precedes the second, +1 if the second precedes the first or 0 if -// they're equivalent -class wxTreeItemData; - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// values for the `flags' parameter of wxTreeCtrl::HitTest() which determine -// where exactly the specified point is situated: - // above the client area. -static const int wxTREE_HITTEST_ABOVE = 0x0001; - // below the client area. -static const int wxTREE_HITTEST_BELOW = 0x0002; - // in the client area but below the last item. -static const int wxTREE_HITTEST_NOWHERE = 0x0004; - // on the button associated with an item. -static const int wxTREE_HITTEST_ONITEMBUTTON = 0x0010; - // on the bitmap associated with an item. -static const int wxTREE_HITTEST_ONITEMICON = 0x0020; - // in the indentation associated with an item. -static const int wxTREE_HITTEST_ONITEMINDENT = 0x0040; - // on the label (string) associated with an item. -static const int wxTREE_HITTEST_ONITEMLABEL = 0x0080; - // in the area to the right of an item. -static const int wxTREE_HITTEST_ONITEMRIGHT = 0x0100; - // on the state icon for a tree view item that is in a user-defined state. -static const int wxTREE_HITTEST_ONITEMSTATEICON = 0x0200; - // to the right of the client area. -static const int wxTREE_HITTEST_TOLEFT = 0x0400; - // to the left of the client area. -static const int wxTREE_HITTEST_TORIGHT = 0x0800; - // anywhere on the item -static const int wxTREE_HITTEST_ONITEM = wxTREE_HITTEST_ONITEMICON | - wxTREE_HITTEST_ONITEMLABEL | - wxTREE_HITTEST_ONITEMSTATEICON; - -// NB: all the following flags are for compatbility only and will be removed in the -// next versions - -// flags for deprecated `Expand(int action)' -enum -{ - wxTREE_EXPAND_EXPAND, - wxTREE_EXPAND_COLLAPSE, - wxTREE_EXPAND_COLLAPSE_RESET, - wxTREE_EXPAND_TOGGLE -}; - -// flags for deprecated InsertItem() variant -#define wxTREE_INSERT_FIRST 0xFFFF0001 -#define wxTREE_INSERT_LAST 0xFFFF0002 - -// ---------------------------------------------------------------------------- -// wxTreeItemId identifies an element of the tree. In this implementation, it's -// just a trivial wrapper around Win32 HTREEITEM. It's opaque for the -// application. -// ---------------------------------------------------------------------------- -class WXDLLEXPORT wxTreeItemId -{ -public: - // ctors - // 0 is invalid value for HTREEITEM - wxTreeItemId() { m_itemId = 0; } - - // default copy ctor/assignment operator are ok for us - - // accessors - // is this a valid tree item? - bool IsOk() const { return m_itemId != 0; } - - // conversion to/from either real (system-dependent) tree item id or - // to "long" which used to be the type for tree item ids in previous - // versions of wxWindows - - // for wxTreeCtrl usage only - wxTreeItemId(WXHTREEITEM itemId) { m_itemId = (long)itemId; } - operator WXHTREEITEM() const { return (WXHTREEITEM)m_itemId; } - - void operator=(WXHTREEITEM item) { m_itemId = (long) item; } - -protected: - long m_itemId; -}; - -WX_DEFINE_EXPORTED_ARRAY(wxTreeItemId, wxArrayTreeItemIds); - -// ---------------------------------------------------------------------------- -// wxTreeItemData is some (arbitrary) user class associated with some item. The -// main advantage of having this class (compared to old untyped interface) is -// that wxTreeItemData's are destroyed automatically by the tree and, as this -// class has virtual dtor, it means that the memory will be automatically -// freed. OTOH, we don't just use wxObject instead of wxTreeItemData because -// the size of this class is critical: in any real application, each tree leaf -// will have wxTreeItemData associated with it and number of leaves may be -// quite big. -// -// Because the objects of this class are deleted by the tree, they should -// always be allocated on the heap! -// ---------------------------------------------------------------------------- -class WXDLLEXPORT wxTreeItemData : private wxTreeItemId -{ -public: - // default ctor/copy ctor/assignment operator are ok - - // dtor is virtual and all the items are deleted by the tree control when - // it's deleted, so you normally don't have to care about freeing memory - // allocated in your wxTreeItemData-derived class - virtual ~wxTreeItemData() { } - - // accessors: set/get the item associated with this node - void SetId(const wxTreeItemId& id) { m_itemId = id; } - const wxTreeItemId GetId() const { return *this; } -}; - -// ---------------------------------------------------------------------------- -// wxTreeCtrl -// ---------------------------------------------------------------------------- -class WXDLLEXPORT wxTreeCtrl : public wxControl -{ -public: - // creation - // -------- - wxTreeCtrl() { Init(); } - - wxTreeCtrl(wxWindow *parent, wxWindowID id = -1, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = "wxTreeCtrl") - { - Create(parent, id, pos, size, style, validator, name); - } - - virtual ~wxTreeCtrl(); - - bool Create(wxWindow *parent, wxWindowID id = -1, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = "wxTreeCtrl"); - - // accessors - // --------- - - // get the total number of items in the control - size_t GetCount() const; - - // indent is the number of pixels the children are indented relative to - // the parents position. SetIndent() also redraws the control - // immediately. - unsigned int GetIndent() const; - void SetIndent(unsigned int indent); - - // spacing is the number of pixels between the start and the Text - // not implemented under wxMSW - unsigned int GetSpacing() const { return 18; } // return wxGTK default - void SetSpacing(unsigned int WXUNUSED(spacing)) { } - - // image list: these functions allow to associate an image list with - // the control and retrieve it. Note that the control does _not_ delete - // the associated image list when it's deleted in order to allow image - // lists to be shared between different controls. - // - // The normal image list is for the icons which correspond to the - // normal tree item state (whether it is selected or not). - // Additionally, the application might choose to show a state icon - // which corresponds to an app-defined item state (for example, - // checked/unchecked) which are taken from the state image list. - wxImageList *GetImageList() const; - wxImageList *GetStateImageList() const; - - void SetImageList(wxImageList *imageList); - void SetStateImageList(wxImageList *imageList); - - // Functions to work with tree ctrl items. Unfortunately, they can _not_ be - // member functions of wxTreeItem because they must know the tree the item - // belongs to for Windows implementation and storing the pointer to - // wxTreeCtrl in each wxTreeItem is just too much waste. - - // accessors - // --------- - - // retrieve items label - wxString GetItemText(const wxTreeItemId& item) const; - // get one of the images associated with the item (normal by default) - int GetItemImage(const wxTreeItemId& item, - wxTreeItemIcon which = wxTreeItemIcon_Normal) const; - // get the data associated with the item - wxTreeItemData *GetItemData(const wxTreeItemId& item) const; - - // modifiers - // --------- - - // set items label - void SetItemText(const wxTreeItemId& item, const wxString& text); - // get one of the images associated with the item (normal by default) - void SetItemImage(const wxTreeItemId& item, int image, - wxTreeItemIcon which = wxTreeItemIcon_Normal); - // associate some data with the item - void SetItemData(const wxTreeItemId& item, wxTreeItemData *data); - - // force appearance of [+] button near the item. This is useful to - // allow the user to expand the items which don't have any children now - // - but instead add them only when needed, thus minimizing memory - // usage and loading time. - void SetItemHasChildren(const wxTreeItemId& item, bool has = TRUE); - - // the item will be shown in bold - void SetItemBold(const wxTreeItemId& item, bool bold = TRUE); - - // the item will be shown with a drop highlight - void SetItemDropHighlight(const wxTreeItemId& item, bool highlight = TRUE); - - // item status inquiries - // --------------------- - - // is the item visible (it might be outside the view or not expanded)? - bool IsVisible(const wxTreeItemId& item) const; - // does the item has any children? - bool ItemHasChildren(const wxTreeItemId& item) const; - // is the item expanded (only makes sense if HasChildren())? - bool IsExpanded(const wxTreeItemId& item) const; - // is this item currently selected (the same as has focus)? - bool IsSelected(const wxTreeItemId& item) const; - // is item text in bold font? - bool IsBold(const wxTreeItemId& item) const; - - // number of children - // ------------------ - - // if 'recursively' is FALSE, only immediate children count, otherwise - // the returned number is the number of all items in this branch - size_t GetChildrenCount(const wxTreeItemId& item, - bool recursively = TRUE) const; - - // navigation - // ---------- - - // wxTreeItemId.IsOk() will return FALSE if there is no such item - - // get the root tree item - wxTreeItemId GetRootItem() const; - - // get the item currently selected (may return NULL if no selection) - wxTreeItemId GetSelection() const; - - // get the items currently selected, return the number of such item - // - // NB: this operation is expensive and can take a long time for a - // control with a lot of items (~ O(number of items)). - size_t GetSelections(wxArrayTreeItemIds& selections) const; - - // get the parent of this item (may return NULL if root) - wxTreeItemId GetParent(const wxTreeItemId& item) const; - - // for this enumeration function you must pass in a "cookie" parameter - // which is opaque for the application but is necessary for the library - // to make these functions reentrant (i.e. allow more than one - // enumeration on one and the same object simultaneously). Of course, - // the "cookie" passed to GetFirstChild() and GetNextChild() should be - // the same! - - // get the first child of this item - wxTreeItemId GetFirstChild(const wxTreeItemId& item, long& _cookie) const; - // get the next child - wxTreeItemId GetNextChild(const wxTreeItemId& item, long& _cookie) const; - // get the last child of this item - this method doesn't use cookies - wxTreeItemId GetLastChild(const wxTreeItemId& item) const; - - // get the next sibling of this item - wxTreeItemId GetNextSibling(const wxTreeItemId& item) const; - // get the previous sibling - wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const; - - // get first visible item - wxTreeItemId GetFirstVisibleItem() const; - // get the next visible item: item must be visible itself! - // see IsVisible() and wxTreeCtrl::GetFirstVisibleItem() - wxTreeItemId GetNextVisible(const wxTreeItemId& item) const; - // get the previous visible item: item must be visible itself! - wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const; - - // operations - // ---------- - - // add the root node to the tree - wxTreeItemId AddRoot(const wxString& text, - int image = -1, int selectedImage = -1, - wxTreeItemData *data = NULL); - - // insert a new item in as the first child of the parent - wxTreeItemId PrependItem(const wxTreeItemId& parent, - const wxString& text, - int image = -1, int selectedImage = -1, - wxTreeItemData *data = NULL); - - // insert a new item after a given one - wxTreeItemId InsertItem(const wxTreeItemId& parent, - const wxTreeItemId& idPrevious, - const wxString& text, - int image = -1, int selectedImage = -1, - wxTreeItemData *data = NULL); - - // insert a new item in as the last child of the parent - wxTreeItemId AppendItem(const wxTreeItemId& parent, - const wxString& text, - int image = -1, int selectedImage = -1, - wxTreeItemData *data = NULL); - - // delete this item and associated data if any - void Delete(const wxTreeItemId& item); - // delete all children (but don't delete the item itself) - // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events - void DeleteChildren(const wxTreeItemId& item); - // delete all items from the tree - // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events - void DeleteAllItems(); - - // expand this item - void Expand(const wxTreeItemId& item); - // collapse the item without removing its children - void Collapse(const wxTreeItemId& item); - // collapse the item and remove all children - void CollapseAndReset(const wxTreeItemId& item); - // toggles the current state - void Toggle(const wxTreeItemId& item); - - // remove the selection from currently selected item (if any) - void Unselect(); - // unselect all items (only makes sense for multiple selection control) - void UnselectAll(); - // select this item - void SelectItem(const wxTreeItemId& item); - // make sure this item is visible (expanding the parent item and/or - // scrolling to this item if necessary) - void EnsureVisible(const wxTreeItemId& item); - // scroll to this item (but don't expand its parent) - void ScrollTo(const wxTreeItemId& item); - - // start editing the item label: this (temporarily) replaces the item - // with a one line edit control. The item will be selected if it hadn't - // been before. textCtrlClass parameter allows you to create an edit - // control of arbitrary user-defined class deriving from wxTextCtrl. - wxTextCtrl* EditLabel(const wxTreeItemId& item, - wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl)); - // returns the same pointer as StartEdit() if the item is being edited, - // NULL otherwise (it's assumed that no more than one item may be - // edited simultaneously) - wxTextCtrl* GetEditControl() const; - // end editing and accept or discard the changes to item label - void EndEditLabel(const wxTreeItemId& item, bool discardChanges = FALSE); - - // sorting - // this function is called to compare 2 items and should return -1, 0 - // or +1 if the first item is less than, equal to or greater than the - // second one. The base class version performs alphabetic comparaison - // of item labels (GetText) - virtual int OnCompareItems(const wxTreeItemId& item1, - const wxTreeItemId& item2); - // sort the children of this item using OnCompareItems - // - // NB: this function is not reentrant and not MT-safe (FIXME)! - void SortChildren(const wxTreeItemId& item); - - // helpers - // ------- - - // determine to which item (if any) belongs the given point (the - // coordinates specified are relative to the client area of tree ctrl) - // and fill the flags parameter with a bitmask of wxTREE_HITTEST_xxx - // constants. - // - // The first function is more portable (because easier to implement - // on other platforms), but the second one returns some extra info. - wxTreeItemId HitTest(const wxPoint& point) - { int dummy; return HitTest(point, dummy); } - wxTreeItemId HitTest(const wxPoint& point, int& flags); - - // get the bounding rectangle of the item (or of its label only) - bool GetBoundingRect(const wxTreeItemId& item, - wxRect& rect, - bool textOnly = FALSE) const; - - // deprecated - // ---------- - - // these methods are deprecated and will be removed in future versions of - // wxWindows, they're here for compatibility only, don't use them in new - // code (the comments indicate why these methods are now useless and how to - // replace them) - - // use Expand, Collapse, CollapseAndReset or Toggle - void ExpandItem(const wxTreeItemId& item, int action); - - // use AddRoot, PrependItem or AppendItem - wxTreeItemId InsertItem(const wxTreeItemId& parent, - const wxString& text, - int image = -1, int selImage = -1, - long insertAfter = wxTREE_INSERT_LAST); - - // use Set/GetImageList and Set/GetStateImageList - wxImageList *GetImageList(int) const - { return GetImageList(); } - void SetImageList(wxImageList *imageList, int) - { SetImageList(imageList); } - - // use Set/GetItemImage directly - // get the selected item image - int GetItemSelectedImage(const wxTreeItemId& item) const - { return GetItemImage(item, wxTreeItemIcon_Selected); } - // set the selected item image - void SetItemSelectedImage(const wxTreeItemId& item, int image) - { SetItemImage(item, image, wxTreeItemIcon_Selected); } - - // implementation - // -------------- - virtual bool OS2Command(WXUINT param, WXWORD id); - virtual bool OS2OnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); - - // get/set the check state for the item (only for wxTR_MULTIPLE) - bool IsItemChecked(const wxTreeItemId& item) const; - void SetItemCheck(const wxTreeItemId& item, bool check = TRUE); - -protected: - // SetImageList helper - void SetAnyImageList(wxImageList *imageList, int which); - - wxTextCtrl *m_textCtrl; // used while editing the item label - wxImageList *m_imageListNormal, // images for tree elements - *m_imageListState; // special images for app defined states - -private: - // the common part of all ctors - void Init(); - - // helper functions - inline bool DoGetItem(wxTreeViewItem *tvItem) const; - inline void DoSetItem(wxTreeViewItem *tvItem); - - inline void DoExpand(const wxTreeItemId& item, int flag); - - wxTreeItemId DoInsertItem(const wxTreeItemId& parent, - wxTreeItemId hInsertAfter, - const wxString& text, - int image, int selectedImage, - wxTreeItemData *data); - - int DoGetItemImageFromData(const wxTreeItemId& item, - wxTreeItemIcon which) const; - void DoSetItemImageFromData(const wxTreeItemId& item, - int image, - wxTreeItemIcon which) const; - void DoSetItemImages(const wxTreeItemId& item, int image, int imageSel); - - void DeleteTextCtrl(); - - // support for additional item images - friend class wxTreeItemIndirectData; - void SetIndirectItemData(const wxTreeItemId& item, - wxTreeItemIndirectData *data); - bool HasIndirectData(const wxTreeItemId& item) const; - - wxArrayTreeItemIds m_itemsWithIndirectData; - - DECLARE_DYNAMIC_CLASS(wxTreeCtrl) -}; - -#endif - // _WX_TREECTRL_H_ diff --git a/include/wx/propform.h b/include/wx/propform.h index 42ae9e863d..120b0a1bf2 100644 --- a/include/wx/propform.h +++ b/include/wx/propform.h @@ -89,7 +89,7 @@ public: wxWindow* m_propertyWindow; // Panel that the controls will appear on wxWindow* m_managedWindow; // Frame or dialog - + wxButton* m_windowCloseButton; // Or OK wxButton* m_windowCancelButton; wxButton* m_windowHelpButton; @@ -97,7 +97,7 @@ public: DECLARE_EVENT_TABLE() }; - + /* * The type of validator used for forms (wxForm style but using an existing panel * or dialog box). @@ -120,10 +120,10 @@ class WXDLLEXPORT wxPropertyFormValidator: public wxPropertyValidator public: wxPropertyFormValidator(long flags = 0): wxPropertyValidator(flags) { } ~wxPropertyFormValidator(void) {} - + // Called to check value is OK (e.g. when OK is pressed) // Return FALSE if value didn't check out; signal to restore old value. - virtual bool OnCheckValue( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view), + virtual bool OnCheckValue( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) ) { return TRUE; } // Does the transferance from the property editing area to the property itself. @@ -133,20 +133,27 @@ class WXDLLEXPORT wxPropertyFormValidator: public wxPropertyValidator // Called by the view to transfer the property to the window. virtual bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) = 0; - virtual void OnDoubleClick( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view), - wxWindow *WXUNUSED(parentWindow) ) { } - virtual void OnSetFocus( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view), + virtual void OnDoubleClick( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) ) { } - virtual void OnKillFocus( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view), + virtual void OnSetFocus( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) ) { } - virtual void OnCommand( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view), + virtual void OnKillFocus( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view), + wxWindow *WXUNUSED(parentWindow) ) { } + virtual void OnCommand( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow), wxCommandEvent& WXUNUSED(event) ) {} +private: +// Virtual function hiding suppression +#if WXWIN_COMPATIBILITY_2 + virtual void OnCommand(wxWindow& win, + wxCommandEvent& event) + { wxEvtHandler::OnCommand(win, event); } +#endif }; /* * Some default validators */ - + class WXDLLEXPORT wxRealFormValidator: public wxPropertyFormValidator { DECLARE_DYNAMIC_CLASS(wxRealFormValidator) @@ -226,7 +233,7 @@ class WXDLLEXPORT wxStringFormValidator: public wxPropertyFormValidator /* * A default dialog box class to use. */ - + class WXDLLEXPORT wxPropertyFormDialog: public wxDialog { DECLARE_CLASS(wxPropertyFormDialog) @@ -251,7 +258,7 @@ DECLARE_EVENT_TABLE() /* * A default panel class to use. */ - + class WXDLLEXPORT wxPropertyFormPanel: public wxPanel { DECLARE_CLASS(wxPropertyFormPanel) @@ -275,7 +282,7 @@ class WXDLLEXPORT wxPropertyFormPanel: public wxPanel /* * A default frame class to use. */ - + class WXDLLEXPORT wxPropertyFormFrame: public wxFrame { DECLARE_CLASS(wxPropertyFormFrame) diff --git a/include/wx/treectrl.h b/include/wx/treectrl.h index 33dbe7a126..ac3cee2263 100644 --- a/include/wx/treectrl.h +++ b/include/wx/treectrl.h @@ -48,7 +48,7 @@ enum wxTreeItemIcon #elif defined(__WXMAC__) #include "wx/generic/treectrl.h" #elif defined(__WXPM__) - #include "wx/os2/treectrl.h" + #include "wx/generic/treectrl.h" #elif defined(__WXSTUBS__) #include "wx/generic/treectrl.h" #endif diff --git a/src/os2/choice.cpp b/src/os2/choice.cpp index 7448ef7e50..fc8428ffe5 100644 --- a/src/os2/choice.cpp +++ b/src/os2/choice.cpp @@ -190,13 +190,12 @@ void* wxChoice::DoGetItemClientData( int n ) const void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData ) { - DoSetClientData(n, clientData); + DoSetItemClientData(n, clientData); } wxClientData* wxChoice::DoGetItemClientObject( int n ) const { - // TODO: return (wxClientData *)DoGetClientData(n); - return NULL; + return (wxClientData *)DoGetItemClientData(n); } // ---------------------------------------------------------------------------- diff --git a/src/os2/dataobj.cpp b/src/os2/dataobj.cpp index 80c9b8479c..98031a0a75 100644 --- a/src/os2/dataobj.cpp +++ b/src/os2/dataobj.cpp @@ -31,6 +31,8 @@ #include "wx/log.h" #include "wx/dataobj.h" +#include "wx/mstream.h" +#include "wx/image.h" #define INCL_DOS #include @@ -47,11 +49,8 @@ // wxDataFormat // ---------------------------------------------------------------------------- -wxDataFormat::wxDataFormat( - wxDataFormatId vType -) +wxDataFormat::wxDataFormat() { - PrepareFormats(); m_vType = wxDF_INVALID; m_vFormat = 0; } @@ -184,7 +183,7 @@ bool wxDataObject::IsSupportedFormat( else { wxDataFormat* pFormats = new wxDataFormat[nFormatCount]; - GetAllFormats( rFormats + GetAllFormats( pFormats ,vDir ); @@ -192,11 +191,11 @@ bool wxDataObject::IsSupportedFormat( for (n = 0; n < nFormatCount; n++) { - if (rFormats[n] == rFormat) + if (pFormats[n] == rFormat) break; } - delete [] rFormats; + delete [] pFormats; // found? return n < nFormatCount; @@ -215,11 +214,11 @@ bool wxFileDataObject::GetDataHere( for (size_t i = 0; i < m_filenames.GetCount(); i++) { - filenames += m_filenames[i]; - filenames += (wxChar)0; + sFilenames += m_filenames[i]; + sFilenames += (wxChar)0; } - memcpy(pBuf, filenames.mbc_str(), filenames.Len() + 1); + memcpy(pBuf, sFilenames.mbc_str(), sFilenames.Len() + 1); return TRUE; } @@ -336,12 +335,13 @@ void wxBitmapDataObject::DoConvertToPng() wxPNGHandler vHandler; wxCountingOutputStream vCount; - vHandler.SaveFile(&rImage, vCount); + vHandler.SaveFile(&vImage, vCount); m_pngSize = vCount.GetSize() + 100; // sometimes the size seems to vary ??? m_pngData = malloc(m_pngSize); - wxMemoryOutputStream mstream((char*) m_pngData, m_pngSize); + wxMemoryOutputStream vMstream((char*) m_pngData, m_pngSize); + vHandler.SaveFile(&vImage, vMstream ); } diff --git a/src/os2/dnd.cpp b/src/os2/dnd.cpp index 5674c3659c..6a54e5a39c 100644 --- a/src/os2/dnd.cpp +++ b/src/os2/dnd.cpp @@ -13,10 +13,12 @@ #pragma implementation "dnd.h" #endif -#include "wx/dnd.h" +#define INCL_PM +#include #include "wx/window.h" #include "wx/app.h" #include "wx/gdicmn.h" +#include "wx/dnd.h" // ---------------------------------------------------------------------------- // global diff --git a/src/os2/frame.cpp b/src/os2/frame.cpp index 25ff00e438..47169e8359 100644 --- a/src/os2/frame.cpp +++ b/src/os2/frame.cpp @@ -683,7 +683,7 @@ wxPoint wxFrame::GetClientAreaOrigin() const return pt; } -void wxFrame::ScreenToClient(int *x, int *y) const +void wxFrame::DoScreenToClient(int *x, int *y) const { wxWindow::ScreenToClient(x, y); @@ -695,7 +695,7 @@ void wxFrame::ScreenToClient(int *x, int *y) const *y -= pt.y; } -void wxFrame::ClientToScreen(int *x, int *y) const +void wxFrame::DoClientToScreen(int *x, int *y) const { // We may be faking the client origin. // So a window that's really at (0, 30) may appear @@ -704,7 +704,7 @@ void wxFrame::ClientToScreen(int *x, int *y) const *x += pt1.x; *y += pt1.y; - wxWindow::ClientToScreen(x, y); + wxWindow::DoClientToScreen(x, y); } #if wxUSE_TOOLBAR diff --git a/src/os2/gauge.cpp b/src/os2/gauge.cpp index 54d06fa5ae..00ab8236bf 100644 --- a/src/os2/gauge.cpp +++ b/src/os2/gauge.cpp @@ -46,7 +46,7 @@ #define ZYZGS_3D 0x8000L /* control will be 3D */ /* public function prototypes */ -BOOL _Optlink gaugeInit(HINSTANCE hInstance); +// BOOL _Optlink gaugeInit(HINSTANCE hInstance); #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl) @@ -64,8 +64,11 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id, if ( !wxGaugeOS2Initialised ) { +//TODO: +/* if (!gaugeInit((HINSTANCE) wxGetInstance())) wxFatalError("Cannot initalize Gauge library"); +*/ wxGaugeOS2Initialised = TRUE; } diff --git a/src/os2/imaglist.cpp b/src/os2/imaglist.cpp deleted file mode 100644 index a74bfc923b..0000000000 --- a/src/os2/imaglist.cpp +++ /dev/null @@ -1,192 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: imaglist.cpp -// Purpose: wxImageList. You may wish to use the generic version. -// Author: David Webster -// Modified by: -// Created: 10/09/99 -// RCS-ID: $Id$ -// Copyright: (c) David Webster -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifndef WX_PRECOMP -#include -#include "wx/setup.h" -#include "wx/window.h" -#include "wx/icon.h" -#include "wx/dc.h" -#include "wx/string.h" -#endif - -#include "wx/log.h" -#include "wx/intl.h" - -#include "wx/os2/imaglist.h" -#include "wx/os2/private.h" - -#if !USE_SHARED_LIBRARY -IMPLEMENT_DYNAMIC_CLASS(wxImageList, wxObject) -#endif - -wxImageList::wxImageList() -{ - m_hImageList = 0; -} - -wxImageList::~wxImageList() -{ - if ( m_hImageList ) - return; -// TODO: ImageList_Destroy((HIMAGELIST) m_hImageList); - m_hImageList = 0; -} - -// Attributes -//////////////////////////////////////////////////////////////////////////// - -// Returns the number of images in the image list. -int wxImageList::GetImageCount() const -{ - // TODO:: return ImageList_GetImageCount((HIMAGELIST) m_hImageList); - return 0; -} - -// Operations -//////////////////////////////////////////////////////////////////////////// - -// Creates an image list -bool wxImageList::Create(int width, int height, bool mask, int initial) -{ - UINT flags = 0; -// if ( mask ) - // TODO flags |= ILC_MASK; - - // Grow by 1, I guess this is reasonable behaviour most of the time - // m_hImageList = (WXHIMAGELIST) ImageList_Create(width, height, flags, initial, 1); - return (m_hImageList != 0); -} - -// 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) -{ - HBITMAP hBitmap1 = (HBITMAP) bitmap.GetHBITMAP(); - HBITMAP hBitmap2 = 0; - if ( mask.Ok() ) - hBitmap2 = (HBITMAP) mask.GetHBITMAP(); - - int index; // = ImageList_Add((HIMAGELIST) GetHIMAGELIST(), hBitmap1, hBitmap2); - if ( index == -1 ) - { - wxLogError(wxT("Couldn't add an image to the image list.")); - } - return index; -} - -// 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) -{ - HBITMAP hBitmap1 = (HBITMAP) bitmap.GetHBITMAP(); - //TODO: -// COLORREF colorRef = PALETTERGB(maskColour.Red(), maskColour.Green(), maskColour.Blue()); -// return ImageList_AddMasked((HIMAGELIST) GetHIMAGELIST(), hBitmap1, colorRef); - return 0; -} - -// Adds a bitmap and mask from an icon. -int wxImageList::Add(const wxIcon& icon) -{ - HICON hIcon = (HICON) icon.GetHICON(); -// TODO: return ImageList_AddIcon((HIMAGELIST) GetHIMAGELIST(), hIcon); - 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) -{ - HBITMAP hBitmap1 = (HBITMAP) bitmap.GetHBITMAP(); - HBITMAP hBitmap2 = 0; - if ( mask.Ok() ) - hBitmap2 = (HBITMAP) mask.GetHBITMAP(); - // TODO: return (ImageList_Replace((HIMAGELIST) GetHIMAGELIST(), index, hBitmap1, hBitmap2) != 0); - return TRUE; -} - -// Replaces a bitmap and mask from an icon. -bool wxImageList::Replace(int index, const wxIcon& icon) -{ - HICON hIcon = (HICON) icon.GetHICON(); - // TODO: return (ImageList_ReplaceIcon((HIMAGELIST) GetHIMAGELIST(), index, hIcon) != 0); - return FALSE; -} - -// Removes the image at the given index. -bool wxImageList::Remove(int index) -{ - // TODO return (ImageList_Remove((HIMAGELIST) GetHIMAGELIST(), index) != 0); - - return FALSE; -} - -bool wxImageList::RemoveAll(void) -{ - // TODO: Is this correct? - while ( GetImageCount() > 0 ) - { - Remove(0); - } - return TRUE; -} - -// 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) -{ - HDC hDC = (HDC) dc.GetHDC(); - if ( !hDC ) - return FALSE; - - if ( solidBackground ) - { - wxBrush *brush = & dc.GetBackground(); - if ( brush && brush->Ok()) - { - wxColour col(brush->GetColour()); -// ImageList_SetBkColor((HIMAGELIST) GetHIMAGELIST(), -// PALETTERGB(col.Red(), col.Green(), col.Blue())); - } -// else -// ImageList_SetBkColor((HIMAGELIST) GetHIMAGELIST(), -// CLR_NONE); - } -// else -// ImageList_SetBkColor((HIMAGELIST) GetHIMAGELIST(), -// CLR_NONE); - - UINT style = 0; -/* - if ( flags & wxIMAGELIST_DRAW_NORMAL ) - style |= ILD_NORMAL; - if ( flags & wxIMAGELIST_DRAW_TRANSPARENT ) - style |= ILD_TRANSPARENT; - if ( flags & wxIMAGELIST_DRAW_SELECTED ) - style |= ILD_SELECTED; - if ( flags & wxIMAGELIST_DRAW_FOCUSED ) - style |= ILD_FOCUS; - return (ImageList_Draw((HIMAGELIST) GetHIMAGELIST(), index, hDC, - x, y, style) != 0); -*/ - return TRUE; -} - diff --git a/src/os2/listbox.cpp b/src/os2/listbox.cpp index a6909e537f..76ab92fbe8 100644 --- a/src/os2/listbox.cpp +++ b/src/os2/listbox.cpp @@ -701,7 +701,7 @@ WXHBRUSH wxListBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, backgroundBrush->RealizeResource(); return (WXHBRUSH) backgroundBrush->GetResourceHandle(); */ - reutrn (WXBRUSH)0; + return (WXHBRUSH)0; } // ---------------------------------------------------------------------------- diff --git a/src/os2/listctrl.cpp b/src/os2/listctrl.cpp deleted file mode 100644 index 7d8aa47552..0000000000 --- a/src/os2/listctrl.cpp +++ /dev/null @@ -1,1190 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: listctrl.cpp -// Purpose: wxListCtrl. See also Robert's generic wxListCtrl -// Author: David Webster -// Modified by: -// Created: 10/10/99 -// RCS-ID: $Id$ -// Copyright: (c) David Webster -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifndef WX_PRECOMP - #include "wx/wx.h" -#endif - -#include "wx/listctrl.h" -#include "wx/log.h" - -#include "wx/os2/private.h" - -// TODO: not sure if we will need these -/* -static void wxConvertToOS2ListItem(const wxListCtrl *ctrl, wxListItem& info, LV_ITEM& tvItem); -static void wxConvertFromOS2ListItem(const wxListCtrl *ctrl, wxListItem& info, LV_ITEM& tvItem, HWND getFullInfo = 0); -*/ - -#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; - m_textCtrl = NULL; -} - -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); - - int x = pos.x; - int y = pos.y; - int width = size.x; - int height = size.y; - - m_windowStyle = style; - - SetParent(parent); - - m_windowId = (id == -1) ? NewControlId() : id; - - if (parent) parent->AddChild(this); - - // TODO create list control -// DWORD wstyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP | -// LVS_SHAREIMAGELISTS | LVS_SHOWSELALWAYS; -// if ( wxStyleHasBorder(m_windowStyle) ) -// wstyle |= WS_BORDER; -// m_baseStyle = wstyle; -// -// if ( !DoCreateControl(x, y, width, height) ) -// return FALSE; -// -// if (parent) -// parent->AddChild(this); - return TRUE; -} - -bool wxListCtrl::DoCreateControl(int x, int y, int w, int h) -{ - DWORD wstyle = m_baseStyle; - - bool want3D; -// TODO -// WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D); - - // Even with extended styles, need to combine with WS_BORDER - // for them to look right. -// if ( want3D ) -// wstyle |= WS_BORDER; - -// long oldStyle = 0; // Dummy -// wstyle |= ConvertToMSWStyle(oldStyle, m_windowStyle); - - // Create the ListView control. -// m_hWnd = (WXHWND)CreateWindowEx(exStyle, -// WC_LISTVIEW, -// wxT(""), -// wstyle, -// x, y, w, h, -// GetWinHwnd(GetParent()), -// (HMENU)m_windowId, -// wxGetInstance(), -// NULL); - -// if ( !m_hWnd ) -// { -// wxLogError(wxT("Can't create list control window.")); -// -// return FALSE; -// } - - // for comctl32.dll v 4.70+ we want to have this attribute because it's - // prettier (and also because wxGTK does it like this) -#ifdef ListView_SetExtendedListViewStyle -// if ( wstyle & LVS_REPORT ) -// { -// ListView_SetExtendedListViewStyle(GetHwnd(), -// LVS_EX_FULLROWSELECT); -// } -#endif // ListView_SetExtendedListViewStyle - - SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW)); - SetForegroundColour(GetParent()->GetForegroundColour()); - -// SubclassWin(m_hWnd); - - return TRUE; -} - -void wxListCtrl::UpdateStyle() -{ -/* - if ( GetHWND() ) - { - // The new window view style - long dummy; - DWORD dwStyleNew = ConvertToMSWStyle(dummy, m_windowStyle); - dwStyleNew |= m_baseStyle; - - // Get the current window style. - DWORD dwStyleOld = ::GetWindowLong(GetHwnd(), GWL_STYLE); - - // Only set the window style if the view bits have changed. - if ( dwStyleOld != dwStyleNew ) - { - ::SetWindowLong(GetHwnd(), GWL_STYLE, dwStyleNew); - } - } -*/ -} -wxListCtrl::~wxListCtrl() -{ - if (m_textCtrl) - { - m_textCtrl->UnsubclassWin(); - m_textCtrl->SetHWND(0); - delete m_textCtrl; - m_textCtrl = NULL; - } -} - -// 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; - - UpdateStyle(); -} - -// Set the whole window style -void wxListCtrl::SetWindowStyleFlag(long flag) -{ - m_windowStyle = flag; - - UpdateStyle(); -} - -// Can be just a single style, or a bitlist -long wxListCtrl::ConvertToOS2Style(long& oldStyle, long style) const -{ - long wstyle = 0; -/* - if ( style & wxLC_ICON ) - { - if ( (oldStyle & LVS_TYPEMASK) == LVS_SMALLICON ) - oldStyle -= LVS_SMALLICON; - if ( (oldStyle & LVS_TYPEMASK) == LVS_REPORT ) - oldStyle -= LVS_REPORT; - if ( (oldStyle & LVS_TYPEMASK) == LVS_LIST ) - oldStyle -= LVS_LIST; - wstyle |= LVS_ICON; - } - - if ( style & wxLC_SMALL_ICON ) - { - if ( (oldStyle & LVS_TYPEMASK) == LVS_ICON ) - oldStyle -= LVS_ICON; - if ( (oldStyle & LVS_TYPEMASK) == LVS_REPORT ) - oldStyle -= LVS_REPORT; - if ( (oldStyle & LVS_TYPEMASK) == LVS_LIST ) - oldStyle -= LVS_LIST; - wstyle |= LVS_SMALLICON; - } - - if ( style & wxLC_LIST ) - { - if ( (oldStyle & LVS_TYPEMASK) == LVS_ICON ) - oldStyle -= LVS_ICON; - if ( (oldStyle & LVS_TYPEMASK) == LVS_REPORT ) - oldStyle -= LVS_REPORT; - if ( (oldStyle & LVS_TYPEMASK) == LVS_SMALLICON ) - oldStyle -= LVS_SMALLICON; - wstyle |= LVS_LIST; - } - - if ( style & wxLC_REPORT ) - { - if ( (oldStyle & LVS_TYPEMASK) == LVS_ICON ) - oldStyle -= LVS_ICON; - if ( (oldStyle & LVS_TYPEMASK) == LVS_LIST ) - oldStyle -= LVS_LIST; - if ( (oldStyle & LVS_TYPEMASK) == LVS_SMALLICON ) - oldStyle -= LVS_SMALLICON; - - wstyle |= LVS_REPORT; - } - - if ( style & wxLC_ALIGN_LEFT ) - { - if ( oldStyle & LVS_ALIGNTOP ) - oldStyle -= LVS_ALIGNTOP; - wstyle |= LVS_ALIGNLEFT; - } - - if ( style & wxLC_ALIGN_TOP ) - { - if ( oldStyle & LVS_ALIGNLEFT ) - oldStyle -= LVS_ALIGNLEFT; - wstyle |= LVS_ALIGNTOP; - } - - if ( style & wxLC_AUTOARRANGE ) - wstyle |= LVS_AUTOARRANGE; - - // Apparently, no such style (documentation wrong?) - // if ( style & wxLC_BUTTON ) - // wstyle |= LVS_BUTTON; - - if ( style & wxLC_NO_SORT_HEADER ) - wstyle |= LVS_NOSORTHEADER; - - if ( style & wxLC_NO_HEADER ) - wstyle |= LVS_NOCOLUMNHEADER; - - if ( style & wxLC_EDIT_LABELS ) - wstyle |= LVS_EDITLABELS; - - if ( style & wxLC_SINGLE_SEL ) - wstyle |= LVS_SINGLESEL; - - if ( style & wxLC_SORT_ASCENDING ) - { - if ( oldStyle & LVS_SORTDESCENDING ) - oldStyle -= LVS_SORTDESCENDING; - wstyle |= LVS_SORTASCENDING; - } - - if ( style & wxLC_SORT_DESCENDING ) - { - if ( oldStyle & LVS_SORTASCENDING ) - oldStyle -= LVS_SORTASCENDING; - wstyle |= LVS_SORTDESCENDING; - } -*/ - return wstyle; -} - -// Sets the background colour (GetBackgroundColour already implicit in -// wxWindow class) -bool wxListCtrl::SetBackgroundColour(const wxColour& col) -{ - if ( !wxWindow::SetBackgroundColour(col) ) - return FALSE; - -// ListView_SetBkColor(GetHwnd(), PALETTERGB(col.Red(), col.Green(), col.Blue())); - - return TRUE; -} - -// 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; -} - -bool wxListCtrl::OS2Command(WXUINT cmd, WXWORD id) -{ -/* - if (cmd == EN_UPDATE) - { - wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, id); - event.SetEventObject( this ); - ProcessCommand(event); - return TRUE; - } - else if (cmd == EN_KILLFOCUS) - { - wxCommandEvent event(wxEVT_KILL_FOCUS, id); - event.SetEventObject( this ); - ProcessCommand(event); - return TRUE; - } - else - return FALSE; -*/ - return FALSE; -} - -bool wxListCtrl::OS2OnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) -{ - // TODO -/* - wxListEvent event(wxEVT_NULL, m_windowId); - wxEventType eventType = wxEVT_NULL; - NMHDR *hdr1 = (NMHDR *) lParam; - switch ( hdr1->code ) - { - case LVN_BEGINRDRAG: - eventType = wxEVT_COMMAND_LIST_BEGIN_RDRAG; - // fall through - - case LVN_BEGINDRAG: - if ( eventType == wxEVT_NULL ) - { - eventType = wxEVT_COMMAND_LIST_BEGIN_DRAG; - } - - { - NM_LISTVIEW *hdr = (NM_LISTVIEW *)lParam; - event.m_itemIndex = hdr->iItem; - event.m_pointDrag.x = hdr->ptAction.x; - event.m_pointDrag.y = hdr->ptAction.y; - } - break; - - case LVN_BEGINLABELEDIT: - { - eventType = wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT; - LV_DISPINFO *info = (LV_DISPINFO *)lParam; - wxConvertFromMSWListItem(this, event.m_item, info->item, GetHwnd()); - break; - } - - case LVN_COLUMNCLICK: - { - eventType = wxEVT_COMMAND_LIST_COL_CLICK; - NM_LISTVIEW* hdr = (NM_LISTVIEW*)lParam; - event.m_itemIndex = -1; - event.m_col = hdr->iSubItem; - break; - } - - case LVN_DELETEALLITEMS: - // what's the sense of generating a wxWin event for this when - // it's absolutely not portable? -#if 0 - eventType = wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS; - event.m_itemIndex = -1; -#endif // 0 - - // return TRUE to suppress all additional LVN_DELETEITEM - // notifications - this makes deleting all items from a list ctrl - // much faster - *result = TRUE; - return TRUE; - - case LVN_DELETEITEM: - { - eventType = wxEVT_COMMAND_LIST_DELETE_ITEM; - NM_LISTVIEW* hdr = (NM_LISTVIEW*)lParam; - event.m_itemIndex = hdr->iItem; - break; - } - case LVN_ENDLABELEDIT: - { - eventType = wxEVT_COMMAND_LIST_END_LABEL_EDIT; - LV_DISPINFO *info = (LV_DISPINFO *)lParam; - wxConvertFromMSWListItem(this, event.m_item, info->item, GetHwnd()); - if ( info->item.pszText == NULL || info->item.iItem == -1 ) - event.m_cancelled = TRUE; - break; - } - case LVN_GETDISPINFO: - return FALSE; - - // this provokes stack overflow: indeed, wxConvertFromMSWListItem() - // sends us WM_NOTIFY! As it doesn't do anything for now, just leave - // it out. -#if 0 - { - // TODO: some text buffering here, I think - // TODO: API for getting Windows to retrieve values - // on demand. - eventType = wxEVT_COMMAND_LIST_GET_INFO; - LV_DISPINFO *info = (LV_DISPINFO *)lParam; - wxConvertFromMSWListItem(this, event.m_item, info->item, GetHwnd()); - break; - } -#endif // 0 - - case LVN_INSERTITEM: - { - eventType = wxEVT_COMMAND_LIST_INSERT_ITEM; - NM_LISTVIEW* hdr = (NM_LISTVIEW*)lParam; - event.m_itemIndex = hdr->iItem; - break; - } - case LVN_ITEMCHANGED: - { - // This needs to be sent to wxListCtrl as a rather more - // concrete event. For now, just detect a selection - // or deselection. - NM_LISTVIEW* hdr = (NM_LISTVIEW*)lParam; - if ( (hdr->uNewState & LVIS_SELECTED) && !(hdr->uOldState & LVIS_SELECTED) ) - { - eventType = wxEVT_COMMAND_LIST_ITEM_SELECTED; - event.m_itemIndex = hdr->iItem; - } - else if ( !(hdr->uNewState & LVIS_SELECTED) && (hdr->uOldState & LVIS_SELECTED) ) - { - eventType = wxEVT_COMMAND_LIST_ITEM_DESELECTED; - event.m_itemIndex = hdr->iItem; - } - else - return FALSE; - break; - } - - case LVN_KEYDOWN: - { - LV_KEYDOWN *info = (LV_KEYDOWN *)lParam; - WORD wVKey = info->wVKey; - - // get the current selection - long lItem = GetNextItem(-1, - wxLIST_NEXT_ALL, - wxLIST_STATE_SELECTED); - - // or activate the selected item if any - if ( lItem != -1 && (wVKey == VK_RETURN || wVKey == VK_SPACE) ) - { - // TODO this behaviour probably should be optional - eventType = wxEVT_COMMAND_LIST_ITEM_ACTIVATED; - event.m_itemIndex = lItem; - } - else - { - eventType = wxEVT_COMMAND_LIST_KEY_DOWN; - event.m_code = wxCharCodeMSWToWX(wVKey); - } - break; - } - - case NM_DBLCLK: - // if the user processes it in wxEVT_COMMAND_LEFT_CLICK(), don't do - // anything else - if ( wxControl::MSWOnNotify(idCtrl, lParam, result) ) - { - return TRUE; - } - - // else translate it into wxEVT_COMMAND_LIST_ITEM_ACTIVATED event - eventType = wxEVT_COMMAND_LIST_ITEM_ACTIVATED; - break; - - case LVN_SETDISPINFO: - { - eventType = wxEVT_COMMAND_LIST_SET_INFO; - LV_DISPINFO *info = (LV_DISPINFO *)lParam; - wxConvertFromMSWListItem(this, event.m_item, info->item, GetHwnd()); - break; - } - - default: - return wxControl::MSWOnNotify(idCtrl, lParam, result); - } - - event.SetEventObject( this ); - event.SetEventType(eventType); - - if ( !GetEventHandler()->ProcessEvent(event) ) - return FALSE; - - if (hdr1->code == LVN_GETDISPINFO) - { - LV_DISPINFO *info = (LV_DISPINFO *)lParam; - if ( info->item.mask & LVIF_TEXT ) - { - if ( !event.m_item.m_text.IsNull() ) - { - info->item.pszText = AddPool(event.m_item.m_text); - info->item.cchTextMax = wxStrlen(info->item.pszText) + 1; - } - } - // wxConvertToMSWListItem(this, event.m_item, info->item); - } - - *result = !event.IsAllowed(); -*/ - return TRUE; -} - -wxChar *wxListCtrl::AddPool(const wxString& str) -{ - // Remove the first element if 3 strings exist - if ( m_stringPool.Number() == 3 ) - { - wxNode *node = m_stringPool.First(); - delete[] (char *)node->Data(); - delete node; - } - wxNode *node = m_stringPool.Add(WXSTRINGCAST str); - return (wxChar *)node->Data(); -} -// 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; -} - -// TODO see if we need these -/* -static void wxConvertFromOS2ListItem(const wxListCtrl *ctrl, wxListItem& info, LV_ITEM& lvItem, HWND getFullInfo) -{ - info.m_data = lvItem.lParam; - info.m_mask = 0; - info.m_state = 0; - info.m_stateMask = 0; - info.m_itemId = lvItem.iItem; - - long oldMask = lvItem.mask; - - bool needText = FALSE; - if (getFullInfo != 0) - { - if ( lvItem.mask & LVIF_TEXT ) - needText = FALSE; - else - needText = TRUE; - - if ( needText ) - { - lvItem.pszText = new wxChar[513]; - lvItem.cchTextMax = 512; - } - // lvItem.mask |= TVIF_HANDLE | TVIF_STATE | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM; - lvItem.mask |= LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; - ::SendMessage(getFullInfo, LVM_GETITEM, 0, (LPARAM)& lvItem); - } - - if ( lvItem.mask & LVIF_STATE ) - { - info.m_mask |= wxLIST_MASK_STATE; - - if ( lvItem.stateMask & LVIS_CUT) - { - info.m_stateMask |= wxLIST_STATE_CUT; - if ( lvItem.state & LVIS_CUT ) - info.m_state |= wxLIST_STATE_CUT; - } - if ( lvItem.stateMask & LVIS_DROPHILITED) - { - info.m_stateMask |= wxLIST_STATE_DROPHILITED; - if ( lvItem.state & LVIS_DROPHILITED ) - info.m_state |= wxLIST_STATE_DROPHILITED; - } - if ( lvItem.stateMask & LVIS_FOCUSED) - { - info.m_stateMask |= wxLIST_STATE_FOCUSED; - if ( lvItem.state & LVIS_FOCUSED ) - info.m_state |= wxLIST_STATE_FOCUSED; - } - if ( lvItem.stateMask & LVIS_SELECTED) - { - info.m_stateMask |= wxLIST_STATE_SELECTED; - if ( lvItem.state & LVIS_SELECTED ) - info.m_state |= wxLIST_STATE_SELECTED; - } - } - - if ( lvItem.mask & LVIF_TEXT ) - { - info.m_mask |= wxLIST_MASK_TEXT; - info.m_text = lvItem.pszText; - } - if ( lvItem.mask & LVIF_IMAGE ) - { - info.m_mask |= wxLIST_MASK_IMAGE; - info.m_image = lvItem.iImage; - } - if ( lvItem.mask & LVIF_PARAM ) - info.m_mask |= wxLIST_MASK_DATA; - if ( lvItem.mask & LVIF_DI_SETITEM ) - info.m_mask |= wxLIST_SET_ITEM; - info.m_col = lvItem.iSubItem; - - if (needText) - { - if (lvItem.pszText) - delete[] lvItem.pszText; - } - lvItem.mask = oldMask; -} - -static void wxConvertToOS2ListItem(const wxListCtrl *ctrl, wxListItem& info, LV_ITEM& lvItem) -{ - lvItem.iItem = (int) info.m_itemId; - - lvItem.iImage = info.m_image; - lvItem.lParam = info.m_data; - lvItem.stateMask = 0; - lvItem.state = 0; - lvItem.mask = 0; - lvItem.iSubItem = info.m_col; - - if (info.m_mask & wxLIST_MASK_STATE) - { - lvItem.mask |= LVIF_STATE; - if (info.m_stateMask & wxLIST_STATE_CUT) - { - lvItem.stateMask |= LVIS_CUT; - if (info.m_state & wxLIST_STATE_CUT) - lvItem.state |= LVIS_CUT; - } - if (info.m_stateMask & wxLIST_STATE_DROPHILITED) - { - lvItem.stateMask |= LVIS_DROPHILITED; - if (info.m_state & wxLIST_STATE_DROPHILITED) - lvItem.state |= LVIS_DROPHILITED; - } - if (info.m_stateMask & wxLIST_STATE_FOCUSED) - { - lvItem.stateMask |= LVIS_FOCUSED; - if (info.m_state & wxLIST_STATE_FOCUSED) - lvItem.state |= LVIS_FOCUSED; - } - if (info.m_stateMask & wxLIST_STATE_SELECTED) - { - lvItem.stateMask |= LVIS_SELECTED; - if (info.m_state & wxLIST_STATE_SELECTED) - lvItem.state |= LVIS_SELECTED; - } - } - - if (info.m_mask & wxLIST_MASK_TEXT) - { - lvItem.mask |= LVIF_TEXT; - if ( ctrl->GetWindowStyleFlag() & wxLC_USER_TEXT ) - { - lvItem.pszText = LPSTR_TEXTCALLBACK; - } - else - { - lvItem.pszText = WXSTRINGCAST info.m_text; - if ( lvItem.pszText ) - lvItem.cchTextMax = info.m_text.Length(); - else - lvItem.cchTextMax = 0; - } - } - if (info.m_mask & wxLIST_MASK_IMAGE) - lvItem.mask |= LVIF_IMAGE; - if (info.m_mask & wxLIST_MASK_DATA) - lvItem.mask |= LVIF_PARAM; -} -*/ - -// List event -IMPLEMENT_DYNAMIC_CLASS(wxListEvent, wxCommandEvent) - -wxListEvent::wxListEvent(wxEventType commandType, int id) - : wxNotifyEvent(commandType, id) -{ - m_code = 0; - m_itemIndex = 0; - m_col = 0; - m_cancelled = FALSE; -} - diff --git a/src/os2/makefile.va b/src/os2/makefile.va index e6e235fa5f..9246affb46 100644 --- a/src/os2/makefile.va +++ b/src/os2/makefile.va @@ -24,6 +24,7 @@ DUMMYOBJ=$D\dummydll.obj LIBTARGET=$(WXLIB) COMTEMPTGT1=$(WXDIR)\lib\wxcom1.lib COMTEMPTGT2=$(WXDIR)\lib\wxcom2.lib +COMTEMPTGT3=$(WXDIR)\lib\wxcom3.lib GENTEMPTGT=$(WXDIR)\lib\wxgen.lib NONESTEMPTGT=$(WXDIR)\lib\wxnones.lib OS2TEMPTGT1=$(WXDIR)\lib\wxos21.lib @@ -81,11 +82,25 @@ $(CPPFLAGS) /Fo$@ /Tp $< << GENERICOBJS= \ + ..\generic\$D\busyinfo.obj \ ..\generic\$D\caret.obj \ ..\generic\$D\choicdgg.obj \ + ..\generic\$D\colrdlgg.obj \ + ..\generic\$D\dcpsg.obj \ + ..\generic\$D\grid.obj \ ..\generic\$D\gridg.obj \ + ..\generic\$D\helpext.obj \ + ..\generic\$D\helphtml.obj \ + ..\generic\$D\helpwxht.obj \ + ..\generic\$D\helpxlp.obj \ + ..\generic\$D\imaglist.obj \ ..\generic\$D\laywin.obj \ + ..\generic\$D\listctrl.obj \ + ..\generic\$D\logg.obj \ + ..\generic\$D\numdlgg.obj \ ..\generic\$D\panelg.obj \ + ..\generic\$D\printps.obj \ + ..\generic\$D\prntdlgg.obj \ ..\generic\$D\progdlgg.obj \ ..\generic\$D\prop.obj \ ..\generic\$D\propform.obj \ @@ -96,20 +111,31 @@ GENERICOBJS= \ ..\generic\$D\statusbr.obj \ ..\generic\$D\tabg.obj \ ..\generic\$D\textdlgg.obj \ - ..\generic\$D\tipdlg.obj \ - ..\generic\$D\busyinfo.obj + ..\generic\$D\treectrl.obj \ + ..\generic\$D\tipdlg.obj -# ..\generic\$D\imaglist.obj \ -# ..\generic\$D\treectrl.obj \ -# ..\generic\$D\listctrl.obj \ # ..\generic\$D\notebook.obj \ GENLIBOBJS= \ + busyinfo.obj \ caret.obj \ choicdgg.obj \ + colrdlgg.obj \ + dcpsg.obj \ + grid.obj \ gridg.obj \ + helpext.obj \ + helphtml.obj \ + helpwxht.obj \ + helpxlp.obj \ + imaglist.obj \ laywin.obj \ + listctrl.obj \ + logg.obj \ + numdlgg.obj \ panelg.obj \ + printps.obj \ + prntdlgg.obj \ progdlgg.obj \ prop.obj \ propform.obj \ @@ -120,17 +146,13 @@ GENLIBOBJS= \ statusbr.obj \ tabg.obj \ textdlgg.obj \ - tipdlg.obj \ - busyinfo.obj + treectrl.obj \ + tipdlg.obj # These are generic things that don't need to be compiled on PM, # but sometimes it's useful to do so for testing purposes. NONESSENTIALOBJS= \ - ..\generic\$D\printps.obj \ - ..\generic\$D\prntdlgg.obj \ ..\generic\$D\msgdlgg.obj \ - ..\generic\$D\helpxlp.obj \ - ..\generic\$D\colrdlgg.obj \ ..\generic\$D\fontdlgg.obj COMMONOBJS = \ @@ -274,14 +296,14 @@ COMLIBOBJS1 = \ imagpcx.obj \ imagpng.obj \ imagpnm.obj \ - intl.obj \ + intl.obj + +COMLIBOBJS2 = \ ipcbase.obj \ layout.obj \ lboxcmn.obj \ list.obj \ - log.obj - -COMLIBOBJS2 = \ + log.obj \ longlong.obj \ matrix.obj \ memory.obj \ @@ -319,7 +341,9 @@ COMLIBOBJS2 = \ utilscmn.obj \ valgen.obj \ validate.obj \ - valtext.obj \ + valtext.obj + +COMLIBOBJS3 = \ variant.obj \ wfstream.obj \ wincmn.obj \ @@ -363,11 +387,9 @@ OS2OBJS = \ ..\os2\$D\gsocket.obj \ ..\os2\$D\helpwin.obj \ ..\os2\$D\icon.obj \ - ..\os2\$D\imaglist.obj \ ..\os2\$D\iniconf.obj \ ..\os2\$D\joystick.obj \ ..\os2\$D\listbox.obj \ - ..\os2\$D\listctrl.obj \ ..\os2\$D\main.obj \ ..\os2\$D\mdi.obj \ ..\os2\$D\menu.obj \ @@ -392,8 +414,8 @@ OS2OBJS = \ ..\os2\$D\spinctrl.obj \ ..\os2\$D\statbmp.obj \ ..\os2\$D\statbox.obj \ + ..\os2\$D\statline.obj \ ..\os2\$D\stattext.obj \ - ..\os2\$D\statbrpm.obj \ ..\os2\$D\tabctrl.obj \ ..\os2\$D\taskbar.obj \ ..\os2\$D\textctrl.obj \ @@ -401,7 +423,6 @@ OS2OBJS = \ ..\os2\$D\timer.obj \ ..\os2\$D\toolbar.obj \ ..\os2\$D\tooltip.obj \ - ..\os2\$D\treectrl.obj \ ..\os2\$D\utils.obj \ ..\os2\$D\utilsexc.obj \ ..\os2\$D\wave.obj \ @@ -473,6 +494,7 @@ OS2LIBOBJS2 = \ statbmp.obj \ statbox.obj \ stattext.obj \ + statline.obj \ statbrpm.obj \ tabctrl.obj \ taskbar.obj \ @@ -540,7 +562,7 @@ $(COMLIBOBJS1): copy ..\common\$D\cmndata.obj copy ..\common\$D\config.obj copy ..\common\$D\ctrlcmn.obj - copy ..\common\$D\ctrlsub.obj + copy ..\common\$D\ctrlsub.obj copy ..\common\$D\date.obj copy ..\common\$D\datstrm.obj copy ..\common\$D\db.obj @@ -578,66 +600,82 @@ $(COMLIBOBJS1): copy ..\common\$D\imagpng.obj copy ..\common\$D\imagpnm.obj copy ..\common\$D\intl.obj + +$(COMLIBOBJS2): copy ..\common\$D\ipcbase.obj copy ..\common\$D\layout.obj copy ..\common\$D\lboxcmn.obj copy ..\common\$D\list.obj copy ..\common\$D\log.obj - -$(COMLIBOBJS2): - copy ..\common\$D\longlong.obj \ - copy ..\common\$D\matrix.obj \ - copy ..\common\$D\memory.obj \ - copy ..\common\$D\mimetype.obj \ - copy ..\common\$D\module.obj \ - copy ..\common\$D\mstream.obj \ - copy ..\common\$D\object.obj \ - copy ..\common\$D\objstrm.obj \ - copy ..\common\$D\odbc.obj \ - copy ..\common\$D\paper.obj \ - copy ..\common\$D\prntbase.obj \ - copy ..\common\$D\process.obj \ - copy ..\common\$D\protocol.obj \ - copy ..\common\$D\resource.obj \ - copy ..\common\$D\sckaddr.obj \ - copy ..\common\$D\sckfile.obj \ - copy ..\common\$D\sckipc.obj \ - copy ..\common\$D\sckstrm.obj \ - copy ..\common\$D\serbase.obj \ - copy ..\common\$D\sizer.obj \ - copy ..\common\$D\socket.obj \ - copy ..\common\$D\strconv.obj \ - copy ..\common\$D\stream.obj \ - copy ..\common\$D\string.obj \ - copy ..\common\$D\tbarbase.obj \ - copy ..\common\$D\tbarsmpl.obj \ - copy ..\common\$D\textcmn.obj \ - copy ..\common\$D\textfile.obj \ - copy ..\common\$D\time.obj \ - copy ..\common\$D\timercmn.obj \ - copy ..\common\$D\tokenzr.obj \ - copy ..\common\$D\txtstrm.obj \ - copy ..\common\$D\unzip.obj \ - copy ..\common\$D\url.obj \ - copy ..\common\$D\utilscmn.obj \ - copy ..\common\$D\valgen.obj \ - copy ..\common\$D\validate.obj \ - copy ..\common\$D\valtext.obj \ - copy ..\common\$D\variant.obj \ - copy ..\common\$D\wfstream.obj \ - copy ..\common\$D\wincmn.obj \ - copy ..\common\$D\wxchar.obj \ - copy ..\common\$D\wxexpr.obj \ - copy ..\common\$D\y_tab.obj \ - copy ..\common\$D\zipstrm.obj \ + copy ..\common\$D\longlong.obj + copy ..\common\$D\matrix.obj + copy ..\common\$D\memory.obj + copy ..\common\$D\mimetype.obj + copy ..\common\$D\module.obj + copy ..\common\$D\mstream.obj + copy ..\common\$D\object.obj + copy ..\common\$D\objstrm.obj + copy ..\common\$D\odbc.obj + copy ..\common\$D\paper.obj + copy ..\common\$D\prntbase.obj + copy ..\common\$D\process.obj + copy ..\common\$D\protocol.obj + copy ..\common\$D\resource.obj + copy ..\common\$D\sckaddr.obj + copy ..\common\$D\sckfile.obj + copy ..\common\$D\sckipc.obj + copy ..\common\$D\sckstrm.obj + copy ..\common\$D\serbase.obj + copy ..\common\$D\sizer.obj + copy ..\common\$D\socket.obj + copy ..\common\$D\strconv.obj + copy ..\common\$D\stream.obj + copy ..\common\$D\string.obj + copy ..\common\$D\tbarbase.obj + copy ..\common\$D\tbarsmpl.obj + copy ..\common\$D\textcmn.obj + copy ..\common\$D\textfile.obj + copy ..\common\$D\time.obj + copy ..\common\$D\timercmn.obj + copy ..\common\$D\tokenzr.obj + copy ..\common\$D\txtstrm.obj + copy ..\common\$D\unzip.obj + copy ..\common\$D\url.obj + copy ..\common\$D\utilscmn.obj + copy ..\common\$D\valgen.obj + copy ..\common\$D\validate.obj + copy ..\common\$D\valtext.obj + copy ..\common\$D\variant.obj + +$(COMLIBOBJS3): + copy ..\common\$D\wfstream.obj + copy ..\common\$D\wincmn.obj + copy ..\common\$D\wxchar.obj + copy ..\common\$D\wxexpr.obj + copy ..\common\$D\y_tab.obj + copy ..\common\$D\zipstrm.obj copy ..\common\$D\zstream.obj $(GENLIBOBJS): + copy ..\generic\$D\busyinfo.obj copy ..\generic\$D\caret.obj copy ..\generic\$D\choicdgg.obj + copy ..\generic\$D\colrdlgg.obj + copy ..\generic\$D\dcpsg.obj + copy ..\generic\$D\grid.obj copy ..\generic\$D\gridg.obj + copy ..\generic\$D\helpext.obj + copy ..\generic\$D\helphtml.obj + copy ..\generic\$D\helpwxht.obj + copy ..\generic\$D\helpxlp.obj + copy ..\generic\$D\imaglist.obj copy ..\generic\$D\laywin.obj + copy ..\generic\$D\listctrl.obj + copy ..\generic\$D\logg.obj + copy ..\generic\$D\numdlgg.obj copy ..\generic\$D\panelg.obj + copy ..\generic\$D\printps.obj + copy ..\generic\$D\prntdlgg.obj copy ..\generic\$D\progdlgg.obj copy ..\generic\$D\prop.obj copy ..\generic\$D\propform.obj @@ -648,8 +686,8 @@ $(GENLIBOBJS): copy ..\generic\$D\statusbr.obj copy ..\generic\$D\tabg.obj copy ..\generic\$D\textdlgg.obj + copy ..\generic\$D\treectrl.obj copy ..\generic\$D\tipdlg.obj - copy ..\generic\$D\busyinfo.obj $(OS2LIBOBJS1): copy ..\os2\$D\accel.obj @@ -667,6 +705,7 @@ $(OS2LIBOBJS1): copy ..\os2\$D\control.obj copy ..\os2\$D\cursor.obj copy ..\os2\$D\data.obj + copy ..\os2\$D\dataobj.obj copy ..\os2\$D\dc.obj copy ..\os2\$D\dcclient.obj copy ..\os2\$D\dcmemory.obj @@ -696,9 +735,9 @@ $(OS2LIBOBJS1): copy ..\os2\$D\metafile.obj copy ..\os2\$D\minifram.obj copy ..\os2\$D\msgdlg.obj - copy ..\os2\$D\nativdlg.obj $(OS2LIBOBJS2): + copy ..\os2\$D\nativdlg.obj copy ..\os2\$D\notebook.obj copy ..\os2\$D\ownerdrw.obj copy ..\os2\$D\palette.obj @@ -715,6 +754,7 @@ $(OS2LIBOBJS2): copy ..\os2\$D\spinctrl.obj copy ..\os2\$D\statbmp.obj copy ..\os2\$D\statbox.obj + copy ..\os2\$D\statline.obj copy ..\os2\$D\stattext.obj copy ..\os2\$D\statbrpm.obj copy ..\os2\$D\tabctrl.obj @@ -779,6 +819,13 @@ $(WXDIR)\lib\wxcom2.lib: $(COMLIBOBJS2) $**; << +$(WXDIR)\lib\wxcom3.lib: $(COMLIBOBJS3) + touch $(WXDIR)\lib\wxcom3.lib + del $(WXDIR)\lib\wxcom3.lib + ilib $(LIBFLAGS) $@ @<< + $**; +<< + $(WXDIR)\lib\wxgen.lib: $(GENLIBOBJS) touch $(WXDIR)\lib\wxgen.lib del $(WXDIR)\lib\wxgen.lib @@ -812,6 +859,7 @@ $(WXDIR)\lib\wx.lib: \ $D\dummy.obj \ $(COMTEMPTGT1) \ $(COMTEMPTGT2) \ + $(COMTEMPTGT3) \ $(GENTEMPTGT) \ $(NONESTEMPTGT) \ $(OS2TEMPTGT1) \ @@ -824,6 +872,7 @@ $(WXDIR)\lib\wx.lib: \ << del $(COMTEMPTGT1) del $(COMTEMPTGT2) + del $(COMTEMPTGT3) del $(GENTEMPTGT) del $(NONESTEMPTGT) del $(OS2TEMPTGT1) @@ -847,11 +896,9 @@ $(WXDIR)\lib\wx200.dll: $(OBJECTS) $(WXDIR)\lib\wx210.lib !endif $D\dummy.obj: dummy.$(SRCSUFF) $(WXDIR)\include\wx\wx.h $(WXDIR)\include\wx\os2\setup.h - @echo $< icc $(CPPFLAGS) $(MAKEPRECOMP) /Fo$D\dummy.obj /Tp dummy.cpp $D\dummydll.obj: dummydll.$(SRCSUFF) $(WXDIR)\include\wx\wx.h $(WXDIR)\include\wx\os2\setup.h - @echo $< icc @<< $(CPPFLAGS) $(MAKEPRECOMP) /Fo$D\dummydll.obj /c /Tp dummydll.cpp << @@ -862,13 +909,11 @@ $(WXDIR)\include\wx\os2\setup.h: $(WXDIR)\include\wx\os2\setup0.h copy "$(WXDIR)"\include\wx\os2\setup0.h "$(WXDIR)"\include\wx\os2\setup.h ..\common\$D\extended.obj: ..\common\extended.c - @echo $< icc @<< $(CPPFLAGS2) /Fo$@ $(COMMDIR)\extended.c << ..\common\$D\y_tab.obj: ..\common\y_tab.c ..\common\lex_yy.c - @echo $< icc @<< $(CPPFLAGS2) /DUSE_DEFINE /DYY_USE_PROTOS /Fo$@ ..\common\y_tab.c << @@ -882,7 +927,6 @@ $(CPPFLAGS2) /DUSE_DEFINE /DYY_USE_PROTOS /Fo$@ ..\common\y_tab.c $(OBJECTS): $(WXDIR)/include/wx/setup.h ..\common\$D\unzip.obj: ..\common\unzip.c - @echo $< icc @<< $(CPPFLAGS2) /Fo$@ $(COMMDIR)\unzip.c << diff --git a/src/os2/pen.cpp b/src/os2/pen.cpp index 48da7cb434..c3d18a0378 100644 --- a/src/os2/pen.cpp +++ b/src/os2/pen.cpp @@ -140,6 +140,11 @@ bool wxPen::FreeResource(bool force) else return FALSE; } +bool wxPen::IsFree() const +{ + return (M_PENDATA && M_PENDATA->m_hPen == 0); +} + void wxPen::Unshare() { // Don't change shared data diff --git a/src/os2/treectrl.cpp b/src/os2/treectrl.cpp deleted file mode 100644 index 8671b38c71..0000000000 --- a/src/os2/treectrl.cpp +++ /dev/null @@ -1,1689 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: treectrl.cpp -// Purpose: wxTreeCtrl. See also Robert's generic wxTreeCtrl. -// Author: David Webster -// Modified by: -// Created: 10/17/99 -// RCS-ID: $Id$ -// Copyright: (c) David -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#include "wx/window.h" -#include "wx/os2/private.h" - -#include "wx/log.h" -#include "wx/dynarray.h" -#include "wx/imaglist.h" -#include "wx/treectrl.h" -#include "wx/settings.h" - -// Bug in headers, sometimes -#ifndef TVIS_FOCUSED - #define TVIS_FOCUSED 0x0001 -#endif - -// ---------------------------------------------------------------------------- -// private classes -// ---------------------------------------------------------------------------- - -struct wxTreeViewItem// ??? : public TV_ITEM -{ - wxTreeViewItem(const wxTreeItemId& item, // the item handle - UINT mask_, // fields which are valid - UINT stateMask_ = 0) // for TVIF_STATE only - { - // hItem member is always valid - mask = mask_; // | TVIF_HANDLE; - stateMask = stateMask_; - hItem = /*(HTREEITEM)*/ (WXHTREEITEM) item; - } - // OS/2 subs - UINT mask; - UINT stateMask; - WXHTREEITEM hItem; -}; - -// a class which encapsulates the tree traversal logic: it vists all (unless -// OnVisit() returns FALSE) items under the given one -class wxTreeTraversal -{ -public: - wxTreeTraversal(const wxTreeCtrl *tree) - { - m_tree = tree; - } - - // do traverse the tree: visit all items (recursively by default) under the - // given one; return TRUE if all items were traversed or FALSE if the - // traversal was aborted because OnVisit returned FALSE - bool DoTraverse(const wxTreeItemId& root, bool recursively = TRUE); - - // override this function to do whatever is needed for each item, return - // FALSE to stop traversing - virtual bool OnVisit(const wxTreeItemId& item) = 0; - -protected: - const wxTreeCtrl *GetTree() const { return m_tree; } - -private: - bool Traverse(const wxTreeItemId& root, bool recursively); - - const wxTreeCtrl *m_tree; -}; - -// internal class for getting the selected items -class TraverseSelections : public wxTreeTraversal -{ -public: - TraverseSelections(const wxTreeCtrl *tree, - wxArrayTreeItemIds& selections) - : wxTreeTraversal(tree), m_selections(selections) - { - m_selections.Empty(); - - DoTraverse(tree->GetRootItem()); - } - - virtual bool OnVisit(const wxTreeItemId& item) - { - if ( GetTree()->IsItemChecked(item) ) - { - m_selections.Add(item); - } - - return TRUE; - } - -private: - wxArrayTreeItemIds& m_selections; -}; - -// internal class for counting tree items -class TraverseCounter : public wxTreeTraversal -{ -public: - TraverseCounter(const wxTreeCtrl *tree, - const wxTreeItemId& root, - bool recursively) - : wxTreeTraversal(tree) - { - m_count = 0; - - DoTraverse(root, recursively); - } - - virtual bool OnVisit(const wxTreeItemId& item) - { - m_count++; - - return TRUE; - } - - size_t GetCount() const { return m_count; } - -private: - size_t m_count; -}; - -// ---------------------------------------------------------------------------- -// This class is needed for support of different images: the Win32 common -// control natively supports only 2 images (the normal one and another for the -// selected state). We wish to provide support for 2 more of them for folder -// items (i.e. those which have children): for expanded state and for expanded -// selected state. For this we use this structure to store the additional items -// images. -// -// There is only one problem with this: when we retrieve the item's data, we -// don't know whether we get a pointer to wxTreeItemData or -// wxTreeItemIndirectData. So we have to maintain a list of all items which -// have indirect data inside the listctrl itself. -// ---------------------------------------------------------------------------- -class wxTreeItemIndirectData -{ -public: - // ctor associates this data with the item and the real item data becomes - // available through our GetData() method - wxTreeItemIndirectData(wxTreeCtrl *tree, const wxTreeItemId& item) - { - for ( size_t n = 0; n < WXSIZEOF(m_images); n++ ) - { - m_images[n] = -1; - } - - // save the old data - m_data = tree->GetItemData(item); - - // and set ourselves as the new one - tree->SetIndirectItemData(item, this); - } - - // dtor deletes the associated data as well - ~wxTreeItemIndirectData() { delete m_data; } - - // accessors - // get the real data associated with the item - wxTreeItemData *GetData() const { return m_data; } - // change it - void SetData(wxTreeItemData *data) { m_data = data; } - - // do we have such image? - bool HasImage(wxTreeItemIcon which) const { return m_images[which] != -1; } - // get image - int GetImage(wxTreeItemIcon which) const { return m_images[which]; } - // change it - void SetImage(int image, wxTreeItemIcon which) { m_images[which] = image; } - -private: - // all the images associated with the item - int m_images[wxTreeItemIcon_Max]; - - wxTreeItemData *m_data; -}; - -// ---------------------------------------------------------------------------- -// macros -// ---------------------------------------------------------------------------- - -#if !USE_SHARED_LIBRARY - IMPLEMENT_DYNAMIC_CLASS(wxTreeCtrl, wxControl) -#endif - -// ---------------------------------------------------------------------------- -// variables -// ---------------------------------------------------------------------------- - -// handy table for sending events -static const wxEventType g_events[2][2] = -{ - { wxEVT_COMMAND_TREE_ITEM_COLLAPSED, wxEVT_COMMAND_TREE_ITEM_COLLAPSING }, - { wxEVT_COMMAND_TREE_ITEM_EXPANDED, wxEVT_COMMAND_TREE_ITEM_EXPANDING } -}; - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// tree traversal -// ---------------------------------------------------------------------------- - -bool wxTreeTraversal::DoTraverse(const wxTreeItemId& root, bool recursively) -{ - if ( !OnVisit(root) ) - return FALSE; - - return Traverse(root, recursively); -} - -bool wxTreeTraversal::Traverse(const wxTreeItemId& root, bool recursively) -{ - long cookie; - wxTreeItemId child = m_tree->GetFirstChild(root, cookie); - while ( child.IsOk() ) - { - // depth first traversal - if ( recursively && !Traverse(child, TRUE) ) - return FALSE; - - if ( !OnVisit(child) ) - return FALSE; - - child = m_tree->GetNextChild(root, cookie); - } - - return TRUE; -} - -// ---------------------------------------------------------------------------- -// construction and destruction -// ---------------------------------------------------------------------------- - -void wxTreeCtrl::Init() -{ - m_imageListNormal = NULL; - m_imageListState = NULL; - m_textCtrl = NULL; -} - -bool wxTreeCtrl::Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& validator, - const wxString& name) -{ - Init(); - - if ( !CreateControl(parent, id, pos, size, style, validator, name) ) - return FALSE; -// TODO: -/* - DWORD wstyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP | - TVS_HASLINES | TVS_SHOWSELALWAYS; - - if ( m_windowStyle & wxTR_HAS_BUTTONS ) - wstyle |= TVS_HASBUTTONS; - - if ( m_windowStyle & wxTR_EDIT_LABELS ) - wstyle |= TVS_EDITLABELS; - - if ( m_windowStyle & wxTR_LINES_AT_ROOT ) - wstyle |= TVS_LINESATROOT; - - if ( m_windowStyle & wxTR_MULTIPLE ) - wstyle |= TVS_CHECKBOXES; - - // Create the tree control. - if ( !OS2CreateControl(WC_TREEVIEW, wstyle) ) - return FALSE; -*/ - SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW)); - SetForegroundColour(wxWindow::GetParent()->GetForegroundColour()); - - // VZ: this is some experimental code which may be used to get the - // TVS_CHECKBOXES style functionality for comctl32.dll < 4.71. - // AFAIK, the standard DLL does about the same thing anyhow. -#if 0 - if ( m_windowStyle & wxTR_MULTIPLE ) - { - wxBitmap bmp; - - // create the DC compatible with the current screen - HDC hdcMem = CreateCompatibleDC(NULL); - - // create a mono bitmap of the standard size - int x = GetSystemMetrics(SM_CXMENUCHECK); - int y = GetSystemMetrics(SM_CYMENUCHECK); - wxImageList imagelistCheckboxes(x, y, FALSE, 2); - HBITMAP hbmpCheck = CreateBitmap(x, y, // bitmap size - 1, // # of color planes - 1, // # bits needed for one pixel - 0); // array containing colour data - SelectObject(hdcMem, hbmpCheck); - - // then draw a check mark into it - RECT rect = { 0, 0, x, y }; - if ( !::DrawFrameControl(hdcMem, &rect, - DFC_BUTTON, - DFCS_BUTTONCHECK | DFCS_CHECKED) ) - { - wxLogLastError(wxT("DrawFrameControl(check)")); - } - - bmp.SetHBITMAP((WXHBITMAP)hbmpCheck); - imagelistCheckboxes.Add(bmp); - - if ( !::DrawFrameControl(hdcMem, &rect, - DFC_BUTTON, - DFCS_BUTTONCHECK) ) - { - wxLogLastError(wxT("DrawFrameControl(uncheck)")); - } - - bmp.SetHBITMAP((WXHBITMAP)hbmpCheck); - imagelistCheckboxes.Add(bmp); - - // clean up - ::DeleteDC(hdcMem); - - // set the imagelist - SetStateImageList(&imagelistCheckboxes); - } -#endif // 0 - - SetSize(pos.x, pos.y, size.x, size.y); - - return TRUE; -} - -wxTreeCtrl::~wxTreeCtrl() -{ - DeleteTextCtrl(); - - // delete user data to prevent memory leaks -// DeleteAllItems(); -} - -// ---------------------------------------------------------------------------- -// accessors -// ---------------------------------------------------------------------------- - -// simple wrappers which add error checking in debug mode - -bool wxTreeCtrl::DoGetItem(wxTreeViewItem* tvItem) const -{ -// TODO: -/* - if ( !TreeView_GetItem(GetHwnd(), tvItem) ) - { - wxLogLastError("TreeView_GetItem"); - - return FALSE; - } -*/ - return TRUE; -} - -void wxTreeCtrl::DoSetItem(wxTreeViewItem* tvItem) -{ -// TODO: -/* - if ( TreeView_SetItem(GetHwnd(), tvItem) == -1 ) - { - wxLogLastError("TreeView_SetItem"); - } -*/ -} - -size_t wxTreeCtrl::GetCount() const -{ -// return (size_t)TreeView_GetCount(GetHwnd()); - return 0; -} - -unsigned int wxTreeCtrl::GetIndent() const -{ -// return TreeView_GetIndent(GetHwnd()); - return 0; -} - -void wxTreeCtrl::SetIndent(unsigned int indent) -{ -// TreeView_SetIndent(GetHwnd(), indent); -} - -wxImageList *wxTreeCtrl::GetImageList() const -{ - return m_imageListNormal; -} - -wxImageList *wxTreeCtrl::GetStateImageList() const -{ - return m_imageListNormal; -} - -void wxTreeCtrl::SetAnyImageList(wxImageList *imageList, int which) -{ - // no error return -// TODO: -/* - TreeView_SetImageList(GetHwnd(), - imageList ? imageList->GetHIMAGELIST() : 0, - which); -*/ -} - -void wxTreeCtrl::SetImageList(wxImageList *imageList) -{ -// SetAnyImageList(m_imageListNormal = imageList, TVSIL_NORMAL); -} - -void wxTreeCtrl::SetStateImageList(wxImageList *imageList) -{ -// SetAnyImageList(m_imageListState = imageList, TVSIL_STATE); -} - -size_t wxTreeCtrl::GetChildrenCount(const wxTreeItemId& item, - bool recursively) const -{ - TraverseCounter counter(this, item, recursively); - - return counter.GetCount() - 1; -} - -// ---------------------------------------------------------------------------- -// Item access -// ---------------------------------------------------------------------------- - -wxString wxTreeCtrl::GetItemText(const wxTreeItemId& item) const -{ - wxChar buf[512]; // the size is arbitrary... -// TODO: -/* - wxTreeViewItem tvItem(item, TVIF_TEXT); - tvItem.pszText = buf; - tvItem.cchTextMax = WXSIZEOF(buf); - if ( !DoGetItem(&tvItem) ) - { - // don't return some garbage which was on stack, but an empty string - buf[0] = wxT('\0'); - } -*/ - return wxString(buf); -} - -void wxTreeCtrl::SetItemText(const wxTreeItemId& item, const wxString& text) -{ -// TODO: -/* - wxTreeViewItem tvItem(item, TVIF_TEXT); - tvItem.pszText = (wxChar *)text.c_str(); // conversion is ok - DoSetItem(&tvItem); -*/ -} - -int wxTreeCtrl::DoGetItemImageFromData(const wxTreeItemId& item, - wxTreeItemIcon which) const -{ -// TODO: -/* - wxTreeViewItem tvItem(item, TVIF_PARAM); - if ( !DoGetItem(&tvItem) ) - { - return -1; - } - return ((wxTreeItemIndirectData *)tvItem.lParam)->GetImage(which); -*/ - return -1; -} - -void wxTreeCtrl::DoSetItemImageFromData(const wxTreeItemId& item, - int image, - wxTreeItemIcon which) const -{ -// TODO: -/* - wxTreeViewItem tvItem(item, TVIF_PARAM); - if ( !DoGetItem(&tvItem) ) - { - return; - } - - wxTreeItemIndirectData *data = ((wxTreeItemIndirectData *)tvItem.lParam); - - data->SetImage(image, which); - - // make sure that we have selected images as well - if ( which == wxTreeItemIcon_Normal && - !data->HasImage(wxTreeItemIcon_Selected) ) - { - data->SetImage(image, wxTreeItemIcon_Selected); - } - - if ( which == wxTreeItemIcon_Expanded && - !data->HasImage(wxTreeItemIcon_SelectedExpanded) ) - { - data->SetImage(image, wxTreeItemIcon_SelectedExpanded); - } -*/ -} - -void wxTreeCtrl::DoSetItemImages(const wxTreeItemId& item, - int image, - int imageSel) -{ -// TODO: -/* - wxTreeViewItem tvItem(item, TVIF_IMAGE | TVIF_SELECTEDIMAGE); - tvItem.iSelectedImage = imageSel; - tvItem.iImage = image; - DoSetItem(&tvItem); -*/ -} - -int wxTreeCtrl::GetItemImage(const wxTreeItemId& item, - wxTreeItemIcon which) const -{ - if ( HasIndirectData(item) ) - { - return DoGetItemImageFromData(item, which); - } - - UINT mask; - switch ( which ) - { - default: - wxFAIL_MSG( wxT("unknown tree item image type") ); - - case wxTreeItemIcon_Normal: -// mask = TVIF_IMAGE; - break; - - case wxTreeItemIcon_Selected: -// mask = TVIF_SELECTEDIMAGE; - break; - - case wxTreeItemIcon_Expanded: - case wxTreeItemIcon_SelectedExpanded: - return -1; - } - - wxTreeViewItem tvItem(item, mask); - DoGetItem(&tvItem); - -// return mask == TVIF_IMAGE ? tvItem.iImage : tvItem.iSelectedImage; - return FALSE; -} - -void wxTreeCtrl::SetItemImage(const wxTreeItemId& item, int image, - wxTreeItemIcon which) -{ - int imageNormal, imageSel; - switch ( which ) - { - default: - wxFAIL_MSG( wxT("unknown tree item image type") ); - - case wxTreeItemIcon_Normal: - imageNormal = image; - imageSel = GetItemSelectedImage(item); - break; - - case wxTreeItemIcon_Selected: - imageNormal = GetItemImage(item); - imageSel = image; - break; - - case wxTreeItemIcon_Expanded: - case wxTreeItemIcon_SelectedExpanded: - if ( !HasIndirectData(item) ) - { - // we need to get the old images first, because after we create - // the wxTreeItemIndirectData GetItemXXXImage() will use it to - // get the images - imageNormal = GetItemImage(item); - imageSel = GetItemSelectedImage(item); - - // if it doesn't have it yet, add it - wxTreeItemIndirectData *data = new - wxTreeItemIndirectData(this, item); - - // copy the data to the new location - data->SetImage(imageNormal, wxTreeItemIcon_Normal); - data->SetImage(imageSel, wxTreeItemIcon_Selected); - } - - DoSetItemImageFromData(item, image, which); - - // reset the normal/selected images because we won't use them any - // more - now they're stored inside the indirect data -// imageSel = I_IMAGECALLBACK; - break; - } - - // NB: at least in version 5.00.0518.9 of comctl32.dll we need to always - // change both normal and selected image - otherwise the change simply - // doesn't take place! - DoSetItemImages(item, imageNormal, imageSel); -} - -wxTreeItemData *wxTreeCtrl::GetItemData(const wxTreeItemId& item) const -{ -// TODO: -/* - wxTreeViewItem tvItem(item, TVIF_PARAM); - if ( !DoGetItem(&tvItem) ) - { - return NULL; - } - - if ( HasIndirectData(item) ) - { - return ((wxTreeItemIndirectData *)tvItem.lParam)->GetData(); - } - else - { - return (wxTreeItemData *)tvItem.lParam; - } -*/ - return 0; -} - -void wxTreeCtrl::SetItemData(const wxTreeItemId& item, wxTreeItemData *data) -{ -// TODO: -/* - wxTreeViewItem tvItem(item, TVIF_PARAM); - - if ( HasIndirectData(item) ) - { - if ( DoGetItem(&tvItem) ) - { - ((wxTreeItemIndirectData *)tvItem.lParam)->SetData(data); - } - else - { - wxFAIL_MSG( wxT("failed to change tree items data") ); - } - } - else - { - tvItem.lParam = (MPARAM)data; - DoSetItem(&tvItem); - } -*/ -} - -void wxTreeCtrl::SetIndirectItemData(const wxTreeItemId& item, - wxTreeItemIndirectData *data) -{ - // this should never happen because it's unnecessary and will probably lead - // to crash too because the code elsewhere supposes that the pointer the - // wxTreeItemIndirectData has is a real wxItemData and not - // wxTreeItemIndirectData as well - wxASSERT_MSG( !HasIndirectData(item), wxT("setting indirect data twice?") ); - - SetItemData(item, (wxTreeItemData *)data); - - m_itemsWithIndirectData.Add(item); -} - -bool wxTreeCtrl::HasIndirectData(const wxTreeItemId& item) const -{ - return m_itemsWithIndirectData.Index(item) != wxNOT_FOUND; -} - -void wxTreeCtrl::SetItemHasChildren(const wxTreeItemId& item, bool has) -{ -// TODO: -/* - wxTreeViewItem tvItem(item, TVIF_CHILDREN); - tvItem.cChildren = (int)has; - DoSetItem(&tvItem); -*/ -} - -void wxTreeCtrl::SetItemBold(const wxTreeItemId& item, bool bold) -{ -// TODO: -/* - wxTreeViewItem tvItem(item, TVIF_STATE, TVIS_BOLD); - tvItem.state = bold ? TVIS_BOLD : 0; - DoSetItem(&tvItem); -*/ -} - -void wxTreeCtrl::SetItemDropHighlight(const wxTreeItemId& item, bool highlight) -{ -// TODO: -/* - wxTreeViewItem tvItem(item, TVIF_STATE, TVIS_DROPHILITED); - tvItem.state = highlight ? TVIS_DROPHILITED : 0; - DoSetItem(&tvItem); -*/ -} - -// ---------------------------------------------------------------------------- -// Item status -// ---------------------------------------------------------------------------- - -bool wxTreeCtrl::IsVisible(const wxTreeItemId& item) const -{ - // Bug in Gnu-Win32 headers, so don't use the macro TreeView_GetItemRect -// TODO: -/* - RECT rect; - return SendMessage(GetHwnd(), TVM_GETITEMRECT, FALSE, (LPARAM)&rect) != 0; -*/ - return FALSE; -} - -bool wxTreeCtrl::ItemHasChildren(const wxTreeItemId& item) const -{ -// TODO: -/* - wxTreeViewItem tvItem(item, TVIF_CHILDREN); - DoGetItem(&tvItem); - - return tvItem.cChildren != 0; -*/ - return FALSE; -} - -bool wxTreeCtrl::IsExpanded(const wxTreeItemId& item) const -{ - // probably not a good idea to put it here - //wxASSERT( ItemHasChildren(item) ); - -// TODO: -/* - wxTreeViewItem tvItem(item, TVIF_STATE, TVIS_EXPANDED); - DoGetItem(&tvItem); - - return (tvItem.state & TVIS_EXPANDED) != 0; -*/ - return FALSE; -} - -bool wxTreeCtrl::IsSelected(const wxTreeItemId& item) const -{ -// TODO: -/* - wxTreeViewItem tvItem(item, TVIF_STATE, TVIS_SELECTED); - DoGetItem(&tvItem); - - return (tvItem.state & TVIS_SELECTED) != 0; -*/ - return FALSE; -} - -bool wxTreeCtrl::IsBold(const wxTreeItemId& item) const -{ -// TODO: -/* - wxTreeViewItem tvItem(item, TVIF_STATE, TVIS_BOLD); - DoGetItem(&tvItem); - - return (tvItem.state & TVIS_BOLD) != 0; -*/ - return FALSE; -} - -// ---------------------------------------------------------------------------- -// navigation -// ---------------------------------------------------------------------------- - -wxTreeItemId wxTreeCtrl::GetRootItem() const -{ -// return wxTreeItemId((WXHTREEITEM) TreeView_GetRoot(GetHwnd())); - return 0; -} - -wxTreeItemId wxTreeCtrl::GetSelection() const -{ - wxCHECK_MSG( !(m_windowStyle & wxTR_MULTIPLE), (WXHTREEITEM)0, - wxT("this only works with single selection controls") ); - -// return wxTreeItemId((WXHTREEITEM) TreeView_GetSelection(GetHwnd())); - return 0; -} - -wxTreeItemId wxTreeCtrl::GetParent(const wxTreeItemId& item) const -{ -// return wxTreeItemId((WXHTREEITEM) TreeView_GetParent(GetHwnd(), (HTREEITEM) (WXHTREEITEM) item)); - return 0; -} - -wxTreeItemId wxTreeCtrl::GetFirstChild(const wxTreeItemId& item, - long& _cookie) const -{ -// TODO: -/* - // remember the last child returned in 'cookie' - _cookie = (long)TreeView_GetChild(GetHwnd(), (HTREEITEM) (WXHTREEITEM)item); - - return wxTreeItemId((WXHTREEITEM)_cookie); -*/ - return 0; -} - -wxTreeItemId wxTreeCtrl::GetNextChild(const wxTreeItemId& WXUNUSED(item), - long& _cookie) const -{ - wxTreeItemId l = 0; //wxTreeItemId((WXHTREEITEM)TreeView_GetNextSibling(GetHwnd(), -// (HTREEITEM)(WXHTREEITEM)_cookie)); - _cookie = (long)l; - - return l; -} - -wxTreeItemId wxTreeCtrl::GetLastChild(const wxTreeItemId& item) const -{ - // can this be done more efficiently? - long cookie; - - wxTreeItemId childLast, - child = GetFirstChild(item, cookie); - while ( child.IsOk() ) - { - childLast = child; - child = GetNextChild(item, cookie); - } - - return childLast; -} - -wxTreeItemId wxTreeCtrl::GetNextSibling(const wxTreeItemId& item) const -{ -// return wxTreeItemId((WXHTREEITEM) TreeView_GetNextSibling(GetHwnd(), (HTREEITEM) (WXHTREEITEM) item)); - return 0; -} - -wxTreeItemId wxTreeCtrl::GetPrevSibling(const wxTreeItemId& item) const -{ -// return wxTreeItemId((WXHTREEITEM) TreeView_GetPrevSibling(GetHwnd(), (HTREEITEM) (WXHTREEITEM) item)); - return 0; -} - -wxTreeItemId wxTreeCtrl::GetFirstVisibleItem() const -{ -// return wxTreeItemId((WXHTREEITEM) TreeView_GetFirstVisible(GetHwnd())); - return 0; -} - -wxTreeItemId wxTreeCtrl::GetNextVisible(const wxTreeItemId& item) const -{ - wxASSERT_MSG( IsVisible(item), wxT("The item you call GetNextVisible() " - "for must be visible itself!")); - -// return wxTreeItemId((WXHTREEITEM) TreeView_GetNextVisible(GetHwnd(), (HTREEITEM) (WXHTREEITEM) item)); - return 0; -} - -wxTreeItemId wxTreeCtrl::GetPrevVisible(const wxTreeItemId& item) const -{ - wxASSERT_MSG( IsVisible(item), wxT("The item you call GetPrevVisible() " - "for must be visible itself!")); - -// return wxTreeItemId((WXHTREEITEM) TreeView_GetPrevVisible(GetHwnd(), (HTREEITEM) (WXHTREEITEM) item)); - return 0; -} - -// ---------------------------------------------------------------------------- -// multiple selections emulation -// ---------------------------------------------------------------------------- - -bool wxTreeCtrl::IsItemChecked(const wxTreeItemId& item) const -{ - // receive the desired information. -// TODO: -/* - wxTreeViewItem tvItem(item, TVIF_STATE, TVIS_STATEIMAGEMASK); - DoGetItem(&tvItem); - - // state image indices are 1 based - return ((tvItem.state >> 12) - 1) == 1; -*/ - return FALSE; -} - -void wxTreeCtrl::SetItemCheck(const wxTreeItemId& item, bool check) -{ - // receive the desired information. -// TODO: -/* - wxTreeViewItem tvItem(item, TVIF_STATE, TVIS_STATEIMAGEMASK); - - // state images are one-based - tvItem.state = (check ? 2 : 1) << 12; - - DoSetItem(&tvItem); -*/ -} - -size_t wxTreeCtrl::GetSelections(wxArrayTreeItemIds& selections) const -{ - TraverseSelections selector(this, selections); - - return selections.GetCount(); -} - -// ---------------------------------------------------------------------------- -// Usual operations -// ---------------------------------------------------------------------------- - -wxTreeItemId wxTreeCtrl::DoInsertItem(const wxTreeItemId& parent, - wxTreeItemId hInsertAfter, - const wxString& text, - int image, int selectedImage, - wxTreeItemData *data) -{ -// TODO: -/* - TV_INSERTSTRUCT tvIns; - tvIns.hParent = (HTREEITEM) (WXHTREEITEM)parent; - tvIns.hInsertAfter = (HTREEITEM) (WXHTREEITEM) hInsertAfter; - - // this is how we insert the item as the first child: supply a NULL - // hInsertAfter - if ( !tvIns.hInsertAfter ) - { - tvIns.hInsertAfter = TVI_FIRST; - } - - UINT mask = 0; - if ( !text.IsEmpty() ) - { - mask |= TVIF_TEXT; - tvIns.item.pszText = (wxChar *)text.c_str(); // cast is ok - } - - if ( image != -1 ) - { - mask |= TVIF_IMAGE; - tvIns.item.iImage = image; - - if ( selectedImage == -1 ) - { - // take the same image for selected icon if not specified - selectedImage = image; - } - } - - if ( selectedImage != -1 ) - { - mask |= TVIF_SELECTEDIMAGE; - tvIns.item.iSelectedImage = selectedImage; - } - - if ( data != NULL ) - { - mask |= TVIF_PARAM; - tvIns.item.lParam = (LPARAM)data; - } - - tvIns.item.mask = mask; - - HTREEITEM id = (HTREEITEM) TreeView_InsertItem(GetHwnd(), &tvIns); - if ( id == 0 ) - { - wxLogLastError("TreeView_InsertItem"); - } - - if ( data != NULL ) - { - // associate the application tree item with Win32 tree item handle - data->SetId((WXHTREEITEM)id); - } - - return wxTreeItemId((WXHTREEITEM)id); -*/ - return 0; -} - -// for compatibility only -wxTreeItemId wxTreeCtrl::InsertItem(const wxTreeItemId& parent, - const wxString& text, - int image, int selImage, - long insertAfter) -{ - return DoInsertItem(parent, (WXHTREEITEM)insertAfter, text, - image, selImage, NULL); -} - -wxTreeItemId wxTreeCtrl::AddRoot(const wxString& text, - int image, int selectedImage, - wxTreeItemData *data) -{ - return DoInsertItem(wxTreeItemId((WXHTREEITEM) 0), (WXHTREEITEM) 0, - text, image, selectedImage, data); -} - -wxTreeItemId wxTreeCtrl::PrependItem(const wxTreeItemId& parent, - const wxString& text, - int image, int selectedImage, - wxTreeItemData *data) -{ -// TODO: -/* - return DoInsertItem(parent, (WXHTREEITEM) TVI_FIRST, - text, image, selectedImage, data); -*/ - return 0; -} - -wxTreeItemId wxTreeCtrl::InsertItem(const wxTreeItemId& parent, - const wxTreeItemId& idPrevious, - const wxString& text, - int image, int selectedImage, - wxTreeItemData *data) -{ - return DoInsertItem(parent, idPrevious, text, image, selectedImage, data); -} - -wxTreeItemId wxTreeCtrl::AppendItem(const wxTreeItemId& parent, - const wxString& text, - int image, int selectedImage, - wxTreeItemData *data) -{ -// TODO: -/* - return DoInsertItem(parent, (WXHTREEITEM) TVI_LAST, - text, image, selectedImage, data); -*/ - return 0; -} - -void wxTreeCtrl::Delete(const wxTreeItemId& item) -{ -// TODO: -/* - if ( !TreeView_DeleteItem(GetHwnd(), (HTREEITEM)(WXHTREEITEM)item) ) - { - wxLogLastError("TreeView_DeleteItem"); - } -*/ -} - -// delete all children (but don't delete the item itself) -void wxTreeCtrl::DeleteChildren(const wxTreeItemId& item) -{ - long cookie; - - wxArrayLong children; - wxTreeItemId child = GetFirstChild(item, cookie); - while ( child.IsOk() ) - { - children.Add((long)(WXHTREEITEM)child); - - child = GetNextChild(item, cookie); - } - - size_t nCount = children.Count(); -// TODO: -/* - for ( size_t n = 0; n < nCount; n++ ) - { - if ( !TreeView_DeleteItem(GetHwnd(), (HTREEITEM)children[n]) ) - { - wxLogLastError("TreeView_DeleteItem"); - } - } -*/ -} - -void wxTreeCtrl::DeleteAllItems() -{ -// TODO: -/* - if ( !TreeView_DeleteAllItems(GetHwnd()) ) - { - wxLogLastError("TreeView_DeleteAllItems"); - } -*/ -} - -void wxTreeCtrl::DoExpand(const wxTreeItemId& item, int flag) -{ -// TODO: -/* - wxASSERT_MSG( flag == TVE_COLLAPSE || - flag == (TVE_COLLAPSE | TVE_COLLAPSERESET) || - flag == TVE_EXPAND || - flag == TVE_TOGGLE, - wxT("Unknown flag in wxTreeCtrl::DoExpand") ); - - // TreeView_Expand doesn't send TVN_ITEMEXPAND(ING) messages, so we must - // emulate them. This behaviour has changed slightly with comctl32.dll - // v 4.70 - now it does send them but only the first time. To maintain - // compatible behaviour and also in order to not have surprises with the - // future versions, don't rely on this and still do everything ourselves. - // To avoid that the messages be sent twice when the item is expanded for - // the first time we must clear TVIS_EXPANDEDONCE style manually. - - wxTreeViewItem tvItem(item, TVIF_STATE, TVIS_EXPANDEDONCE); - tvItem.state = 0; - DoSetItem(&tvItem); - - if ( TreeView_Expand(GetHwnd(), (HTREEITEM) (WXHTREEITEM) item, flag) != 0 ) - { - wxTreeEvent event(wxEVT_NULL, m_windowId); - event.m_item = item; - - bool isExpanded = IsExpanded(item); - - event.SetEventObject(this); - - // FIXME return value of {EXPAND|COLLAPS}ING event handler is discarded - event.SetEventType(g_events[isExpanded][TRUE]); - GetEventHandler()->ProcessEvent(event); - - event.SetEventType(g_events[isExpanded][FALSE]); - GetEventHandler()->ProcessEvent(event); - } - //else: change didn't took place, so do nothing at all -*/ -} - -void wxTreeCtrl::Expand(const wxTreeItemId& item) -{ -// DoExpand(item, TVE_EXPAND); -} - -void wxTreeCtrl::Collapse(const wxTreeItemId& item) -{ -// DoExpand(item, TVE_COLLAPSE); -} - -void wxTreeCtrl::CollapseAndReset(const wxTreeItemId& item) -{ -// DoExpand(item, TVE_COLLAPSE | TVE_COLLAPSERESET); -} - -void wxTreeCtrl::Toggle(const wxTreeItemId& item) -{ -// DoExpand(item, TVE_TOGGLE); -} - -void wxTreeCtrl::ExpandItem(const wxTreeItemId& item, int action) -{ -// DoExpand(item, action); -} - -void wxTreeCtrl::Unselect() -{ - wxASSERT_MSG( !(m_windowStyle & wxTR_MULTIPLE), wxT("doesn't make sense") ); - - // just remove the selection -// SelectItem(wxTreeItemId((WXHTREEITEM) 0)); -} - -void wxTreeCtrl::UnselectAll() -{ - if ( m_windowStyle & wxTR_MULTIPLE ) - { - wxArrayTreeItemIds selections; - size_t count = GetSelections(selections); - for ( size_t n = 0; n < count; n++ ) - { - SetItemCheck(selections[n], FALSE); - } - } - else - { - // just remove the selection - Unselect(); - } -} - -void wxTreeCtrl::SelectItem(const wxTreeItemId& item) -{ - if ( m_windowStyle & wxTR_MULTIPLE ) - { - // selecting the item means checking it - SetItemCheck(item); - } - else - { - // inspite of the docs (MSDN Jan 99 edition), we don't seem to receive - // the notification from the control (i.e. TVN_SELCHANG{ED|ING}), so - // send them ourselves - - wxTreeEvent event(wxEVT_NULL, m_windowId); - event.m_item = item; - event.SetEventObject(this); - - event.SetEventType(wxEVT_COMMAND_TREE_SEL_CHANGING); -// TODO: -/* - if ( !GetEventHandler()->ProcessEvent(event) || event.IsAllowed() ) - { - if ( !TreeView_SelectItem(GetHwnd(), (HTREEITEM) (WXHTREEITEM) item) ) - { - wxLogLastError("TreeView_SelectItem"); - } - else - { - event.SetEventType(wxEVT_COMMAND_TREE_SEL_CHANGED); - (void)GetEventHandler()->ProcessEvent(event); - } - } - //else: program vetoed the change -*/ - } -} - -void wxTreeCtrl::EnsureVisible(const wxTreeItemId& item) -{ - // no error return -// TreeView_EnsureVisible(GetHwnd(), (HTREEITEM) (WXHTREEITEM) item); -} - -void wxTreeCtrl::ScrollTo(const wxTreeItemId& item) -{ -// TODO: -/* - if ( !TreeView_SelectSetFirstVisible(GetHwnd(), (HTREEITEM) (WXHTREEITEM) item) ) - { - wxLogLastError("TreeView_SelectSetFirstVisible"); - } -*/ -} - -wxTextCtrl* wxTreeCtrl::GetEditControl() const -{ - return m_textCtrl; -} - -void wxTreeCtrl::DeleteTextCtrl() -{ - if ( m_textCtrl ) - { - m_textCtrl->UnsubclassWin(); - m_textCtrl->SetHWND(0); - delete m_textCtrl; - m_textCtrl = NULL; - } -} - -wxTextCtrl* wxTreeCtrl::EditLabel(const wxTreeItemId& item, - wxClassInfo* textControlClass) -{ - wxASSERT( textControlClass->IsKindOf(CLASSINFO(wxTextCtrl)) ); - -// TODO: -/* - HWND hWnd = (HWND) TreeView_EditLabel(GetHwnd(), (HTREEITEM) (WXHTREEITEM) item); - - // this is not an error - the TVN_BEGINLABELEDIT handler might have - // returned FALSE - if ( !hWnd ) - { - return NULL; - } - - DeleteTextCtrl(); - - m_textCtrl = (wxTextCtrl *)textControlClass->CreateObject(); - m_textCtrl->SetHWND((WXHWND)hWnd); - m_textCtrl->SubclassWin((WXHWND)hWnd); -*/ - return m_textCtrl; -} - -// End label editing, optionally cancelling the edit -void wxTreeCtrl::EndEditLabel(const wxTreeItemId& item, bool discardChanges) -{ -// TreeView_EndEditLabelNow(GetHwnd(), discardChanges); - - DeleteTextCtrl(); -} - -wxTreeItemId wxTreeCtrl::HitTest(const wxPoint& point, int& flags) -{ -// TODO: -/* - TV_HITTESTINFO hitTestInfo; - hitTestInfo.pt.x = (int)point.x; - hitTestInfo.pt.y = (int)point.y; - - TreeView_HitTest(GetHwnd(), &hitTestInfo); - - flags = 0; - - // avoid repetition - #define TRANSLATE_FLAG(flag) if ( hitTestInfo.flags & TVHT_##flag ) \ - flags |= wxTREE_HITTEST_##flag - - TRANSLATE_FLAG(ABOVE); - TRANSLATE_FLAG(BELOW); - TRANSLATE_FLAG(NOWHERE); - TRANSLATE_FLAG(ONITEMBUTTON); - TRANSLATE_FLAG(ONITEMICON); - TRANSLATE_FLAG(ONITEMINDENT); - TRANSLATE_FLAG(ONITEMLABEL); - TRANSLATE_FLAG(ONITEMRIGHT); - TRANSLATE_FLAG(ONITEMSTATEICON); - TRANSLATE_FLAG(TOLEFT); - TRANSLATE_FLAG(TORIGHT); - - #undef TRANSLATE_FLAG - - return wxTreeItemId((WXHTREEITEM) hitTestInfo.hItem); -*/ - return 0; -} - -bool wxTreeCtrl::GetBoundingRect(const wxTreeItemId& item, - wxRect& rect, - bool textOnly) const -{ -// TODO: -/* - RECT rc; - if ( TreeView_GetItemRect(GetHwnd(), (HTREEITEM)(WXHTREEITEM)item, - &rc, textOnly) ) - { - rect = wxRect(wxPoint(rc.left, rc.top), wxPoint(rc.right, rc.bottom)); - - return TRUE; - } - else - { - // couldn't retrieve rect: for example, item isn't visible - return FALSE; - } -*/ - return FALSE; -} - -// ---------------------------------------------------------------------------- -// sorting stuff -// ---------------------------------------------------------------------------- - -static int TreeView_CompareCallback(wxTreeItemData *pItem1, - wxTreeItemData *pItem2, - wxTreeCtrl *tree) -{ - wxCHECK_MSG( pItem1 && pItem2, 0, - wxT("sorting tree without data doesn't make sense") ); - - return tree->OnCompareItems(pItem1->GetId(), pItem2->GetId()); -} - -int wxTreeCtrl::OnCompareItems(const wxTreeItemId& item1, - const wxTreeItemId& item2) -{ - return wxStrcmp(GetItemText(item1), GetItemText(item2)); -} - -void wxTreeCtrl::SortChildren(const wxTreeItemId& item) -{ - // rely on the fact that TreeView_SortChildren does the same thing as our - // default behaviour, i.e. sorts items alphabetically and so call it - // directly if we're not in derived class (much more efficient!) -// TODO: -/* - if ( GetClassInfo() == CLASSINFO(wxTreeCtrl) ) - { - TreeView_SortChildren(GetHwnd(), (HTREEITEM)(WXHTREEITEM)item, 0); - } - else - { - TV_SORTCB tvSort; - tvSort.hParent = (HTREEITEM)(WXHTREEITEM)item; - tvSort.lpfnCompare = (PFNTVCOMPARE)TreeView_CompareCallback; - tvSort.lParam = (LPARAM)this; - TreeView_SortChildrenCB(GetHwnd(), &tvSort, 0); - } -*/ -} - -// ---------------------------------------------------------------------------- -// implementation -// ---------------------------------------------------------------------------- - -bool wxTreeCtrl::OS2Command(WXUINT cmd, WXWORD id) -{ -// TODO: -/* - if ( cmd == EN_UPDATE ) - { - wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, id); - event.SetEventObject( this ); - ProcessCommand(event); - } - else if ( cmd == EN_KILLFOCUS ) - { - wxCommandEvent event(wxEVT_KILL_FOCUS, id); - event.SetEventObject( this ); - ProcessCommand(event); - } - else - { - // nothing done - return FALSE; - } - - // command processed - return TRUE; -*/ - return FALSE; -} - -// process WM_NOTIFY Windows message -bool wxTreeCtrl::OS2OnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) -{ -// TODO: -/* - wxTreeEvent event(wxEVT_NULL, m_windowId); - wxEventType eventType = wxEVT_NULL; - NMHDR *hdr = (NMHDR *)lParam; - - switch ( hdr->code ) - { - case NM_RCLICK: - { - if ( wxControl::MSWOnNotify(idCtrl, lParam, result) ) - return TRUE; - - TV_HITTESTINFO tvhti; - ::GetCursorPos(&(tvhti.pt)); - ::ScreenToClient(GetHwnd(),&(tvhti.pt)); - if ( TreeView_HitTest(GetHwnd(),&tvhti) ) - { - if( tvhti.flags & TVHT_ONITEM ) - { - event.m_item = (WXHTREEITEM) tvhti.hItem; - eventType=wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK; - } - } - break; - } - - case TVN_BEGINDRAG: - eventType = wxEVT_COMMAND_TREE_BEGIN_DRAG; - // fall through - - case TVN_BEGINRDRAG: - { - if ( eventType == wxEVT_NULL ) - eventType = wxEVT_COMMAND_TREE_BEGIN_RDRAG; - //else: left drag, already set above - - NM_TREEVIEW *tv = (NM_TREEVIEW *)lParam; - - event.m_item = (WXHTREEITEM) tv->itemNew.hItem; - event.m_pointDrag = wxPoint(tv->ptDrag.x, tv->ptDrag.y); - break; - } - - case TVN_BEGINLABELEDIT: - { - eventType = wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT; - TV_DISPINFO *info = (TV_DISPINFO *)lParam; - - event.m_item = (WXHTREEITEM) info->item.hItem; - event.m_label = info->item.pszText; - break; - } - - case TVN_DELETEITEM: - { - eventType = wxEVT_COMMAND_TREE_DELETE_ITEM; - NM_TREEVIEW *tv = (NM_TREEVIEW *)lParam; - - event.m_item = (WXHTREEITEM) tv->itemOld.hItem; - break; - } - - case TVN_ENDLABELEDIT: - { - eventType = wxEVT_COMMAND_TREE_END_LABEL_EDIT; - TV_DISPINFO *info = (TV_DISPINFO *)lParam; - - event.m_item = (WXHTREEITEM)info->item.hItem; - event.m_label = info->item.pszText; - break; - } - - case TVN_GETDISPINFO: - eventType = wxEVT_COMMAND_TREE_GET_INFO; - // fall through - - case TVN_SETDISPINFO: - { - if ( eventType == wxEVT_NULL ) - eventType = wxEVT_COMMAND_TREE_SET_INFO; - //else: get, already set above - - TV_DISPINFO *info = (TV_DISPINFO *)lParam; - - event.m_item = (WXHTREEITEM) info->item.hItem; - break; - } - - case TVN_ITEMEXPANDING: - event.m_code = FALSE; - // fall through - - case TVN_ITEMEXPANDED: - { - NM_TREEVIEW* tv = (NM_TREEVIEW*)lParam; - - bool expand = FALSE; - switch ( tv->action ) - { - case TVE_EXPAND: - expand = TRUE; - break; - - case TVE_COLLAPSE: - expand = FALSE; - break; - - default: - wxLogDebug(wxT("unexpected code %d in TVN_ITEMEXPAND " - "message"), tv->action); - } - - bool ing = ((int)hdr->code == TVN_ITEMEXPANDING); - eventType = g_events[expand][ing]; - - event.m_item = (WXHTREEITEM) tv->itemNew.hItem; - break; - } - - case TVN_KEYDOWN: - { - eventType = wxEVT_COMMAND_TREE_KEY_DOWN; - TV_KEYDOWN *info = (TV_KEYDOWN *)lParam; - - event.m_code = wxCharCodeMSWToWX(info->wVKey); - - // a separate event for this case - if ( info->wVKey == VK_SPACE || info->wVKey == VK_RETURN ) - { - wxTreeEvent event2(wxEVT_COMMAND_TREE_ITEM_ACTIVATED, - m_windowId); - event2.SetEventObject(this); - - GetEventHandler()->ProcessEvent(event2); - } - break; - } - - case TVN_SELCHANGED: - eventType = wxEVT_COMMAND_TREE_SEL_CHANGED; - // fall through - - case TVN_SELCHANGING: - { - if ( eventType == wxEVT_NULL ) - eventType = wxEVT_COMMAND_TREE_SEL_CHANGING; - //else: already set above - - NM_TREEVIEW* tv = (NM_TREEVIEW *)lParam; - - event.m_item = (WXHTREEITEM) tv->itemNew.hItem; - event.m_itemOld = (WXHTREEITEM) tv->itemOld.hItem; - break; - } - - default: - return wxControl::MSWOnNotify(idCtrl, lParam, result); - } - - event.SetEventObject(this); - event.SetEventType(eventType); - - bool processed = GetEventHandler()->ProcessEvent(event); - - // post processing - switch ( hdr->code ) - { - case TVN_DELETEITEM: - { - // NB: we might process this message using wxWindows event - // tables, but due to overhead of wxWin event system we - // prefer to do it here ourself (otherwise deleting a tree - // with many items is just too slow) - NM_TREEVIEW* tv = (NM_TREEVIEW *)lParam; - - wxTreeItemId item = event.m_item; - if ( HasIndirectData(item) ) - { - wxTreeItemIndirectData *data = (wxTreeItemIndirectData *) - tv->itemOld.lParam; - delete data; // can't be NULL here - - m_itemsWithIndirectData.Remove(item); - } - else - { - wxTreeItemData *data = (wxTreeItemData *)tv->itemOld.lParam; - delete data; // may be NULL, ok - } - - processed = TRUE; // Make sure we don't get called twice - } - break; - - case TVN_BEGINLABELEDIT: - // return TRUE to cancel label editing - *result = !event.IsAllowed(); - break; - - case TVN_ENDLABELEDIT: - // return TRUE to set the label to the new string - *result = event.IsAllowed(); - - // ensure that we don't have the text ctrl which is going to be - // deleted any more - DeleteTextCtrl(); - break; - - case TVN_SELCHANGING: - case TVN_ITEMEXPANDING: - // return TRUE to prevent the action from happening - *result = !event.IsAllowed(); - break; - - case TVN_GETDISPINFO: - // NB: so far the user can't set the image himself anyhow, so do it - // anyway - but this may change later - if ( 1 // !processed && ) - { - wxTreeItemId item = event.m_item; - TV_DISPINFO *info = (TV_DISPINFO *)lParam; - if ( info->item.mask & TVIF_IMAGE ) - { - info->item.iImage = - DoGetItemImageFromData - ( - item, - IsExpanded(item) ? wxTreeItemIcon_Expanded - : wxTreeItemIcon_Normal - ); - } - if ( info->item.mask & TVIF_SELECTEDIMAGE ) - { - info->item.iSelectedImage = - DoGetItemImageFromData - ( - item, - IsExpanded(item) ? wxTreeItemIcon_SelectedExpanded - : wxTreeItemIcon_Selected - ); - } - } - break; - - //default: - // for the other messages the return value is ignored and there is - // nothing special to do - } - - return processed; -*/ - return FALSE; -} - -// ---------------------------------------------------------------------------- -// Tree event -// ---------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxTreeEvent, wxNotifyEvent) - -wxTreeEvent::wxTreeEvent(wxEventType commandType, int id) - : wxNotifyEvent(commandType, id) -{ - m_code = 0; - m_itemOld = 0; -} - diff --git a/src/os2/utils.cpp b/src/os2/utils.cpp index e9ace42626..7dbe03de3d 100644 --- a/src/os2/utils.cpp +++ b/src/os2/utils.cpp @@ -70,13 +70,13 @@ bool wxGetHostName( unsigned long ulBuffer; unsigned long* pulTotalAvail; - NetBios32GetInfo( (const unsigned char*)zServer - ,(const unsigned char*)zComputer - ,ulLevel - ,zBuffer - ,ulBuffer - ,pulTotalAvail - ); + NetBiosGetInfo( (const unsigned char*)zServer + ,(const unsigned char*)zComputer + ,ulLevel + ,zBuffer + ,ulBuffer + ,pulTotalAvail + ); strcpy(zBuf, zServer); #else wxChar* zSysname; diff --git a/src/png/png.h b/src/png/png.h index b48e1507e7..4314ac7751 100644 --- a/src/png/png.h +++ b/src/png/png.h @@ -8,29 +8,29 @@ * * Y2K compliance in libpng: * ========================= - * + * * January 13, 1999 - * + * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. - * + * * This is your unofficial assurance that libpng from version 0.81 and * upward are Y2K compliant. It is my belief that earlier versions were * also Y2K compliant. - * + * * Libpng only has three year fields. One is a 2-byte unsigned integer * that will hold years up to 65535. The other two hold the date in text * format, and will hold years up to 9999. - * + * * The integer is * "png_uint_16 year" in png_time_struct. - * + * * The strings are * "png_charp time_buffer" in png_struct and * "near_time_buffer", which is a local character string in png.c. - * + * * There are seven time-related functions: - * png.c: png_convert_to_rfc_1123() in png.c + * png.c: png_convert_to_rfc_1123() in png.c * (formerly png_convert_to_rfc_1152() in error) * png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c * png_convert_from_time_t() in pngwrite.c @@ -38,8 +38,8 @@ * png_handle_tIME() in pngrutil.c, called in pngread.c * png_set_tIME() in pngset.c * png_write_tIME() in pngwutil.c, called in pngwrite.c - * - * All handle dates properly in a Y2K environment. The + * + * All handle dates properly in a Y2K environment. The * png_convert_from_time_t() function calls gmtime() to convert from system * clock time, which returns (year - 1900), which we properly convert to * the full 4-digit year. There is a possibility that applications using @@ -49,17 +49,17 @@ * is not under our control. The libpng documentation has always stated * that it works with 4-digit years, and the APIs have been documented as * such. - * + * * The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned * integer to hold the year, and can hold years as large as 65535. - * - * + * + * * Glenn Randers-Pehrson * libpng maintainer * PNG Development Group - * + * * Note about libpng version numbers: - * + * * Due to various miscommunications, unforeseen code incompatibilities * and occasional factors outside the authors' control, version numbering * on the library has not always been consistent and straightforward. diff --git a/src/png/pngrio.c b/src/png/pngrio.c index 23bbb2b660..2af0e8954b 100644 --- a/src/png/pngrio.c +++ b/src/png/pngrio.c @@ -39,8 +39,13 @@ png_read_data(png_structp png_ptr, png_bytep data, png_size_t length) read_data function and use it at run time with png_set_read_fn(), rather than changing the library. */ #ifndef USE_FAR_KEYWORD +#ifdef __VISAGECPP__ +static void _Optlink +png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length) +#else static void png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length) +#endif { png_size_t check; diff --git a/src/png/pngwio.c b/src/png/pngwio.c index 84b5b2869d..05fe6dd96b 100644 --- a/src/png/pngwio.c +++ b/src/png/pngwio.c @@ -39,8 +39,13 @@ png_write_data(png_structp png_ptr, png_bytep data, png_size_t length) write_data function and use it at run time with png_set_write_fn(), rather than changing the library. */ #ifndef USE_FAR_KEYWORD +#ifdef __VISAGECPP__ +static void _Optlink +png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length) +#else static void png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length) +#endif { png_uint_32 check; @@ -59,8 +64,13 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length) #define NEAR_BUF_SIZE 1024 #define MIN(a,b) (a <= b ? a : b) +#ifdef __VISAGECPP__ +static void _Optlink +png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length) +#else static void png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length) +#endif { png_uint_32 check; png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */ @@ -114,8 +124,13 @@ png_flush(png_structp png_ptr) } #if !defined(PNG_NO_STDIO) +#ifdef __VISAGECPP__ +static void _Optlink +png_default_flush(png_structp png_ptr) +#else static void png_default_flush(png_structp png_ptr) +#endif { FILE *io_ptr; io_ptr = (FILE *)CVT_PTR((png_ptr->io_ptr)); diff --git a/src/zlib/adler32.c b/src/zlib/adler32.c index ef4b2ebdc8..594117a983 100644 --- a/src/zlib/adler32.c +++ b/src/zlib/adler32.c @@ -1,6 +1,6 @@ /* adler32.c -- compute the Adler-32 checksum of a data stream * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ @@ -18,10 +18,14 @@ #define DO16(buf) DO8(buf,0); DO8(buf,8); /* ========================================================================= */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +uLong ZEXPORT adler32 (uLong adler, const Bytef* buf, uInt len) +#else uLong ZEXPORT adler32(adler, buf, len) uLong adler; const Bytef *buf; uInt len; +#endif { unsigned long s1 = adler & 0xffff; unsigned long s2 = (adler >> 16) & 0xffff; diff --git a/src/zlib/compress.c b/src/zlib/compress.c index 51761b105e..87c87c239c 100644 --- a/src/zlib/compress.c +++ b/src/zlib/compress.c @@ -1,6 +1,6 @@ /* compress.c -- compress a memory buffer * Copyright (C) 1995-1998 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ @@ -18,12 +18,16 @@ memory, Z_BUF_ERROR if there was not enough room in the output buffer, Z_STREAM_ERROR if the level parameter is invalid. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT compress2 (Bytef* dest, uLongf* destLen, const Bytef* source, uLong sourceLen, int level) +#else int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) Bytef *dest; uLongf *destLen; const Bytef *source; uLong sourceLen; int level; +#endif { z_stream stream; int err; @@ -58,11 +62,15 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) /* =========================================================================== */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT compress (Bytef* dest, uLongf* destLen, const Bytef* source, uLong sourceLen) +#else int ZEXPORT compress (dest, destLen, source, sourceLen) Bytef *dest; uLongf *destLen; const Bytef *source; uLong sourceLen; +#endif { return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); } diff --git a/src/zlib/crc32.c b/src/zlib/crc32.c index 52d9cb1f44..f607e6d3ae 100644 --- a/src/zlib/crc32.c +++ b/src/zlib/crc32.c @@ -1,6 +1,6 @@ /* crc32.c -- compute the CRC-32 of a data stream * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ @@ -51,7 +51,7 @@ local void make_crc_table() poly = 0L; for (n = 0; n < sizeof(p)/sizeof(Byte); n++) poly |= 1L << (31 - p[n]); - + for (n = 0; n < 256; n++) { c = (uLong)n; @@ -139,10 +139,14 @@ const uLongf * ZEXPORT get_crc_table() #define DO8(buf) DO4(buf); DO4(buf); /* ========================================================================= */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +uLong ZEXPORT crc32(uLong crc, const Bytef* buf, uInt len) +#else uLong ZEXPORT crc32(crc, buf, len) uLong crc; const Bytef *buf; uInt len; +#endif { if (buf == Z_NULL) return 0L; #ifdef DYNAMIC_CRC_TABLE diff --git a/src/zlib/deflate.c b/src/zlib/deflate.c index 7fb81af14e..d3d5558b1f 100644 --- a/src/zlib/deflate.c +++ b/src/zlib/deflate.c @@ -1,6 +1,6 @@ /* deflate.c -- compress data using the deflation algorithm * Copyright (C) 1995-1998 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* @@ -187,11 +187,15 @@ struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); /* ========================================================================= */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT deflateInit_(z_streamp strm, int level, const char* version, int stream_size) +#else int ZEXPORT deflateInit_(strm, level, version, stream_size) z_streamp strm; int level; const char *version; int stream_size; +#endif { return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, version, stream_size); @@ -199,6 +203,10 @@ int ZEXPORT deflateInit_(strm, level, version, stream_size) } /* ========================================================================= */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT deflateInit2_(z_streamp strm, int level, int method, int windowBits, + int memLevel, int strategy, const char* version, int stream_size) +#else int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, version, stream_size) z_streamp strm; @@ -209,6 +217,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, int strategy; const char *version; int stream_size; +#endif { deflate_state *s; int noheader = 0; @@ -288,10 +297,14 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, } /* ========================================================================= */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT deflateSetDictionary (z_streamp strm, const Bytef* dictionary, uInt dictLength) +#else int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) z_streamp strm; const Bytef *dictionary; uInt dictLength; +#endif { deflate_state *s; uInt length = dictLength; @@ -329,11 +342,15 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) } /* ========================================================================= */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT deflateReset (z_streamp strm) +#else int ZEXPORT deflateReset (strm) z_streamp strm; +#endif { deflate_state *s; - + if (strm == Z_NULL || strm->state == Z_NULL || strm->zalloc == Z_NULL || strm->zfree == Z_NULL) return Z_STREAM_ERROR; @@ -359,10 +376,14 @@ int ZEXPORT deflateReset (strm) } /* ========================================================================= */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT deflateParams(z_streamp strm, int level, int strategy) +#else int ZEXPORT deflateParams(strm, level, strategy) z_streamp strm; int level; int strategy; +#endif { deflate_state *s; compress_func func; @@ -399,13 +420,17 @@ int ZEXPORT deflateParams(strm, level, strategy) * IN assertion: the stream state is correct and there is enough room in * pending_buf. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local void putShortMSB (deflate_state* s, uInt b) +#else local void putShortMSB (s, b) deflate_state *s; uInt b; +#endif { put_byte(s, (Byte)(b >> 8)); put_byte(s, (Byte)(b & 0xff)); -} +} /* ========================================================================= * Flush as much pending output as possible. All deflate() output goes @@ -413,8 +438,12 @@ local void putShortMSB (s, b) * to avoid allocating a large strm->next_out buffer and copying into it. * (See also read_buf()). */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local void flush_pending(z_streamp strm) +#else local void flush_pending(strm) z_streamp strm; +#endif { unsigned len = strm->state->pending; @@ -433,9 +462,13 @@ local void flush_pending(strm) } /* ========================================================================= */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT deflate (z_streamp strm, int flush) +#else int ZEXPORT deflate (strm, flush) z_streamp strm; int flush; +#endif { int old_flush; /* value of flush param for previous deflate call */ deflate_state *s; @@ -567,8 +600,12 @@ int ZEXPORT deflate (strm, flush) } /* ========================================================================= */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT deflateEnd (z_streamp strm) +#else int ZEXPORT deflateEnd (strm) z_streamp strm; +#endif { int status; @@ -597,9 +634,13 @@ int ZEXPORT deflateEnd (strm) * To simplify the source, this is not supported for 16-bit MSDOS (which * doesn't have enough memory anyway to duplicate compression states). */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT deflateCopy (z_streamp dest, z_streamp source) +#else int ZEXPORT deflateCopy (dest, source) z_streamp dest; z_streamp source; +#endif { #ifdef MAXSEG_64K return Z_STREAM_ERROR; @@ -657,10 +698,14 @@ int ZEXPORT deflateCopy (dest, source) * allocating a large strm->next_in buffer and copying from it. * (See also flush_pending()). */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local int read_buf(z_streamp strm, Bytef* buf, unsigned size) +#else local int read_buf(strm, buf, size) z_streamp strm; Bytef *buf; unsigned size; +#endif { unsigned len = strm->avail_in; @@ -682,8 +727,12 @@ local int read_buf(strm, buf, size) /* =========================================================================== * Initialize the "longest match" routines for a new zlib stream */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local void lm_init (deflate_state* s) +#else local void lm_init (s) deflate_state *s; +#endif { s->window_size = (ulg)2L*s->w_size; @@ -721,9 +770,13 @@ local void lm_init (s) * match.S. The code will be functionally equivalent. */ #ifndef FASTEST +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local uInt longest_match(deflate_state* s, IPos cur_match) +#else local uInt longest_match(s, cur_match) deflate_state *s; IPos cur_match; /* current match */ +#endif { unsigned chain_length = s->max_chain_length;/* max hash chain length */ register Bytef *scan = s->window + s->strstart; /* current string */ @@ -863,9 +916,13 @@ local uInt longest_match(s, cur_match) /* --------------------------------------------------------------------------- * Optimized version for level == 1 only */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local uInt longest_match(deflate_state* s, IPos cur_match) +#else local uInt longest_match(s, cur_match) deflate_state *s; IPos cur_match; /* current match */ +#endif { register Bytef *scan = s->window + s->strstart; /* current string */ register Bytef *match; /* matched string */ @@ -922,10 +979,14 @@ local uInt longest_match(s, cur_match) /* =========================================================================== * Check that the match at match_start is indeed a match. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local void check_match(deflate_state* s, IPos start, IPos match, int length) +#else local void check_match(s, start, match, length) deflate_state *s; IPos start, match; int length; +#endif { /* check that the match is indeed a match */ if (zmemcmp(s->window + match, @@ -956,8 +1017,12 @@ local void check_match(s, start, match, length) * performed for at least two bytes (required for the zip translate_eol * option -- not supported here). */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local void fill_window(deflate_state* s) +#else local void fill_window(s) deflate_state *s; +#endif { register unsigned n, m; register Posf *p; @@ -1076,9 +1141,13 @@ local void fill_window(s) * NOTE: this function should be optimized to avoid extra copying from * window to pending_buf. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local block_state deflate_stored(deflate_state* s, int flush) +#else local block_state deflate_stored(s, flush) deflate_state *s; int flush; +#endif { /* Stored blocks are limited to 0xffff bytes, pending_buf is limited * to pending_buf_size, and each stored block has a 5 byte header: @@ -1134,9 +1203,13 @@ local block_state deflate_stored(s, flush) * new strings in the dictionary only for unmatched strings or for short * matches. It is used only for the fast compression options. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local block_state deflate_fast(deflate_state* s, int flush) +#else local block_state deflate_fast(s, flush) deflate_state *s; int flush; +#endif { IPos hash_head = NIL; /* head of the hash chain */ int bflush; /* set if current block must be flushed */ @@ -1197,7 +1270,7 @@ local block_state deflate_fast(s, flush) * always MIN_MATCH bytes ahead. */ } while (--s->match_length != 0); - s->strstart++; + s->strstart++; } else #endif { @@ -1217,7 +1290,7 @@ local block_state deflate_fast(s, flush) Tracevv((stderr,"%c", s->window[s->strstart])); _tr_tally_lit (s, s->window[s->strstart], bflush); s->lookahead--; - s->strstart++; + s->strstart++; } if (bflush) FLUSH_BLOCK(s, 0); } @@ -1230,9 +1303,13 @@ local block_state deflate_fast(s, flush) * evaluation for matches: a match is finally adopted only if there is * no better match at the next window position. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local block_state deflate_slow(deflate_state* s, int flush) +#else local block_state deflate_slow(s, flush) deflate_state *s; int flush; +#endif { IPos hash_head = NIL; /* head of hash chain */ int bflush; /* set if current block must be flushed */ diff --git a/src/zlib/gzio.c b/src/zlib/gzio.c index e29198ac7a..868d218844 100644 --- a/src/zlib/gzio.c +++ b/src/zlib/gzio.c @@ -70,10 +70,14 @@ local uLong getLong OF((gz_stream *s)); can be checked to distinguish the two cases (if errno is zero, the zlib error is Z_MEM_ERROR). */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local gzFile gz_open (const char* path, const char* mode, int fd) +#else local gzFile gz_open (path, mode, fd) const char *path; const char *mode; int fd; +#endif { int err; int level = Z_DEFAULT_COMPRESSION; /* compression level */ @@ -122,7 +126,7 @@ local gzFile gz_open (path, mode, fd) } } while (*p++ && m != fmode + sizeof(fmode)); if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL; - + if (s->mode == 'w') { #ifdef NO_DEFLATE err = Z_STREAM_ERROR; @@ -173,16 +177,20 @@ local gzFile gz_open (path, mode, fd) check_header(s); /* skip the .gz header */ s->startpos = (ftell(s->file) - s->stream.avail_in); } - + return (gzFile)s; } /* =========================================================================== Opens a gzip (.gz) file for reading or writing. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +gzFile ZEXPORT gzopen (const char* path, const char* mode) +#else gzFile ZEXPORT gzopen (path, mode) const char *path; const char *mode; +#endif { return gz_open (path, mode, -1); } @@ -191,9 +199,13 @@ gzFile ZEXPORT gzopen (path, mode) Associate a gzFile with the file descriptor fd. fd is not dup'ed here to mimic the behavio(u)r of fdopen. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +gzFile ZEXPORT gzdopen (int fd, const char* mode) +#else gzFile ZEXPORT gzdopen (fd, mode) int fd; const char *mode; +#endif { char name[20]; @@ -206,10 +218,14 @@ gzFile ZEXPORT gzdopen (fd, mode) /* =========================================================================== * Update the compression level and strategy */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT gzsetparams (gzFile file, int level, int strategy) +#else int ZEXPORT gzsetparams (file, level, strategy) gzFile file; int level; int strategy; +#endif { gz_stream *s = (gz_stream*)file; @@ -233,8 +249,12 @@ int ZEXPORT gzsetparams (file, level, strategy) for end of file. IN assertion: the stream s has been sucessfully opened for reading. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local int get_byte(gz_stream* s) +#else local int get_byte(s) gz_stream *s; +#endif { if (s->z_eof) return EOF; if (s->stream.avail_in == 0) { @@ -260,8 +280,12 @@ local int get_byte(s) s->stream.avail_in is zero for the first time, but may be non-zero for concatenated .gz files. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local void check_header(gz_stream* s) +#else local void check_header(s) gz_stream *s; +#endif { int method; /* method byte */ int flags; /* flags byte */ @@ -313,8 +337,12 @@ local void check_header(s) * Cleanup then free the given gz_stream. Return a zlib error code. Try freeing in the reverse order of allocations. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local int destroy (gz_stream* s) +#else local int destroy (s) gz_stream *s; +#endif { int err = Z_OK; @@ -352,10 +380,14 @@ local int destroy (s) Reads the given number of uncompressed bytes from the compressed file. gzread returns the number of bytes actually read (0 for end of file). */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT gzread (gzFile file, voidp buf, unsigned len) +#else int ZEXPORT gzread (file, buf, len) gzFile file; voidp buf; unsigned len; +#endif { gz_stream *s = (gz_stream*)file; Bytef *start = (Bytef*)buf; /* starting point for crc computation */ @@ -442,8 +474,12 @@ int ZEXPORT gzread (file, buf, len) Reads one byte from the compressed file. gzgetc returns this byte or -1 in case of end of file or error. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT gzgetc(gzFile file) +#else int ZEXPORT gzgetc(file) gzFile file; +#endif { unsigned char c; @@ -460,10 +496,14 @@ int ZEXPORT gzgetc(file) The current implementation is not optimized at all. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +char* ZEXPORT gzgets(gzFile file, char* buf, int len) +#else char * ZEXPORT gzgets(file, buf, len) gzFile file; char *buf; int len; +#endif { char *b = buf; if (buf == Z_NULL || len <= 0) return Z_NULL; @@ -479,10 +519,14 @@ char * ZEXPORT gzgets(file, buf, len) Writes the given number of uncompressed bytes into the compressed file. gzwrite returns the number of bytes actually written (0 in case of error). */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT gzwrite (gzFile file, const voidp buf, unsigned len) +#else int ZEXPORT gzwrite (file, buf, len) gzFile file; const voidp buf; unsigned len; +#endif { gz_stream *s = (gz_stream*)file; @@ -538,12 +582,18 @@ int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...) } #else /* not ANSI C */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORTVA gzprintf (gzFile file const char* format, int a1, int a2, int a3, int a4, + int a5, int a6, int a7, int a8, int a9, int a10, int a11, int a12 + int a13, int a14, int a15, int a16, int a17, int a18, int a19, int a20) +#else int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) gzFile file; const char *format; int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; +#endif { char buf[Z_PRINTF_BUFSIZE]; int len; @@ -566,9 +616,13 @@ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, Writes c, converted to an unsigned char, into the compressed file. gzputc returns the value that was written, or -1 in case of error. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT gzputc(gzFile file, int c) +#else int ZEXPORT gzputc(file, c) gzFile file; int c; +#endif { unsigned char cc = (unsigned char) c; /* required for big endian systems */ @@ -581,9 +635,13 @@ int ZEXPORT gzputc(file, c) the terminating null character. gzputs returns the number of characters written, or -1 in case of error. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT gzputs(gzFile file, const char* s) +#else int ZEXPORT gzputs(file, s) gzFile file; const char *s; +#endif { return gzwrite(file, (char*)s, (unsigned)strlen(s)); } @@ -593,9 +651,13 @@ int ZEXPORT gzputs(file, s) Flushes all pending output into the compressed file. The parameter flush is as in the deflate() function. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local int do_flush (gzFile file, int flush) +#else local int do_flush (file, flush) gzFile file; int flush; +#endif { uInt len; int done = 0; @@ -623,18 +685,22 @@ local int do_flush (file, flush) if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK; /* deflate has finished flushing only when it hasn't used up - * all the available space in the output buffer: + * all the available space in the output buffer: */ done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END); - + if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break; } return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; } +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT gzflush (gzFile file, int flush) +#else int ZEXPORT gzflush (file, flush) gzFile file; int flush; +#endif { gz_stream *s = (gz_stream*)file; int err = do_flush (file, flush); @@ -653,10 +719,14 @@ int ZEXPORT gzflush (file, flush) SEEK_END is not implemented, returns error. In this version of the library, gzseek can be extremely slow. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +z_off_t ZEXPORT gzseek (gzFile file, z_off_t offset, int whence) +#else z_off_t ZEXPORT gzseek (file, offset, whence) gzFile file; z_off_t offset; int whence; +#endif { gz_stream *s = (gz_stream*)file; @@ -664,7 +734,7 @@ z_off_t ZEXPORT gzseek (file, offset, whence) s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) { return -1L; } - + if (s->mode == 'w') { #ifdef NO_DEFLATE return -1L; @@ -732,13 +802,17 @@ z_off_t ZEXPORT gzseek (file, offset, whence) } /* =========================================================================== - Rewinds input file. + Rewinds input file. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT gzrewind (gzFile file) +#else int ZEXPORT gzrewind (file) gzFile file; +#endif { gz_stream *s = (gz_stream*)file; - + if (s == NULL || s->mode != 'r') return -1; s->z_err = Z_OK; @@ -760,8 +834,12 @@ int ZEXPORT gzrewind (file) given compressed file. This position represents a number of bytes in the uncompressed data stream. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +z_off_t ZEXPORT gztell (gzFile file) +#else z_off_t ZEXPORT gztell (file) gzFile file; +#endif { return gzseek(file, 0L, SEEK_CUR); } @@ -770,20 +848,28 @@ z_off_t ZEXPORT gztell (file) Returns 1 when EOF has previously been detected reading the given input stream, otherwise zero. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT gzeof (gzFile file) +#else int ZEXPORT gzeof (file) gzFile file; +#endif { gz_stream *s = (gz_stream*)file; - + return (s == NULL || s->mode != 'r') ? 0 : s->z_eof; } /* =========================================================================== Outputs a long in LSB order to the given file */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local void putLong (FILE* file, uLong x) +#else local void putLong (file, x) FILE *file; uLong x; +#endif { int n; for (n = 0; n < 4; n++) { @@ -793,10 +879,14 @@ local void putLong (file, x) } /* =========================================================================== - Reads a long in LSB order from the given gz_stream. Sets + Reads a long in LSB order from the given gz_stream. Sets */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local uLong getLong (gz_stream* s) +#else local uLong getLong (s) gz_stream *s; +#endif { uLong x = (uLong)get_byte(s); int c; @@ -813,8 +903,12 @@ local uLong getLong (s) Flushes all pending output if necessary, closes the compressed file and deallocates all the (de)compression state. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT gzclose (gzFile file) +#else int ZEXPORT gzclose (file) gzFile file; +#endif { int err; gz_stream *s = (gz_stream*)file; @@ -842,9 +936,13 @@ int ZEXPORT gzclose (file) errnum is set to Z_ERRNO and the application may consult errno to get the exact error code. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +const char* ZEXPORT gzerror (gzFile file, int* errnum) +#else const char* ZEXPORT gzerror (file, errnum) gzFile file; int *errnum; +#endif { char *m; gz_stream *s = (gz_stream*)file; diff --git a/src/zlib/infblock.c b/src/zlib/infblock.c index f8940c7fab..087d4d2ac3 100644 --- a/src/zlib/infblock.c +++ b/src/zlib/infblock.c @@ -1,6 +1,6 @@ /* infblock.c -- interpret and process block types to last block * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" @@ -65,10 +65,14 @@ local const uInt border[] = { /* Order of the bit length code lengths */ */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +void inflate_blocks_reset(inflate_blocks_statef* s, z_streamp z, uLongf* c) +#else void inflate_blocks_reset(s, z, c) inflate_blocks_statef *s; z_streamp z; uLongf *c; +#endif { if (c != Z_NULL) *c = s->check; @@ -85,11 +89,14 @@ uLongf *c; Tracev((stderr, "inflate: blocks reset\n")); } - +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +inflate_blocks_statef *inflate_blocks_new(z_streamp z, check_func c, uInt w) +#else inflate_blocks_statef *inflate_blocks_new(z, c, w) z_streamp z; check_func c; uInt w; +#endif { inflate_blocks_statef *s; @@ -116,11 +123,14 @@ uInt w; return s; } - +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int inflate_blocks(inflate_blocks_statef* s, z_streamp z, int r) +#else int inflate_blocks(s, z, r) inflate_blocks_statef *s; z_streamp z; int r; +#endif { uInt t; /* temporary storage */ uLong b; /* bit buffer */ @@ -370,10 +380,13 @@ int r; } } - +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int inflate_blocks_free(inflate_blocks_statef* s, z_streamp z) +#else int inflate_blocks_free(s, z) inflate_blocks_statef *s; z_streamp z; +#endif { inflate_blocks_reset(s, z, Z_NULL); ZFREE(z, s->window); @@ -383,23 +396,29 @@ z_streamp z; return Z_OK; } - +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +void inflate_set_dictionary(inflate_blocks_statef* s, const Bytef* d, uInt n) +#else void inflate_set_dictionary(s, d, n) inflate_blocks_statef *s; const Bytef *d; uInt n; +#endif { zmemcpy(s->window, d, n); s->read = s->write = s->window + n; } - /* Returns true if inflate is currently at the end of a block generated - * by Z_SYNC_FLUSH or Z_FULL_FLUSH. + * by Z_SYNC_FLUSH or Z_FULL_FLUSH. * IN assertion: s != Z_NULL */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int inflate_blocks_sync_point(inflate_blocks_statef* s) +#else int inflate_blocks_sync_point(s) inflate_blocks_statef *s; +#endif { return s->mode == LENS; } diff --git a/src/zlib/infcodes.c b/src/zlib/infcodes.c index 1d3baa92eb..bd0e94745a 100644 --- a/src/zlib/infcodes.c +++ b/src/zlib/infcodes.c @@ -1,6 +1,6 @@ /* infcodes.c -- process literals and length/distance pairs * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" @@ -55,12 +55,15 @@ struct inflate_codes_state { }; - +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +inflate_codes_statef* inflate_codes_new(uInt bl, uInt bd, inflate_huft* tl, inflate_huft* td, z_streamp z) +#else inflate_codes_statef *inflate_codes_new(bl, bd, tl, td, z) uInt bl, bd; inflate_huft *tl; inflate_huft *td; /* need separate declaration for Borland C++ */ z_streamp z; +#endif { inflate_codes_statef *c; @@ -77,11 +80,14 @@ z_streamp z; return c; } - +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int inflate_codes(inflate_blocks_statef* s, z_streamp z, int r) +#else int inflate_codes(s, z, r) inflate_blocks_statef *s; z_streamp z; int r; +#endif { uInt j; /* temporary storage */ inflate_huft *t; /* temporary pointer */ @@ -240,10 +246,13 @@ int r; #endif } - +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +void inflate_codes_free(inflate_codes_statef* c, z_streamp z) +#else void inflate_codes_free(c, z) inflate_codes_statef *c; z_streamp z; +#endif { ZFREE(z, c); Tracev((stderr, "inflate: codes free\n")); diff --git a/src/zlib/inffast.c b/src/zlib/inffast.c index 61a78ee933..b0737ae5e4 100644 --- a/src/zlib/inffast.c +++ b/src/zlib/inffast.c @@ -1,6 +1,6 @@ /* inffast.c -- process literals and length/distance pairs fast * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" @@ -25,12 +25,16 @@ struct inflate_codes_state {int dummy;}; /* for buggy compilers */ at least ten. The ten bytes are six bytes for the longest length/ distance pair plus four bytes for overloading the bit buffer. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int inflate_fast(uInt bl, uInt bd, inflate_huft* tl, inflate_huft* td, inflate_blocks_statef* s, z_streamp z) +#else int inflate_fast(bl, bd, tl, td, s, z) uInt bl, bd; inflate_huft *tl; inflate_huft *td; /* need separate declaration for Borland C++ */ inflate_blocks_statef *s; z_streamp z; +#endif { inflate_huft *t; /* temporary pointer */ uInt e; /* extra bits or operation */ diff --git a/src/zlib/inflate.c b/src/zlib/inflate.c index 32e9b8de67..9568dd105d 100644 --- a/src/zlib/inflate.c +++ b/src/zlib/inflate.c @@ -1,6 +1,6 @@ /* inflate.c -- zlib interface to inflate modules * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" @@ -44,14 +44,18 @@ struct internal_state { /* mode independent information */ int nowrap; /* flag for no wrapper */ uInt wbits; /* log2(window size) (8..15, defaults to 15) */ - inflate_blocks_statef + inflate_blocks_statef *blocks; /* current inflate_blocks state */ }; +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT inflateReset(z_streamp z) +#else int ZEXPORT inflateReset(z) z_streamp z; +#endif { if (z == Z_NULL || z->state == Z_NULL) return Z_STREAM_ERROR; @@ -64,8 +68,12 @@ z_streamp z; } +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT inflateEnd(z_streamp z) +#else int ZEXPORT inflateEnd(z) z_streamp z; +#endif { if (z == Z_NULL || z->state == Z_NULL || z->zfree == Z_NULL) return Z_STREAM_ERROR; @@ -77,12 +85,15 @@ z_streamp z; return Z_OK; } - +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT inflateInit2_(z_streamp z, int w, const char* version, int stream_size) +#else int ZEXPORT inflateInit2_(z, w, version, stream_size) z_streamp z; int w; const char *version; int stream_size; +#endif { if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || stream_size != sizeof(z_stream)) @@ -134,22 +145,28 @@ int stream_size; return Z_OK; } - +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT inflateInit_(z_streamp z, const char* version, int stream_size) +#else int ZEXPORT inflateInit_(z, version, stream_size) z_streamp z; const char *version; int stream_size; +#endif { return inflateInit2_(z, DEF_WBITS, version, stream_size); } - #define NEEDBYTE {if(z->avail_in==0)return r;r=f;} #define NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++) +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT inflate(z_streamp z, int f) +#else int ZEXPORT inflate(z, f) z_streamp z; int f; +#endif { int r; uInt b; @@ -274,11 +291,14 @@ int f; #endif } - +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT inflateSetDictionary(z_streamp z, const Bytef* dictionary, uInt dictLength) +#else int ZEXPORT inflateSetDictionary(z, dictionary, dictLength) z_streamp z; const Bytef *dictionary; uInt dictLength; +#endif { uInt length = dictLength; @@ -298,9 +318,12 @@ uInt dictLength; return Z_OK; } - +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT inflateSync(z_streamp z) +#else int ZEXPORT inflateSync(z) z_streamp z; +#endif { uInt n; /* number of bytes to look at */ Bytef *p; /* pointer to bytes */ @@ -349,7 +372,6 @@ z_streamp z; return Z_OK; } - /* Returns true if inflate is currently at the end of a block generated * by Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP * implementation to provide an additional safety check. PPP uses Z_SYNC_FLUSH @@ -357,8 +379,12 @@ z_streamp z; * decompressing, PPP checks that at the end of input packet, inflate is * waiting for these length bytes. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT inflateSyncPoint(z_streamp z) +#else int ZEXPORT inflateSyncPoint(z) z_streamp z; +#endif { if (z == Z_NULL || z->state == Z_NULL || z->state->blocks == Z_NULL) return Z_STREAM_ERROR; diff --git a/src/zlib/inftrees.c b/src/zlib/inftrees.c index 6876ab5a8d..04b2904d88 100644 --- a/src/zlib/inftrees.c +++ b/src/zlib/inftrees.c @@ -1,6 +1,6 @@ /* inftrees.c -- generate Huffman trees for efficient decoding * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" @@ -24,7 +24,6 @@ struct internal_state {int dummy;}; /* for buggy compilers */ #define exop word.what.Exop #define bits word.what.Bits - local int huft_build OF(( uIntf *, /* code lengths in bits */ uInt, /* number of codes */ @@ -90,6 +89,10 @@ local const uInt cpdext[30] = { /* Extra bits for distance codes */ /* If BMAX needs to be larger than 16, then h and x[] should be uLong. */ #define BMAX 15 /* maximum bit length of any code */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local int huft_build(uIntf* b, uInt n, uInt s, const uIntf* d, const uIntf* e, + inflate_huft* FAR *t, uIntf* m, inflate_huft* hp, uInt* hn, uIntf* v) +#else local int huft_build(b, n, s, d, e, t, m, hp, hn, v) uIntf *b; /* code lengths in bits (all assumed <= BMAX) */ uInt n; /* number of codes (assumed <= 288) */ @@ -106,6 +109,7 @@ uIntf *v; /* working area: values in order of bit length */ if the given code set is incomplete (the tables are still built in this case), Z_DATA_ERROR if the input is invalid (an over-subscribed set of lengths), or Z_MEM_ERROR if not enough memory. */ +#endif { uInt a; /* counter for codes of length k */ @@ -290,13 +294,16 @@ uIntf *v; /* working area: values in order of bit length */ return y != 0 && g != 1 ? Z_BUF_ERROR : Z_OK; } - +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int inflate_trees_bits(uIntf* c, uIntf* bb, inflate_huft* FAR *tb, inflate_huft* hp, z_streamp z) +#else int inflate_trees_bits(c, bb, tb, hp, z) uIntf *c; /* 19 code lengths */ uIntf *bb; /* bits tree desired/actual depth */ inflate_huft * FAR *tb; /* bits tree result */ inflate_huft *hp; /* space for trees */ z_streamp z; /* for messages */ +#endif { int r; uInt hn = 0; /* hufts used in space */ @@ -317,7 +324,10 @@ z_streamp z; /* for messages */ return r; } - +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int inflate_trees_dynamic(uInt nl, uInt nd, uInt* c, uInt* bl, uInt *bd, inflate_huft* FAR *tl, + inflate_huft* FAR *td, inflate_huft* hp, z_streamp z) +#else int inflate_trees_dynamic(nl, nd, c, bl, bd, tl, td, hp, z) uInt nl; /* number of literal/length codes */ uInt nd; /* number of distance codes */ @@ -328,6 +338,7 @@ inflate_huft * FAR *tl; /* literal/length tree result */ inflate_huft * FAR *td; /* distance tree result */ inflate_huft *hp; /* space for trees */ z_streamp z; /* for messages */ +#endif { int r; uInt hn = 0; /* hufts used in space */ @@ -381,7 +392,6 @@ z_streamp z; /* for messages */ return Z_OK; } - /* build fixed tables only once--keep them here */ #ifdef BUILDFIXED local int fixed_built = 0; @@ -395,13 +405,17 @@ local inflate_huft *fixed_td; #include "inffixed.h" #endif - +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int inflate_trees_fixed(uIntf* bl, uIntf *bd, inflate_huft* FAR *tl, + inflate_huft* FAR *td, z_streamp z) +#else int inflate_trees_fixed(bl, bd, tl, td, z) uIntf *bl; /* literal desired/actual bit depth */ uIntf *bd; /* distance desired/actual bit depth */ inflate_huft * FAR *tl; /* literal/length tree result */ inflate_huft * FAR *td; /* distance tree result */ z_streamp z; /* for memory allocation */ +#endif { #ifdef BUILDFIXED /* build fixed tables if not already */ diff --git a/src/zlib/infutil.c b/src/zlib/infutil.c index 824dab5712..c80be8c4b9 100644 --- a/src/zlib/infutil.c +++ b/src/zlib/infutil.c @@ -1,6 +1,6 @@ /* inflate_util.c -- data and routines common to blocks and codes * Copyright (C) 1995-1998 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" @@ -20,10 +20,14 @@ uInt inflate_mask[17] = { /* copy as much as possible from the sliding window to the output area */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int inflate_flush(inflate_blocks_statef* s, z_streamp z, int r) +#else int inflate_flush(s, z, r) inflate_blocks_statef *s; z_streamp z; int r; +#endif { uInt n; Bytef *p; diff --git a/src/zlib/trees.c b/src/zlib/trees.c index 524c675870..a1b4304bb4 100644 --- a/src/zlib/trees.c +++ b/src/zlib/trees.c @@ -1,6 +1,6 @@ /* trees.c -- output deflated data using Huffman coding * Copyright (C) 1995-1998 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* @@ -189,10 +189,14 @@ local void gen_trees_header OF((void)); #ifdef __WXDEBUG__ local void send_bits OF((deflate_state *s, int value, int length)); +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local void send_bits(deflate_state* s, int value, int length) +#else local void send_bits(s, value, length) deflate_state *s; int value; /* value to send */ int length; /* number of bits */ +#endif { Tracevv((stderr," l %2d v %4x ", length, value)); Assert(length > 0 && length <= 15, "invalid length"); @@ -373,8 +377,12 @@ void gen_trees_header() /* =========================================================================== * Initialize the tree data structures for a new zlib stream. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +void _tr_init(deflate_state* s) +#else void _tr_init(s) deflate_state *s; +#endif { tr_static_init(); @@ -403,8 +411,12 @@ void _tr_init(s) /* =========================================================================== * Initialize a new block. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local void init_block(deflate_state* s) +#else local void init_block(s) deflate_state *s; +#endif { int n; /* iterates over tree elements */ @@ -447,10 +459,14 @@ local void init_block(s) * when the heap property is re-established (each father smaller than its * two sons). */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local void pqdownheap(deflate_state* s, ct_data* tree, int k) +#else local void pqdownheap(s, tree, k) deflate_state *s; ct_data *tree; /* the tree to restore */ int k; /* node to move down */ +#endif { int v = s->heap[k]; int j = k << 1; /* left son of k */ @@ -482,9 +498,13 @@ local void pqdownheap(s, tree, k) * The length opt_len is updated; static_len is also updated if stree is * not null. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local void gen_bitlen(deflate_state* s, tree_desc* desc) +#else local void gen_bitlen(s, desc) deflate_state *s; tree_desc *desc; /* the tree descriptor */ +#endif { ct_data *tree = desc->dyn_tree; int max_code = desc->max_code; @@ -569,10 +589,14 @@ local void gen_bitlen(s, desc) * OUT assertion: the field code is set for all tree elements of non * zero code length. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local void gen_codes (ct_data* tree, int max_code, ushf* bl_count) +#else local void gen_codes (tree, max_code, bl_count) ct_data *tree; /* the tree to decorate */ int max_code; /* largest code with non zero frequency */ ushf *bl_count; /* number of codes at each bit length */ +#endif { ush next_code[MAX_BITS+1]; /* next code value for each bit length */ ush code = 0; /* running code value */ @@ -611,9 +635,13 @@ local void gen_codes (tree, max_code, bl_count) * and corresponding code. The length opt_len is updated; static_len is * also updated if stree is not null. The field max_code is set. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local void build_tree(deflate_state* s, tree_desc* desc) +#else local void build_tree(s, desc) deflate_state *s; tree_desc *desc; /* the tree descriptor */ +#endif { ct_data *tree = desc->dyn_tree; const ct_data *stree = desc->stat_desc->static_tree; @@ -698,10 +726,14 @@ local void build_tree(s, desc) * Scan a literal or distance tree to determine the frequencies of the codes * in the bit length tree. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local void scan_tree (deflate_state* s, ct_data* tree, int max_code) +#else local void scan_tree (s, tree, max_code) deflate_state *s; ct_data *tree; /* the tree to be scanned */ int max_code; /* and its largest code of non zero frequency */ +#endif { int n; /* iterates over all tree elements */ int prevlen = -1; /* last emitted length */ @@ -743,10 +775,14 @@ local void scan_tree (s, tree, max_code) * Send a literal or distance tree in compressed form, using the codes in * bl_tree. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local void send_tree (deflate_state* s, ct_data* tree, int max_code) +#else local void send_tree (s, tree, max_code) deflate_state *s; ct_data *tree; /* the tree to be scanned */ int max_code; /* and its largest code of non zero frequency */ +#endif { int n; /* iterates over all tree elements */ int prevlen = -1; /* last emitted length */ @@ -794,8 +830,12 @@ local void send_tree (s, tree, max_code) * Construct the Huffman tree for the bit lengths and return the index in * bl_order of the last bit length code to send. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local int build_bl_tree( deflate_state* s) +#else local int build_bl_tree(s) deflate_state *s; +#endif { int max_blindex; /* index of last bit length code of non zero freq */ @@ -829,9 +869,13 @@ local int build_bl_tree(s) * lengths of the bit length codes, the literal tree and the distance tree. * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local void send_all_trees(deflate_state* s, int lcodes, int dcodes, int blcodes) +#else local void send_all_trees(s, lcodes, dcodes, blcodes) deflate_state *s; int lcodes, dcodes, blcodes; /* number of codes for each tree */ +#endif { int rank; /* index in bl_order */ @@ -858,11 +902,15 @@ local void send_all_trees(s, lcodes, dcodes, blcodes) /* =========================================================================== * Send a stored block */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +void _tr_stored_block(deflate_state* s, charf* buf, ulg stored_len, int eof) +#else void _tr_stored_block(s, buf, stored_len, eof) deflate_state *s; charf *buf; /* input block */ ulg stored_len; /* length of input block */ int eof; /* true if this is the last block for a file */ +#endif { send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */ s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; @@ -882,8 +930,12 @@ void _tr_stored_block(s, buf, stored_len, eof) * To simplify the code, we assume the worst case of last real code encoded * on one bit only. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +void _tr_align(deflate_state* s) +#else void _tr_align(s) deflate_state *s; +#endif { send_bits(s, STATIC_TREES<<1, 3); send_code(s, END_BLOCK, static_ltree); @@ -908,11 +960,15 @@ void _tr_align(s) * trees or store, and output the encoded block to the zip file. This function * returns the total compressed length for the file so far. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +ulg _tr_flush_block(deflate_state* s, charf* buf, ulg stored_len, int eof) +#else ulg _tr_flush_block(s, buf, stored_len, eof) deflate_state *s; charf *buf; /* input block, or NULL if too old */ ulg stored_len; /* length of input block */ int eof; /* true if this is the last block for a file */ +#endif { ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ int max_blindex = 0; /* index of last bit length code of non zero freq */ @@ -1020,10 +1076,14 @@ ulg _tr_flush_block(s, buf, stored_len, eof) * Save the match info and tally the frequency counts. Return true if * the current block must be flushed. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int _tr_tally (deflate_state* s, unsigned dist, unsigned lc) +#else int _tr_tally (s, dist, lc) deflate_state *s; unsigned dist; /* distance of matched string */ unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ +#endif { s->d_buf[s->last_lit] = (ush)dist; s->l_buf[s->last_lit++] = (uch)lc; @@ -1070,10 +1130,14 @@ int _tr_tally (s, dist, lc) /* =========================================================================== * Send the block data compressed using the given Huffman trees */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local void compress_block(deflate_state* s, ct_data* ltree, ct_data* dtree) +#else local void compress_block(s, ltree, dtree) deflate_state *s; ct_data *ltree; /* literal tree */ ct_data *dtree; /* distance tree */ +#endif { unsigned dist; /* distance of matched string */ int lc; /* match length or unmatched char (if dist == 0) */ @@ -1123,8 +1187,12 @@ local void compress_block(s, ltree, dtree) * IN assertion: the fields freq of dyn_ltree are set and the total of all * frequencies does not exceed 64K (to fit in an int on 16 bit machines). */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local void set_data_type(deflate_state* s) +#else local void set_data_type(s) deflate_state *s; +#endif { int n = 0; unsigned ascii_freq = 0; @@ -1140,9 +1208,13 @@ local void set_data_type(s) * method would use a table) * IN assertion: 1 <= len <= 15 */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local unsigned bi_reverse(unsigned code, int len) +#else local unsigned bi_reverse(code, len) unsigned code; /* the value to invert */ int len; /* its bit length */ +#endif { register unsigned res = 0; do { @@ -1155,8 +1227,12 @@ local unsigned bi_reverse(code, len) /* =========================================================================== * Flush the bit buffer, keeping at most 7 bits in it. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local void bi_flush(deflate_state* s) +#else local void bi_flush(s) deflate_state *s; +#endif { if (s->bi_valid == 16) { put_short(s, s->bi_buf); @@ -1172,8 +1248,12 @@ local void bi_flush(s) /* =========================================================================== * Flush the bit buffer and align the output on a byte boundary */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local void bi_windup(deflate_state* s) +#else local void bi_windup(s) deflate_state *s; +#endif { if (s->bi_valid > 8) { put_short(s, s->bi_buf); @@ -1191,17 +1271,21 @@ local void bi_windup(s) * Copy a stored block, storing first the length and its * one's complement if requested. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +local void copy_block(deflate_state* s, charf* buf, unsigned len, int header) +#else local void copy_block(s, buf, len, header) deflate_state *s; charf *buf; /* the input data */ unsigned len; /* its length */ int header; /* true if block header must be written */ +#endif { bi_windup(s); /* align on byte boundary */ s->last_eob_len = 8; /* enough lookahead for inflate */ if (header) { - put_short(s, (ush)len); + put_short(s, (ush)len); put_short(s, (ush)~len); #ifdef __WXDEBUG__ s->bits_sent += 2*16; diff --git a/src/zlib/uncompr.c b/src/zlib/uncompr.c index f4d287b518..1de520634a 100644 --- a/src/zlib/uncompr.c +++ b/src/zlib/uncompr.c @@ -1,6 +1,6 @@ /* uncompr.c -- decompress a memory buffer * Copyright (C) 1995-1998 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ @@ -22,11 +22,15 @@ enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, or Z_DATA_ERROR if the input data was corrupted. */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int ZEXPORT uncompress (Bytef* dest, uLongf* destLen, const Bytef* source, uLong sourceLen) +#else int ZEXPORT uncompress (dest, destLen, source, sourceLen) Bytef *dest; uLongf *destLen; const Bytef *source; uLong sourceLen; +#endif { z_stream stream; int err; diff --git a/src/zlib/zconf.h b/src/zlib/zconf.h index 89e1a16c0d..8739a450de 100644 --- a/src/zlib/zconf.h +++ b/src/zlib/zconf.h @@ -1,6 +1,6 @@ /* zconf.h -- configuration of the zlib compression library * Copyright (C) 1995-1998 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ @@ -51,7 +51,7 @@ #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) # define WIN32 #endif -#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386) +#if defined(__GNUC__) || defined(WIN32) || defined(OS232) || defined(__386__) || defined(i386) # ifndef __32BIT__ # define __32BIT__ # endif @@ -71,7 +71,7 @@ # define UNALIGNED_OK #endif -#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC) +#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32) || defined(OS232)) && !defined(STDC) # define STDC #endif #if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__) @@ -196,6 +196,9 @@ typedef unsigned long uLong; /* 32 bits or more */ #else typedef Byte FAR Bytef; #endif +#if defined(__VISAGECPP__) +# define Bytef Byte FAR +#endif typedef char FAR charf; typedef int FAR intf; typedef uInt FAR uIntf; diff --git a/src/zlib/zutil.c b/src/zlib/zutil.c index 199762bdbe..f1a33d4845 100644 --- a/src/zlib/zutil.c +++ b/src/zlib/zutil.c @@ -1,6 +1,6 @@ /* zutil.c -- target dependent utility functions for the compression library * Copyright (C) 1995-1998 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ @@ -38,8 +38,12 @@ const char * ZEXPORT zlibVersion() # endif int z_verbose = verbose; +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +void z_error (char* m) +#else void z_error (m) char *m; +#endif { fprintf(stderr, "%s\n", m); exit(1); @@ -49,8 +53,12 @@ void z_error (m) /* exported to allow conversion of error code to string for compress() and * uncompress() */ +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +const char* ZEXPORT zError(int err) +#else const char * ZEXPORT zError(err) int err; +#endif { return ERR_MSG(err); } @@ -58,10 +66,14 @@ const char * ZEXPORT zError(err) #ifndef HAVE_MEMCPY +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +void zmemcpy(Bytef* dest, Bytef* source, Uint len) +#else void zmemcpy(dest, source, len) Bytef* dest; Bytef* source; uInt len; +#endif { if (len == 0) return; do { @@ -69,10 +81,14 @@ void zmemcpy(dest, source, len) } while (--len != 0); } +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +int zmemcmp(Bytef* s1, Bytef* s2, int len) +#else int zmemcmp(s1, s2, len) Bytef* s1; Bytef* s2; uInt len; +#endif { uInt j; @@ -82,9 +98,13 @@ int zmemcmp(s1, s2, len) return 0; } +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +void zmemzero(Bytef* dest, uInt len) +#else void zmemzero(dest, len) Bytef* dest; uInt len; +#endif { if (len == 0) return; do { @@ -205,18 +225,26 @@ extern voidp calloc OF((uInt items, uInt size)); extern void free OF((voidpf ptr)); #endif +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +voidpf zcalloc (voidpf opaque, unsigned items, unsigned size) +#else voidpf zcalloc (opaque, items, size) voidpf opaque; unsigned items; unsigned size; +#endif { if (opaque) items += size - size; /* make compiler happy */ return (voidpf)calloc(items, size); } +#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface +void zcfree(voidpf opaque, voidpf ptr) +#else void zcfree (opaque, ptr) voidpf opaque; voidpf ptr; +#endif { free(ptr); if (opaque) return; /* make compiler happy */ diff --git a/src/zlib/zutil.h b/src/zlib/zutil.h index 3a390ff989..f6a0751046 100644 --- a/src/zlib/zutil.h +++ b/src/zlib/zutil.h @@ -208,10 +208,15 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ #endif -typedef uLong (ZEXPORT *check_func) OF((uLong check, const Bytef *buf, +typedef uLong (ZEXPORT _Optlink *check_func) OF((uLong check, const Bytef *buf, uInt len)); +#if defined(__VISAGECPP__) +voidpf _Optlink zcalloc OF((voidpf opaque, unsigned items, unsigned size)); +void _Optlink zcfree OF((voidpf opaque, voidpf ptr)); +#else voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); void zcfree OF((voidpf opaque, voidpf ptr)); +#endif #define ZALLOC(strm, items, size) \ (*((strm)->zalloc))((strm)->opaque, (items), (size)) -- 2.45.2