diff options
| author | Nick Dedekind <nicholas.dedekind@gmail.com> | 2012-12-11 00:24:25 +0000 |
|---|---|---|
| committer | Tarmac <> | 2012-12-11 00:24:25 +0000 |
| commit | 8d703126102638c6d517e955f4be2fab0b272e42 (patch) | |
| tree | cd2a624fd499706966407a4c6f3b7e693a7e3ecf /UnityCore | |
| parent | 0cc2945530576eae074494e60d1c9061b409b1c0 (diff) | |
| parent | 88b8cff6d87cd39683d553254304176190a8a077 (diff) | |
Use the dash rendered icon as the source for the drag icon. Fixes: https://bugs.launchpad.net/bugs/863412.
Approved by Brandon Schaefer. (bzr r2967)
Diffstat (limited to 'UnityCore')
| -rw-r--r-- | UnityCore/ModelRowAdaptor-inl.h | 6 | ||||
| -rw-r--r-- | UnityCore/ModelRowAdaptor.cpp | 14 | ||||
| -rw-r--r-- | UnityCore/ModelRowAdaptor.h | 17 | ||||
| -rw-r--r-- | UnityCore/Result.cpp | 22 | ||||
| -rw-r--r-- | UnityCore/Result.h | 9 |
5 files changed, 52 insertions, 16 deletions
diff --git a/UnityCore/ModelRowAdaptor-inl.h b/UnityCore/ModelRowAdaptor-inl.h index 96e24e675..58623584b 100644 --- a/UnityCore/ModelRowAdaptor-inl.h +++ b/UnityCore/ModelRowAdaptor-inl.h @@ -28,13 +28,13 @@ namespace dash template<typename T> void RowAdaptorBase::set_renderer(T renderer) { - dee_model_set_tag(model_, iter_, tag_, renderer); + set_model_tag(renderer); } template<typename T> -T RowAdaptorBase::renderer() +T RowAdaptorBase::renderer() const { - return static_cast<T>(dee_model_get_tag(model_, iter_, tag_)); + return static_cast<T>(get_model_tag()); } } diff --git a/UnityCore/ModelRowAdaptor.cpp b/UnityCore/ModelRowAdaptor.cpp index 5f701400d..d1c7d4ba7 100644 --- a/UnityCore/ModelRowAdaptor.cpp +++ b/UnityCore/ModelRowAdaptor.cpp @@ -36,6 +36,10 @@ RowAdaptorBase::RowAdaptorBase(RowAdaptorBase const& other) tag_ = other.tag_; } +RowAdaptorBase::~RowAdaptorBase() +{ +} + RowAdaptorBase& RowAdaptorBase::operator=(RowAdaptorBase const& other) { model_ = other.model_; @@ -91,5 +95,15 @@ float RowAdaptorBase::GetFloatAt(int position) const return static_cast<float>(dee_model_get_double(model_, iter_, position)); } +void RowAdaptorBase::set_model_tag(gpointer value) +{ + dee_model_set_tag(model_, iter_, tag_, value); +} + +gpointer RowAdaptorBase::get_model_tag() const +{ + return dee_model_get_tag(model_, iter_, tag_); +} + } } diff --git a/UnityCore/ModelRowAdaptor.h b/UnityCore/ModelRowAdaptor.h index b4fc929b4..8d38e841c 100644 --- a/UnityCore/ModelRowAdaptor.h +++ b/UnityCore/ModelRowAdaptor.h @@ -50,13 +50,15 @@ class RowAdaptorBase public: RowAdaptorBase(DeeModel* model=0, DeeModelIter* iter=0, DeeModelTag* tag=0); RowAdaptorBase(RowAdaptorBase const& other); + virtual ~RowAdaptorBase(); + RowAdaptorBase& operator=(RowAdaptorBase const& other); - std::string GetStringAt(int position) const; - bool GetBoolAt(int position) const; - int GetIntAt(int position) const; - unsigned int GetUIntAt(int position) const; - float GetFloatAt(int position) const; + virtual std::string GetStringAt(int position) const; + virtual bool GetBoolAt(int position) const; + virtual int GetIntAt(int position) const; + virtual unsigned int GetUIntAt(int position) const; + virtual float GetFloatAt(int position) const; void SetTarget(DeeModel* model, DeeModelIter* iter, DeeModelTag* tag); @@ -64,9 +66,12 @@ public: void set_renderer(T renderer); template<typename T> - T renderer(); + T renderer() const; protected: + virtual void set_model_tag(gpointer value); + virtual gpointer get_model_tag() const; + DeeModel* model_; DeeModelIter* iter_; DeeModelTag* tag_; diff --git a/UnityCore/Result.cpp b/UnityCore/Result.cpp index 78723c5e1..e334761d3 100644 --- a/UnityCore/Result.cpp +++ b/UnityCore/Result.cpp @@ -48,14 +48,22 @@ Result& Result::operator=(Result const& other) void Result::SetupGetters() { - uri.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 0)); - icon_hint.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 1)); - category_index.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetUIntAt), 2)); - mimetype.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 3)); - name.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 4)); - comment.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 5)); - dnd_uri.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 6)); + uri.SetGetterFunction(sigc::mem_fun(this, &Result::GetURI)); + icon_hint.SetGetterFunction(sigc::mem_fun(this, &Result::GetIconHint)); + category_index.SetGetterFunction(sigc::mem_fun(this, &Result::GetCategoryIndex)); + mimetype.SetGetterFunction(sigc::mem_fun(this, &Result::GetMimeType)); + name.SetGetterFunction(sigc::mem_fun(this, &Result::GetName)); + comment.SetGetterFunction(sigc::mem_fun(this, &Result::GetComment)); + dnd_uri.SetGetterFunction(sigc::mem_fun(this, &Result::GetDndURI)); } +std::string Result::GetURI() const { return GetStringAt(0); } +std::string Result::GetIconHint() const { return GetStringAt(1); } +std::size_t Result::GetCategoryIndex() const { return GetUIntAt(2); } +std::string Result::GetMimeType() const { return GetStringAt(3); } +std::string Result::GetName() const { return GetStringAt(4); } +std::string Result::GetComment() const { return GetStringAt(5); } +std::string Result::GetDndURI() const { return GetStringAt(6); } + } } diff --git a/UnityCore/Result.h b/UnityCore/Result.h index 8e00f85fd..4fb3332cc 100644 --- a/UnityCore/Result.h +++ b/UnityCore/Result.h @@ -51,6 +51,15 @@ public: nux::ROProperty<std::string> comment; nux::ROProperty<std::string> dnd_uri; +protected: + virtual std::string GetURI() const; + virtual std::string GetIconHint() const; + virtual std::size_t GetCategoryIndex() const; + virtual std::string GetMimeType() const; + virtual std::string GetName() const; + virtual std::string GetComment() const; + virtual std::string GetDndURI() const; + private: void SetupGetters(); }; |
