ui: Refactored code component to handle all state changes in controller
This commit is contained in:
@@ -3,9 +3,9 @@
|
||||
|
||||
#include <set>
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include "CodeScrollParams.h"
|
||||
#include "CodeSnippetParams.h"
|
||||
#include "types.h"
|
||||
|
||||
class FilePath;
|
||||
class QRectF;
|
||||
@@ -17,35 +17,24 @@ 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 updateCodeSnippet(const CodeSnippetParams& params) = 0;
|
||||
|
||||
virtual void requestFileContent(const FilePath& filePath) = 0;
|
||||
virtual bool requestScroll(const FilePath& filePath, size_t lineNumber, Id locationId, bool animated, ScrollTarget target) = 0;
|
||||
|
||||
virtual void updateSourceLocations(const CodeSnippetParams& params) = 0;
|
||||
virtual void updateFiles() = 0;
|
||||
virtual void showContents() = 0;
|
||||
|
||||
virtual void scrollTo(
|
||||
const FilePath& filePath, size_t lineNumber, Id locationId, bool animated, CodeScrollParams::Target target) = 0;
|
||||
|
||||
virtual void onWindowFocus() = 0;
|
||||
|
||||
virtual void findScreenMatches(const std::wstring& query, std::vector<std::pair<QtCodeArea*, Id>>* screenMatches) = 0;
|
||||
|
||||
virtual std::vector<std::pair<FilePath, Id>> getLocationIdsForTokenIds(const std::set<Id>& tokenIds) const = 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);
|
||||
void ensureWidgetVisibleAnimated(
|
||||
const QWidget* parentWidget, const QWidget *childWidget, QRectF rect, bool animated, CodeScrollParams::Target target);
|
||||
void ensurePercentVisibleAnimated(double percentA, double percentB, bool animated, CodeScrollParams::Target target);
|
||||
|
||||
QRect getFocusRectForWidget(const QWidget* childWidget, const QWidget* parentWidget) const;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user