Numworks Epsilon  1.4.1
Graphing Calculator Operating System
image_cell.cpp
Go to the documentation of this file.
1 #include "image_cell.h"
2 #include <assert.h>
3 
4 namespace Probability {
5 
8  m_icon(nullptr),
9  m_focusedIcon(nullptr)
10 {
11 }
12 
13 void ImageCell::setHighlighted(bool highlight) {
15  if (isHighlighted()) {
16  m_iconView.setImage(m_focusedIcon);
17  } else {
18  m_iconView.setImage(m_icon);
19  }
20 }
21 
22 void ImageCell::setImage(const Image * image, const Image * focusedImage) {
23  m_icon = image;
24  m_focusedIcon = focusedImage;
27 }
28 
29 int ImageCell::numberOfSubviews() const {
30  return 1;
31 }
32 
33 View * ImageCell::subviewAtIndex(int index) {
34  assert(index == 0);
35  return &m_iconView;
36 }
37 
38 void ImageCell::layoutSubviews() {
39  m_iconView.setFrame(bounds());
40 }
41 
42 }
#define assert(e)
Definition: assert.h:9
void setFrame(KDRect frame)
Definition: view.cpp:125
void markRectAsDirty(KDRect rect)
Definition: view.cpp:39
Definition: image.h:6
void setHighlighted(bool highlight) override
Definition: image_cell.cpp:13
bool isHighlighted() const
void setImage(const Image *image)
Definition: image_view.cpp:21
void setImage(const Image *image, const Image *focusedImage)
Definition: image_cell.cpp:22
Definition: view.h:23
virtual void setHighlighted(bool highlight)
KDRect bounds() const
Definition: view.cpp:157