⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 listctrl.h

📁 Wxpython Implemented on Windows CE, Source code
💻 H
📖 第 1 页 / 共 2 页
字号:
///////////////////////////////////////////////////////////////////////////////
// Name:        wx/os2/listctrl.h
// Purpose:     wxListCtrl class
// Author:      
// Modified by:
// Created:     
// RCS-ID:      $Id: listctrl.h,v 1.11 2006/03/10 21:26:52 RD Exp $
// Copyright:   (c) wxWidgets team
// Licence:     wxWindows licence
///////////////////////////////////////////////////////////////////////////////

#ifndef _WX_LISTCTRL_H_
#define _WX_LISTCTRL_H_

#if wxUSE_LISTCTRL

#include "wx/control.h"
#include "wx/event.h"
#include "wx/hash.h"
#include "wx/textctrl.h"


class WXDLLEXPORT wxImageList;

typedef int (wxCALLBACK *wxListCtrlCompare)(long lItem1, long lItem2, long lSortData);

class WXDLLEXPORT wxListCtrl: public wxControl
{
public:
    wxListCtrl() { Init(); }
    wxListCtrl( wxWindow*          pParent
               ,wxWindowID         vId = -1
               ,const wxPoint&     rPos = wxDefaultPosition
               ,const wxSize&      rSize = wxDefaultSize
               ,long               lStyle = wxLC_ICON
               ,const wxValidator& rValidator = wxDefaultValidator
               ,const wxString&    rsName = wxListCtrlNameStr)
    {
        Init();
        Create( pParent
               ,vId
               ,rPos
               ,rSize
               ,lStyle
               ,rValidator
               ,rsName
              );
    }
    virtual ~wxListCtrl();

    bool Create( wxWindow*          pParent
                ,wxWindowID         vId = -1
                ,const wxPoint&     rPos = wxDefaultPosition
                ,const wxSize&      rSize = wxDefaultSize
                ,long               lStyle = wxLC_ICON
                ,const wxValidator& rValidator = wxDefaultValidator
                ,const wxString&    rsName = wxListCtrlNameStr
               );


    // Attributes
    ////////////////////////////////////////////////////////////////////////////
    //

    //
    // Set the control colours
    //
    bool SetForegroundColour(const wxColour& rCol);
    bool SetBackgroundColour(const wxColour& rCol);

    //
    // Information about this column
    //
    bool GetColumn( int nCol
                   ,wxListItem& rItem
                  ) const;
    bool SetColumn( int         nCol
                   ,wxListItem& rItem
                  );

    //
    // Column width
    //
    int  GetColumnWidth(int nCol) const;
    bool SetColumnWidth( int nCol
                        ,int nWidth
                       );

    //
    // 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(void) const;

    wxRect GetViewRect() const;
    //
    // Gets the edit control for editing labels.
    //
    wxTextCtrl* GetEditControl(void) const;

    //
    // Information about the item
    //
    bool GetItem(wxListItem& rInfo) const;
    bool SetItem(wxListItem& rInfo);

    //
    // Sets a string field at a particular column
    //
    long SetItem( long            lIndex
                 ,int             nCol
                 ,const wxString& rsLabel
                 ,int             nImageId = -1
                );

    //
    // Item state
    //
    int  GetItemState( long lItem
                      ,long lStateMask
                     ) const;
    bool SetItemState( long lItem
                      ,long lState
                      ,long lStateMask
                      );

    //
    // Sets the item image
    //
    bool SetItemImage( long lItem
                      ,int  nImage
                      ,int  lSelImage
                     );
    bool SetItemColumnImage( long lItem
                            ,long lColumn
                            ,int  nImage
                           );

    //
    // Item text
    //
    wxString GetItemText(long lItem) const;
    void     SetItemText( long            lItem
                         ,const wxString& rsStr
                        );

    //
    // Item data
    //
    long GetItemData(long lItem) const;
    bool SetItemData( long lItem
                     ,long lData
                    );

    //
    // Gets the item rectangle
    //
    bool GetItemRect( long    lItem
                     ,wxRect& rRect
                     ,int     nCode = wxLIST_RECT_BOUNDS
                    ) const;

    //
    // Item position
    //
    bool GetItemPosition( long     lItem
                         ,wxPoint& rPos
                        ) const;
    bool SetItemPosition( long           lItem
                         ,const wxPoint& rPos
                        );

    //
    // Gets the number of items in the list control
    //
    int  GetItemCount(void) const;

    //
    // Gets the number of columns in the list control
    //
    inline int GetColumnCount(void) const { return m_nColCount; }

    //
    // Retrieves the spacing between icons in pixels.
    // If bIsSmall is true, gets the spacing for the small icon
    // view, otherwise the large icon view.
    //
    int  GetItemSpacing(bool bIsSmall) const;

    //
    // Foreground colour of an item.
    //
    wxColour GetItemTextColour(long lItem) const;
    void     SetItemTextColour( long            lItem
                               ,const wxColour& rCol
                              );

    //
    // Background colour of an item.
    //
    wxColour GetItemBackgroundColour(long lItem ) const;
    void     SetItemBackgroundColour( long            lItem
                                     ,const wxColour& rCol
                                    );

    //
    // Gets the number of selected items in the list control
    //
    int      GetSelectedItemCount(void) const;

    //
    // Text colour of the listview
    //
    wxColour GetTextColour(void) const;
    void     SetTextColour(const wxColour& rCol);

    //
    // Gets the index of the topmost visible item when in
    // list or report view
    //
    long GetTopItem(void) const;

    //
    // Add or remove a single window style
    void SetSingleStyle( long lStyle
                        ,bool bAdd = true
                       );

    //
    // Set the whole window style
    //
    void SetWindowStyleFlag(long lStyle);

    //
    // 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 lItem
                     ,int  nGeometry = wxLIST_NEXT_ALL
                     ,int  lState = wxLIST_STATE_DONTCARE
                    ) const;

    //
    // Gets one of the three image lists
    //
    wxImageList* GetImageList(int nWhich) const;

    //
    // Sets the image list
    //
    void SetImageList( wxImageList* pImageList
                      ,int          nWhich
                     );
    void AssignImageList( wxImageList* pImageList
                         ,int          nWhich
                        );

    //
    // Returns true if it is a virtual list control
    //
    inline bool IsVirtual() const { return (GetWindowStyle() & wxLC_VIRTUAL) != 0; }

    //
    // Refresh items selectively (only useful for virtual list controls)
    //
    void RefreshItem(long lItem);
    void RefreshItems( long lItemFrom
                      ,long lItemTo

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -