Jamba C++ API 7.5.0
Loading...
Searching...
No Matches
ParamImageView.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 pongasoft
3 *
4 * Licensed under the Apache License, Version 2.0 or the MIT license,
5 * at your option. You may not use this file except in compliance with
6 * one of these licenses. You may obtain copies of the licenses at:
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 * https://opensource.org/licenses/MIT
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 *
17 * @author Yan Pujante
18 */
19#pragma once
20
21#include "CustomControlView.h"
22
24
45{
46public:
47 explicit ParamImageView(const CRect &iSize) : CustomDiscreteControlView(iSize) { CView::setMouseEnabled(false); }
48
49 // draw => does the actual drawing job
50 void draw(CDrawContext *iContext) override;
51
66 BitmapPtr getImage() const { return fImage; }
67
69 void setImage(BitmapPtr iImage) { fImage = iImage; }
70
72 bool getInverse() const { return fInverse; }
73
75 void setInverse(bool iInverse) { fInverse = iInverse; }
76
81 int32 getFrames() const;
82
83 // registerParameters
84 void registerParameters() override;
85
87 bool sizeToFit() override;
88
89protected:
91 bool fInverse{false};
92
93public:
94 class Creator : public CustomViewCreator<ParamImageView, CustomDiscreteControlView>
95 {
96 public:
97 explicit Creator(char const *iViewName = nullptr, char const *iDisplayName = nullptr) :
98 CustomViewCreator(iViewName, iDisplayName)
99 {
102 }
103 };
104};
105
106}
CustomDiscreteControlView(const CRect &iSize)
Definition CustomControlView.h:157
CustomViewCreator(char const *iViewName=nullptr, char const *iDisplayName=nullptr, char const *iBaseViewName=VSTGUI::UIViewCreator::kCView)
Definition CustomViewCreator.h:1318
Creator(char const *iViewName=nullptr, char const *iDisplayName=nullptr)
Definition ParamImageView.h:97
void registerParameters() override
Registers the optional parameter using getControlTag() as its id.
Definition ParamImageView.cpp:46
bool getInverse() const
Inverses the frames (last frame is first frame, etc...).
Definition ParamImageView.h:72
bool fInverse
Definition ParamImageView.h:91
void draw(CDrawContext *iContext) override
Definition ParamImageView.cpp:27
bool sizeToFit() override
Use the image and number of frames to size the view appropriately.
Definition ParamImageView.cpp:71
void setImage(BitmapPtr iImage)
attribute image
Definition ParamImageView.h:69
ParamImageView(const CRect &iSize)
Definition ParamImageView.h:47
BitmapPtr getImage() const
The image to use.
Definition ParamImageView.h:66
int32 getFrames() const
Returns the number of frames the image has (which is defined by the [number of steps + 1] the underly...
Definition ParamImageView.cpp:58
BitmapSPtr fImage
Definition ParamImageView.h:90
void setInverse(bool iInverse)
Attribute inverse.
Definition ParamImageView.h:75
void registerBitmapAttribute(std::string const &iName, typename BitmapAttribute::Getter iGetter, typename BitmapAttribute::Setter iSetter)
Definition CustomViewCreator.h:972
void registerBooleanAttribute(std::string const &iName, typename BooleanAttribute::Getter iGetter, typename BooleanAttribute::Setter iSetter)
Definition CustomViewCreator.h:1100
Definition CustomController.h:25
CBitmap * BitmapPtr
Definition Types.h:50
SharedPointer< CBitmap > BitmapSPtr
Definition Types.h:51