*** empty log message ***
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4160 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -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_
|
@@ -33,7 +33,7 @@ public:
|
||||
|
||||
/* constructor for setting one data object */
|
||||
wxDropSource( wxDataObject& rData,
|
||||
wxWindow* pWin,
|
||||
wxWindow* pWin
|
||||
);
|
||||
virtual ~wxDropSource();
|
||||
|
||||
|
@@ -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();
|
||||
|
@@ -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_
|
@@ -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_
|
@@ -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_
|
||||
|
||||
|
||||
|
@@ -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_
|
||||
|
@@ -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_
|
Reference in New Issue
Block a user