/usr/include/libdtk-2.0.7/DWidget/dsimplelistview.h is in libdtkwidget-dev 2.0.7.2-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | /* -*- Mode: C++; indent-tabs-mode: nil; tab-width: 4 -*-
* -*- coding: utf-8 -*-
*
* Copyright (C) 2011 ~ 2017 Deepin, Inc.
* 2011 ~ 2017 Wang Yong
*
* Author: Wang Yong <wangyong@deepin.com>
* Maintainer: Wang Yong <wangyong@deepin.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DSIMPLELISTVIEW_H
#define DSIMPLELISTVIEW_H
#include "dobject.h"
#include "dsimplelistitem.h"
#include <dtkwidget_global.h>
#include <QPixmap>
#include <QTimer>
#include <QWidget>
DWIDGET_BEGIN_NAMESPACE
typedef bool (* SortAlgorithm) (const DSimpleListItem *item1, const DSimpleListItem *item2, bool descendingSort);
typedef bool (* SearchAlgorithm) (const DSimpleListItem *item, QString searchContent);
class DSimpleListViewPrivate;
class LIBDTKWIDGETSHARED_EXPORT DSimpleListView : public QWidget, public DTK_CORE_NAMESPACE::DObject
{
Q_OBJECT
public:
explicit DSimpleListView(QWidget *parent = 0);
~DSimpleListView();
// DSimpleListView interfaces.
/*
* Set row height of DSimpleListView.
*
* @height the height of row
*/
void setRowHeight(int height);
/*
* Set column titles, widths and height.
* If you want some column use expand space, please set width with -1
* Only allowed one -1 to set in width list.
*
* @titles a list to contains titles
* @widths the width of column, list length same as titles list
* @height height of titlebar, don't display titlebar if set height with 0
*/
void setColumnTitleInfo(QList<QString> titles, QList<int> widths, int height);
/*
* Set column hide flags.
* At least have false in hide flags list, and hide flags count must same as titles list.
*
* @toggleHideFlags the hide flags to control column wether toggle show/hide.
* @alwaysVisibleColumn the column index that column is always visible, default is -1, mean no column can always visible.
*/
void setColumnHideFlags(QList<bool> toggleHideFlags, int alwaysVisibleColumn=-1);
/*
* Set column sorting algorithms.
* Note SortAlgorithm function type must be 'static', otherwise function pointer can't match type.
*
* @algorithms a list of SortAlgorithm, SortAlgorithm is function pointer, it's type is: 'bool (*) (const DSimpleListItem *item1, const DSimpleListItem *item2, bool descendingSort)'
* @sortColumn default sort column, -1 mean don't sort any column default
* @descendingSort whether sort column descending, default is false
*/
void setColumnSortingAlgorithms(QList<SortAlgorithm> *algorithms, int sortColumn=-1, bool descendingSort=false);
/*
* Set search algorithm to filter match items.
*
* @algorithm the search algorithm, it's type is: 'bool (*) (const DSimpleListItem *item, QString searchContent)'
*/
void setSearchAlgorithm(SearchAlgorithm algorithm);
/*
* Set radius to clip listview.
*
* @radius the radius of clip area, default is 0 pixel.
*/
void setClipRadius(int radius);
/*
* Set frame details.
*
* @enableFrame draw frame if enableFrame is true, default is false
* @color the frame color, default is black
* @opacity the frame opacity, default is 0.1
*/
void setFrame(bool enableFrame, QColor color=QColor("#000000"), double opacity=0.1);
/*
* Add DSimpleListItem list to ListView.
* If user has click title to sort, sort items after add items to list.
*
* @items List of LiteItem*
*/
void addItems(QList<DSimpleListItem*> items);
/*
* Remove DSimpleListItem from list.
*
* @item item to remove
*/
void removeItem(DSimpleListItem* item);
/*
* Clear items from DSimpleListView.
*/
void clearItems();
/*
* Add DSimpleListItem list to mark selected effect in ListView.
*
* @items List of DSimpleListItem* to mark selected
* @recordLastSelection record last selection item to make selected operation continuously, default is true
*/
void addSelections(QList<DSimpleListItem*> items, bool recordLastSelection=true);
/*
* Clear selection items from DSimpleListView.
*
* @clearLastSelection clear last selection item if option is true, default is true
*/
void clearSelections(bool clearLastSelection=true);
/*
* Refresh all items in DSimpleListView.
* This function is different that addItems is: it will clear items first before add new items.
* This function will keep selection status and scroll offset when add items.
*
* @items List of DSimpleListItem* to add
*/
void refreshItems(QList<DSimpleListItem*> items);
/*
* Search
*/
void search(QString searchContent);
// DSimpleListView operations.
void selectAllItems();
void selectFirstItem();
void selectLastItem();
void selectNextItem();
void selectPrevItem();
void shiftSelectPageDown();
void shiftSelectPageUp();
void shiftSelectToEnd();
void shiftSelectToHome();
void shiftSelectToNext();
void shiftSelectToPrev();
void scrollPageDown();
void scrollPageUp();
void ctrlScrollPageDown();
void ctrlScrollPageUp();
void ctrlScrollToEnd();
void ctrlScrollToHome();
protected:
virtual void leaveEvent(QEvent * event);
QPixmap arrowDownDarkHoverImage;
QPixmap arrowDownDarkNormalImage;
QPixmap arrowDownDarkPressImage;
QPixmap arrowDownHoverImage;
QPixmap arrowDownLightHoverImage;
QPixmap arrowDownLightNormalImage;
QPixmap arrowDownLightPressImage;
QPixmap arrowDownNormalImage;
QPixmap arrowDownPressImage;
QPixmap arrowUpDarkHoverImage;
QPixmap arrowUpDarkNormalImage;
QPixmap arrowUpDarkPressImage;
QPixmap arrowUpHoverImage;
QPixmap arrowUpLightHoverImage;
QPixmap arrowUpLightNormalImage;
QPixmap arrowUpLightPressImage;
QPixmap arrowUpNormalImage;
QPixmap arrowUpPressImage;
QString backgroundColor = "#ffffff";
QString scrollbarColor = "#ffffff";
QString searchColor = "#000000";
QString titleAreaColor = "#ffffff";
QString titleColor = "#000000";
QString titleLineColor = "#000000";
QColor frameColor = QColor("#000000");
double backgroundOpacity = 0.03;
double frameOpacity = 0.1;
double titleAreaOpacity = 0.02;
int titleSize = 10;
qreal scrollbarFrameHoverOpacity = 0;
qreal scrollbarFrameNormalOpacity = 0;
qreal scrollbarFramePressOpacity = 0;
qreal scrollbarHoverOpacity = 0.7;
qreal scrollbarNormalOpacity = 0.5;
qreal scrollbarPressOpacity = 0.8;
Q_SIGNALS:
void rightClickItems(QPoint pos, QList<DSimpleListItem*> items);
void changeColumnVisible(int index, bool visible, QList<bool> columnVisibles);
void changeSortingStatus(int index, bool sortingOrder);
void changeHoverItem(QPoint pos, DSimpleListItem* item, int columnIndex);
void mouseHoverChanged(DSimpleListItem* oldItem, DSimpleListItem* newItem, int columnIndex, QPoint pos);
void mousePressChanged(DSimpleListItem* item, int columnIndex, QPoint pos);
void mouseReleaseChanged(DSimpleListItem* item, int columnIndex, QPoint pos);
protected:
bool eventFilter(QObject *, QEvent *event);
void keyPressEvent(QKeyEvent *keyEvent);
void mouseMoveEvent(QMouseEvent *mouseEvent);
void mousePressEvent(QMouseEvent *mouseEvent);
void mouseReleaseEvent(QMouseEvent *mouseEvent);
void paintEvent(QPaintEvent *);
void wheelEvent(QWheelEvent *event);
void paintScrollbar(QPainter *painter);
void selectPrevItemWithOffset(int scrollOffset);
void selectNextItemWithOffset(int scrollOffset);
void shiftSelectNextItemWithOffset(int scrollOffset);
void shiftSelectPrevItemWithOffset(int scrollOffset);
int getBottomRenderOffset();
int getScrollbarY();
int getScrollAreaHeight();
int getScrollbarHeight();
QList<int> getRenderWidths();
void shiftSelectItemsWithBound(int selectionStartIndex, int selectionEndIndex);
int adjustRenderOffset(int offset);
void startScrollbarHideTimer();
bool isMouseAtScrollArea(int x);
bool isMouseAtTitleArea(int y);
QList<bool> columnVisibles;
private Q_SLOTS:
void hideScrollbar();
private:
D_DECLARE_PRIVATE(DSimpleListView)
};
DWIDGET_END_NAMESPACE
#endif
|