Files
Sourcetrail/src/lib_gui/qt/element/QtCodeNavigateable.h
T
Eberhard Graether 8672d14319 ui: Show title bar at top and scroll bar at bottom in code view snippet list if necessary (issues #432, #479)
* Show title bar at top of snippet list if first file is cut off
* Show scrollbar at bottom of snippet list if last snippet if cut off and horizontally scrollable
* Extended scrollRequest API to different ScrollTarget modes
* Fixed snippet extension broken if maximized first
* Split off title bar functionality to separate class QtCodeFileTitleBar
2017-12-17 13:25:11 +01:00

51 lines
1.3 KiB
C++

#ifndef QT_CODE_NAVIGATEABLE_H
#define QT_CODE_NAVIGATEABLE_H
#include <set>
#include "utility/types.h"
#include "component/view/helper/CodeSnippetParams.h"
class FilePath;
class QRectF;
class QAbstractScrollArea;
class QRect;
class QtCodeArea;
class QWidget;
class QtCodeNavigateable
{
public:
enum ScrollTarget
{
SCROLL_VISIBLE,
SCROLL_CENTER,
SCROLL_TOP
};
virtual ~QtCodeNavigateable();
virtual QAbstractScrollArea* getScrollArea() = 0;
virtual void addCodeSnippet(const CodeSnippetParams& params) = 0;
virtual void requestFileContent(const FilePath& filePath) = 0;
virtual bool requestScroll(const FilePath& filePath, uint lineNumber, Id locationId, bool animated, ScrollTarget target) = 0;
virtual void updateFiles() = 0;
virtual void showContents() = 0;
virtual void onWindowFocus() = 0;
virtual void findScreenMatches(const std::string& query, std::vector<std::pair<QtCodeArea*, Id>>* screenMatches) = 0;
protected:
void ensureWidgetVisibleAnimated(const QWidget* parentWidget, const QWidget *childWidget, QRectF rect, bool animated, ScrollTarget target);
void ensurePercentVisibleAnimated(double percentA, double percentB, bool animated, ScrollTarget target);
QRect getFocusRectForWidget(const QWidget* childWidget, const QWidget* parentWidget) const;
};
#endif // QT_CODE_NAVIGATEABLE_H