repository_infos: Enable automatic updates on the main Haiku repostiory.
[haiku.git] / src / apps / haikudepot / ui_generic / BarberPole.h
blobcfd98a627c1c27ffd05da45e38066296d5e78e47
1 /*
2 * Copyright 2017 Julian Harnath <julian.harnath@rwth-aachen.de>
3 * All rights reserved. Distributed under the terms of the MIT license.
4 */
5 #ifndef BARBER_POLE_H
6 #define BARBER_POLE_H
9 #include <View.h>
11 #include <Polygon.h>
14 class BMessageRunner;
17 /*! Spinning barber pole progress indicator. Number and colors of the
18 color stripes are configurable. By default, it will be 2 colors,
19 chosen from the system color palette.
21 class BarberPole : public BView {
22 public:
23 enum {
24 // Message codes
25 kRefreshMessage = 0x1001
28 public:
29 BarberPole(const char* name);
30 ~BarberPole();
32 virtual void MessageReceived(BMessage* message);
33 virtual void Draw(BRect updateRect);
34 virtual void FrameResized(float width, float height);
36 virtual BSize MinSize();
38 void Start();
39 void Stop();
41 void SetSpinSpeed(float speed);
42 void SetColors(const rgb_color* colors,
43 uint32 numColors);
45 private:
46 void _Spin();
48 private:
49 bool fIsSpinning;
50 float fSpinSpeed;
51 const rgb_color* fColors;
52 uint32 fNumColors;
54 float fScrollOffset;
55 BPolygon fStripe;
56 float fStripeWidth;
57 uint32 fNumStripes;
61 #endif // BARBER_POLE_H