Open Ephys GUI
 All Classes Functions Variables Pages
ImageIcon.h
1 /*
2  ------------------------------------------------------------------
3 
4  This file is part of the Open Ephys GUI
5  Copyright (C) 2012 Open Ephys
6 
7  ------------------------------------------------------------------
8 
9  This program is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program. If not, see <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #ifndef __IMAGEICON_H_ED764AE7__
25 #define __IMAGEICON_H_ED764AE7__
26 
27 #include "../../../JuceLibraryCode/JuceHeader.h"
28 
29 class ImageIcon : public Component
30 {
31 public:
32  ImageIcon (Image& image_) { image = image_; opacity = 1.0;}
33  ~ImageIcon () {}
34 
35  void setOpacity(float);
36 
37 private:
38 
39  void paint (Graphics& g)
40  {
41  g.setOpacity(opacity);
42  g.drawImageWithin(image, // image&
43  0, // destX
44  0, // destY
45  getWidth(), // destWidth
46  getHeight(), // destHeight
47  RectanglePlacement::xLeft);
48  }
49 
50  Image image;
51  float opacity;
52 
53 };
54 
55 #endif // __IMAGEICON_H_ED764AE7__