Warning, file /plasma/oxygen-gtk/src/oxygencachekey.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 #ifndef oxygencachekey_h 0002 #define oxygencachekey_h 0003 0004 /* 0005 * this file is part of the oxygen gtk engine 0006 * SPDX-FileCopyrightText: 2010 Hugo Pereira Da Costa <hugo.pereira@free.fr> 0007 * 0008 * SPDX-License-Identifier: LGPL-2.0-or-later 0009 */ 0010 0011 #include "oxygenrgba.h" 0012 #include "oxygenwindecooptions.h" 0013 0014 namespace Oxygen 0015 { 0016 0017 //! key for separators 0018 /*! keys are used to store tilesets into cache */ 0019 class SeparatorKey 0020 { 0021 public: 0022 0023 //! constructor 0024 SeparatorKey( const ColorUtils::Rgba& color, bool vertical, int size ): 0025 _color( color.toInt() ), 0026 _vertical( vertical ), 0027 _size( size ) 0028 {} 0029 0030 //! equal to operator 0031 bool operator == (const SeparatorKey& other ) const 0032 { 0033 return 0034 _color == other._color && 0035 _vertical == other._vertical && 0036 _size == other._size; 0037 } 0038 0039 //! less than operator 0040 bool operator < (const SeparatorKey& other ) const 0041 { 0042 if( _color != other._color ) return _color < other._color; 0043 else if( _vertical != other._vertical ) return _vertical < other._vertical; 0044 else return _size < other._size; 0045 } 0046 0047 private: 0048 0049 guint32 _color; 0050 bool _vertical; 0051 int _size; 0052 0053 //! streamer 0054 friend std::ostream& operator << ( std::ostream& out, const SeparatorKey& key ) 0055 { 0056 out << "SeparatorKey - color: " << key._color << " shade: " << key._vertical << " size: " << key._size; 0057 return out; 0058 } 0059 0060 }; 0061 0062 //! key for focused slabs 0063 class SlabKey 0064 { 0065 public: 0066 0067 //! constructor 0068 SlabKey( const ColorUtils::Rgba& color, double shade, int size ): 0069 _color( color.toInt() ), 0070 _glow( 0 ), 0071 _shade( shade ), 0072 _size( size ) 0073 {} 0074 0075 //! constructor 0076 SlabKey( const ColorUtils::Rgba& color, const ColorUtils::Rgba& glow, double shade, int size ): 0077 _color( color.toInt() ), 0078 _glow( glow.toInt() ), 0079 _shade( shade ), 0080 _size( size ) 0081 {} 0082 0083 //! equal to operator 0084 bool operator == (const SlabKey& other ) const 0085 { 0086 return 0087 _color == other._color && 0088 _glow == other._glow && 0089 _shade == other._shade && 0090 _size == other._size; 0091 } 0092 0093 //! less than operator 0094 bool operator < (const SlabKey& other ) const 0095 { 0096 if( _color != other._color ) return _color < other._color; 0097 else if( _glow != other._glow ) return _glow < other._glow; 0098 else if( _shade != other._shade ) return _shade < other._shade; 0099 else return _size < other._size; 0100 } 0101 0102 private: 0103 0104 guint32 _color; 0105 guint32 _glow; 0106 double _shade; 0107 int _size; 0108 0109 //! streamer 0110 friend std::ostream& operator << ( std::ostream& out, const SlabKey& key ) 0111 { 0112 out << "SlabKey - color: " << key._color << " glow: " << key._glow << " shade: " << key._shade << " size: " << key._size; 0113 return out; 0114 } 0115 }; 0116 0117 class SliderSlabKey 0118 { 0119 public: 0120 0121 //! constructor 0122 SliderSlabKey( const ColorUtils::Rgba& color, const ColorUtils::Rgba& glow, bool sunken, double shade, int size ): 0123 _color( color.toInt() ), 0124 _glow( glow.toInt() ), 0125 _sunken( sunken ), 0126 _shade( shade ), 0127 _size( size ) 0128 {} 0129 0130 //! equal to operator 0131 bool operator == (const SliderSlabKey& other ) const 0132 { 0133 return 0134 _color == other._color && 0135 _glow == other._glow && 0136 _sunken == other._sunken && 0137 _shade == other._shade && 0138 _size == other._size; 0139 } 0140 0141 //! less than operator 0142 bool operator < (const SliderSlabKey& other ) const 0143 { 0144 if( _color != other._color ) return _color < other._color; 0145 else if( _glow != other._glow ) return _glow < other._glow; 0146 else if( _sunken != other._sunken ) return _sunken < other._sunken; 0147 else if( _shade != other._shade ) return _shade < other._shade; 0148 else return _size < other._size; 0149 } 0150 0151 private: 0152 0153 guint32 _color; 0154 guint32 _glow; 0155 bool _sunken; 0156 double _shade; 0157 int _size; 0158 0159 //! streamer 0160 friend std::ostream& operator << ( std::ostream& out, const SliderSlabKey& key ) 0161 { 0162 out << "SliderSlabKey -" 0163 << " color: " << key._color 0164 << " glow: " << key._glow 0165 << " sunken: " << key._sunken 0166 << " shade: " << key._shade 0167 << " size: " << key._size; 0168 return out; 0169 } 0170 }; 0171 0172 //! key for holes 0173 class HoleFocusedKey 0174 { 0175 public: 0176 0177 //! constructor 0178 HoleFocusedKey( const ColorUtils::Rgba& color, const ColorUtils::Rgba& fill, const ColorUtils::Rgba& glow, int size, bool contrast ): 0179 _color( color.toInt() ), 0180 _fill( fill.toInt() ), 0181 _glow( glow.toInt() ), 0182 _size( size ), 0183 _filled( fill.isValid() ), 0184 _contrast( contrast ) 0185 {} 0186 0187 //! equal to operator 0188 bool operator == (const HoleFocusedKey& other ) const 0189 { 0190 return 0191 _color == other._color && 0192 _glow == other._glow && 0193 _size == other._size && 0194 _filled == other._filled && 0195 (_fill == other._fill || !_filled ) && 0196 _contrast == other._contrast; 0197 } 0198 0199 //! less than operator 0200 bool operator < (const HoleFocusedKey& other ) const 0201 { 0202 if( _color != other._color ) return _color < other._color; 0203 if( _glow != other._glow ) return _glow < other._glow; 0204 else if( _size != other._size ) return _size < other._size; 0205 else if( _filled != other._filled ) return !_filled; 0206 else if( _filled && _fill != other._fill ) return _fill < other._fill; 0207 else if( _contrast != other._contrast ) return _contrast < other._contrast; 0208 else return false; 0209 } 0210 0211 private: 0212 0213 guint32 _color; 0214 guint32 _fill; 0215 guint32 _glow; 0216 int _size; 0217 bool _filled; 0218 bool _contrast; 0219 0220 //! streamer 0221 friend std::ostream& operator << ( std::ostream& out, const HoleFocusedKey& key ) 0222 { 0223 out 0224 << "HoleFocusedKey -" 0225 << " color: " << key._color << " glow: " << key._glow << " fill: " << key._fill 0226 << " size: " << key._size << " filled: " << key._filled << " contrast: " << key._contrast; 0227 return out; 0228 } 0229 0230 }; 0231 0232 //! key for flat holes 0233 class HoleFlatKey 0234 { 0235 public: 0236 0237 //! constructor 0238 HoleFlatKey( const ColorUtils::Rgba& color, double shade, bool fill, int size ): 0239 _color( color.toInt() ), 0240 _shade( shade ), 0241 _fill( fill ), 0242 _size( size ) 0243 {} 0244 0245 //! equal to operator 0246 bool operator == (const HoleFlatKey& other ) const 0247 { 0248 return 0249 _color == other._color && 0250 _shade == other._shade && 0251 _fill == other._fill && 0252 _size == other._size; 0253 } 0254 0255 //! less than operator 0256 bool operator < (const HoleFlatKey& other ) const 0257 { 0258 if( _color != other._color ) return _color < other._color; 0259 else if( _shade != other._shade ) return _shade < other._shade; 0260 else if( _fill != other._fill ) return _fill < other._fill; 0261 else return _size < other._size; 0262 } 0263 0264 private: 0265 0266 guint32 _color; 0267 double _shade; 0268 bool _fill; 0269 int _size; 0270 0271 //! streamer 0272 friend std::ostream& operator << ( std::ostream& out, const HoleFlatKey& key ) 0273 { 0274 out 0275 << "HoleFlatKey -" 0276 << " color: " << key._color 0277 << " shade: " << key._shade 0278 << " fill: " << (key._fill ? "true":"false") 0279 << " size: " << key._size; 0280 0281 return out; 0282 } 0283 0284 }; 0285 0286 //! key for scroll holes 0287 class ScrollHoleKey 0288 { 0289 public: 0290 0291 //! constructor 0292 ScrollHoleKey( const ColorUtils::Rgba& color, bool vertical, bool smallShadow ): 0293 _color( color.toInt() ), 0294 _vertical( vertical ), 0295 _smallShadow( smallShadow ) 0296 {} 0297 0298 //! equal to operator 0299 bool operator == (const ScrollHoleKey& other ) const 0300 { 0301 return 0302 _color == other._color && 0303 _vertical == other._vertical && 0304 _smallShadow == other._smallShadow; 0305 } 0306 0307 //! less than operator 0308 bool operator < (const ScrollHoleKey& other ) const 0309 { 0310 if( _color != other._color ) return _color < other._color; 0311 else if( _vertical != other._vertical ) return _vertical < other._vertical; 0312 else return _smallShadow < other._smallShadow; 0313 } 0314 0315 private: 0316 0317 guint32 _color; 0318 bool _vertical; 0319 bool _smallShadow; 0320 0321 //! streamer 0322 friend std::ostream& operator << ( std::ostream& out, const ScrollHoleKey& key ) 0323 { 0324 out << "ScrollHoleKey -" 0325 << " color: " << key._color 0326 << " vertical: " << (key._vertical ? "true":"false") 0327 << " smallShadow: " << (key._smallShadow ? "true":"false"); 0328 return out; 0329 } 0330 0331 }; 0332 0333 //! key for scrollbar handles 0334 class ScrollHandleKey 0335 { 0336 public: 0337 0338 //! constructor 0339 ScrollHandleKey( const ColorUtils::Rgba& color, const ColorUtils::Rgba& glow, int size ): 0340 _color( color.toInt() ), 0341 _glow( glow.toInt() ), 0342 _size( size ) 0343 {} 0344 0345 //! equal to operator 0346 bool operator == (const ScrollHandleKey& other ) const 0347 { 0348 return 0349 _color == other._color && 0350 _glow == other._glow && 0351 _size == other._size; 0352 } 0353 0354 //! less than operator 0355 bool operator < (const ScrollHandleKey& other ) const 0356 { 0357 if( _color != other._color ) return _color < other._color; 0358 else if( _glow != other._glow ) return _glow < other._glow; 0359 else return _size < other._size; 0360 } 0361 0362 private: 0363 0364 guint32 _color; 0365 guint32 _glow; 0366 int _size; 0367 0368 //! streamer 0369 friend std::ostream& operator << ( std::ostream& out, const ScrollHandleKey& key ) 0370 { 0371 out << "ScrollHandleKey -" 0372 << " color: " << key._color 0373 << " glow: " << key._glow 0374 << " size: " << key._size; 0375 return out; 0376 } 0377 0378 }; 0379 0380 //@} 0381 0382 //! key for focused slits 0383 class SlitFocusedKey 0384 { 0385 public: 0386 0387 //! constructor 0388 SlitFocusedKey( const ColorUtils::Rgba& color ): 0389 _color( color.toInt() ) 0390 {} 0391 0392 //! equal to operator 0393 bool operator == (const SlitFocusedKey& other ) const 0394 { return _color == other._color; } 0395 0396 //! less than operator 0397 bool operator < (const SlitFocusedKey& other ) const 0398 { return _color < other._color; } 0399 0400 private: 0401 0402 guint32 _color; 0403 0404 //! streamer 0405 friend std::ostream& operator << ( std::ostream& out, const SlitFocusedKey& key ) 0406 { 0407 out << "SlitFocusedKey - color: " << key._color; 0408 return out; 0409 } 0410 0411 }; 0412 0413 //@} 0414 0415 //! key for docks 0416 class DockFrameKey 0417 { 0418 public: 0419 0420 //! constructor 0421 DockFrameKey( const ColorUtils::Rgba& top, const ColorUtils::Rgba& bottom ): 0422 _top( top.toInt() ), 0423 _bottom( bottom.toInt() ) 0424 {} 0425 0426 //! equal to operator 0427 bool operator == (const DockFrameKey& other ) const 0428 { 0429 return 0430 _top == other._top && 0431 _bottom == other._bottom; 0432 } 0433 0434 //! less than operator 0435 bool operator < (const DockFrameKey& other ) const 0436 { 0437 if( _top != other._top ) return _top < other._top; 0438 else return _bottom < other._bottom; 0439 } 0440 0441 private: 0442 0443 guint32 _top; 0444 guint32 _bottom; 0445 0446 //! streamer 0447 friend std::ostream& operator << ( std::ostream& out, const DockFrameKey& key ) 0448 { 0449 out << "DockFrameKey - top color: " << key._top << " bottom color: " << key._bottom; 0450 return out; 0451 } 0452 0453 }; 0454 0455 //! key for grooves 0456 class GrooveKey 0457 { 0458 public: 0459 0460 //! constructor 0461 GrooveKey( const ColorUtils::Rgba& color, int size ): 0462 _color( color.toInt() ), 0463 _size( size ) 0464 {} 0465 0466 //! equal to operator 0467 bool operator == (const GrooveKey& other ) const 0468 { 0469 return 0470 _color == other._color && 0471 _size == other._size; 0472 } 0473 0474 //! less than operator 0475 bool operator < (const GrooveKey& other ) const 0476 { 0477 if( _color != other._color ) return _color < other._color; 0478 else return _size < other._size; 0479 } 0480 0481 private: 0482 0483 guint32 _color; 0484 int _size; 0485 0486 //! streamer 0487 friend std::ostream& operator << ( std::ostream& out, const GrooveKey& key ) 0488 { 0489 out << "GrooveKey - color: " << key._color << " size: " << key._size; 0490 return out; 0491 } 0492 0493 }; 0494 0495 //! key for selection rects 0496 class SelectionKey 0497 { 0498 public: 0499 0500 //! constructor 0501 SelectionKey( const ColorUtils::Rgba& color, int size, bool custom ): 0502 _color( color.toInt() ), 0503 _size( size ), 0504 _custom( custom ) 0505 {} 0506 0507 //! equal to operator 0508 bool operator == (const SelectionKey& other ) const 0509 { 0510 return 0511 _color == other._color && 0512 _size == other._size && 0513 _custom == other._custom; 0514 } 0515 0516 //! less than operator 0517 bool operator < (const SelectionKey& other ) const 0518 { 0519 0520 if( _color != other._color ) return _color < other._color; 0521 else if( _size != other._size ) return _size < other._size; 0522 else return _custom < other._custom; 0523 0524 } 0525 0526 private: 0527 0528 guint32 _color; 0529 int _size; 0530 bool _custom; 0531 0532 //! streamer 0533 friend std::ostream& operator << ( std::ostream& out, const SelectionKey& key ) 0534 { 0535 out << "SelectionKey - color: " << key._color << " size: " << key._size << " custom: " << ( key._custom ? "true":"false" ); 0536 return out; 0537 } 0538 0539 }; 0540 0541 //! key for progressbar indicator 0542 class ProgressBarIndicatorKey 0543 { 0544 public: 0545 0546 //! constructor 0547 ProgressBarIndicatorKey( const ColorUtils::Rgba& color, const ColorUtils::Rgba& glow, int width, int height ): 0548 _color( color.toInt() ), 0549 _glow( glow.toInt() ), 0550 _width( width ), 0551 _height( height ) 0552 {} 0553 0554 //! equal to operator 0555 bool operator == (const ProgressBarIndicatorKey& other ) const 0556 { 0557 return 0558 _color == other._color && 0559 _glow == other._glow && 0560 _width == other._width && 0561 _height == other._height; 0562 } 0563 0564 //! less than operator 0565 bool operator < (const ProgressBarIndicatorKey& other ) const 0566 { 0567 if( _color != other._color ) return _color < other._color; 0568 else if( _glow != other._glow ) return _glow < other._glow; 0569 else if( _width != other._width ) return _width < other._width; 0570 else return _height < other._height; 0571 } 0572 0573 private: 0574 0575 guint32 _color; 0576 guint32 _glow; 0577 int _width; 0578 int _height; 0579 0580 //! streamer 0581 friend std::ostream& operator << ( std::ostream& out, const ProgressBarIndicatorKey& key ) 0582 { 0583 out << "ProgressBarIndicatorKey - color: " << key._color << " glow: " << key._glow << " width: " << key._width << " height: " << key._height; 0584 return out; 0585 } 0586 }; 0587 0588 //! key for windeco buttons 0589 /*! keys are used to store tilesets into cache */ 0590 class WindecoButtonKey 0591 { 0592 public: 0593 0594 //! constructor 0595 WindecoButtonKey( const ColorUtils::Rgba& color, int size, bool pressed ): 0596 _color( color.toInt() ), 0597 _size( size ), 0598 _pressed( pressed ) 0599 {} 0600 0601 //! equal to operator 0602 bool operator == (const WindecoButtonKey& other ) const 0603 { 0604 return 0605 _color == other._color && 0606 _size == other._size && 0607 _pressed == other._pressed; 0608 } 0609 0610 //! less than operator 0611 bool operator < (const WindecoButtonKey& other ) const 0612 { 0613 if( _color != other._color ) return _color < other._color; 0614 else if( _size != other._size ) return _size < other._size; 0615 else return _pressed < other._pressed; 0616 } 0617 0618 private: 0619 0620 guint32 _color; 0621 int _size; 0622 bool _pressed; 0623 0624 //! streamer 0625 friend std::ostream& operator << ( std::ostream& out, const WindecoButtonKey& key ) 0626 { 0627 out << "WindecoButtonKey - color: " << key._color << " size: " << key._size << " pressed: " << key._pressed; 0628 return out; 0629 } 0630 0631 }; 0632 0633 //! key for windeco buttons 0634 /*! keys are used to store tilesets into cache */ 0635 class WindecoButtonGlowKey 0636 { 0637 public: 0638 0639 //! constructor 0640 WindecoButtonGlowKey( const ColorUtils::Rgba& color, int size ): 0641 _color( color.toInt() ), 0642 _size( size ) 0643 {} 0644 0645 //! equal to operator 0646 bool operator == (const WindecoButtonGlowKey& other ) const 0647 { 0648 return 0649 _color == other._color && 0650 _size == other._size; 0651 } 0652 0653 //! less than operator 0654 bool operator < (const WindecoButtonGlowKey& other ) const 0655 { 0656 if( _color != other._color ) return _color < other._color; 0657 else return _size < other._size; 0658 } 0659 0660 private: 0661 0662 guint32 _color; 0663 int _size; 0664 0665 //! streamer 0666 friend std::ostream& operator << ( std::ostream& out, const WindecoButtonGlowKey& key ) 0667 { 0668 out << "WindecoButtonGlowKey - color: " << key._color << " size: " << key._size; 0669 return out; 0670 } 0671 0672 }; 0673 0674 //! key for window shadows 0675 /*! keys are used to store tilesets into cache */ 0676 class WindowShadowKey 0677 { 0678 0679 public: 0680 0681 //! explicit constructor 0682 explicit WindowShadowKey( void ): 0683 active(false), 0684 useOxygenShadows(true), 0685 isShade(false), 0686 hasTitleOutline(false), 0687 hasTopBorder( true ), 0688 hasBottomBorder( true ) 0689 {} 0690 0691 //! equal to operator 0692 bool operator == (const WindowShadowKey& other) const 0693 { 0694 return 0695 ( active == other.active ) && 0696 ( useOxygenShadows == other.useOxygenShadows ) && 0697 ( isShade == other.isShade ) && 0698 ( hasTitleOutline == other.hasTitleOutline ) && 0699 ( hasTopBorder == other.hasTopBorder ) && 0700 ( hasBottomBorder == other.hasBottomBorder ); 0701 0702 } 0703 0704 //! less than operator 0705 bool operator < (const WindowShadowKey& other) const 0706 { 0707 if( active != other.active ) return active < other.active; 0708 else if( useOxygenShadows != other.useOxygenShadows ) return useOxygenShadows < other.useOxygenShadows; 0709 else if( isShade != other.isShade ) return isShade < other.isShade; 0710 else if( hasTitleOutline != other.hasTitleOutline ) return hasTitleOutline < other.hasTitleOutline; 0711 else if( hasTopBorder != other.hasTopBorder ) return hasTopBorder < other.hasTopBorder; 0712 else return hasBottomBorder < other.hasBottomBorder; 0713 } 0714 0715 bool active; 0716 bool useOxygenShadows; 0717 bool isShade; 0718 bool hasTitleOutline; 0719 bool hasTopBorder; 0720 bool hasBottomBorder; 0721 0722 }; 0723 0724 //! key for window background vertical gradient 0725 class VerticalGradientKey 0726 { 0727 public: 0728 0729 //! constructor 0730 VerticalGradientKey( const ColorUtils::Rgba& color, int size ): 0731 _color( color.toInt() ), 0732 _size( size ) 0733 {} 0734 0735 //! equal to operator 0736 bool operator == (const VerticalGradientKey& other ) const 0737 { 0738 return 0739 _color == other._color && 0740 _size == other._size; 0741 } 0742 0743 //! less than operator 0744 bool operator < (const VerticalGradientKey& other ) const 0745 { 0746 if( _color != other._color ) return _color < other._color; 0747 else return _size < other._size; 0748 } 0749 0750 private: 0751 0752 guint32 _color; 0753 int _size; 0754 0755 //! streamer 0756 friend std::ostream& operator << ( std::ostream& out, const VerticalGradientKey& key ) 0757 { 0758 out << "VerticalGradientKey - color: " << key._color << " size: " << key._size; 0759 return out; 0760 } 0761 0762 }; 0763 0764 //! key for window background radial gradient 0765 typedef VerticalGradientKey RadialGradientKey; 0766 0767 //! key for left windeco border 0768 class WindecoBorderKey 0769 { 0770 public: 0771 0772 //! constructor 0773 WindecoBorderKey( WinDeco::Options wopt, const int width, const int height, bool gradient ): 0774 _wopt(wopt), 0775 _width(width), 0776 _height(height), 0777 _gradient(gradient) 0778 {} 0779 0780 //! equal to operator 0781 bool operator == (const WindecoBorderKey& other) const 0782 { 0783 return _width == other._width && 0784 _height == other._height && 0785 _wopt == other._wopt && 0786 _gradient == other._gradient; 0787 } 0788 0789 //! less than operator 0790 bool operator < (const WindecoBorderKey& other) const 0791 { 0792 if( _width != other._width ) return _width < other._width; 0793 else if( _height != other._height ) return _height < other._height; 0794 else if( _gradient != other._gradient ) return _gradient < other._gradient; 0795 else return _wopt < other._wopt; 0796 } 0797 0798 private: 0799 0800 WinDeco::Options _wopt; 0801 int _width; 0802 int _height; 0803 bool _gradient; 0804 }; 0805 0806 //! key for other windeco borders 0807 typedef WindecoBorderKey WindecoLeftBorderKey; 0808 typedef WindecoBorderKey WindecoRightBorderKey; 0809 typedef WindecoBorderKey WindecoTopBorderKey; 0810 typedef WindecoBorderKey WindecoBottomBorderKey; 0811 0812 //! key for dock widget button 0813 class DockWidgetButtonKey 0814 { 0815 public: 0816 0817 //! constructor 0818 DockWidgetButtonKey( const ColorUtils::Rgba& base, bool pressed, int size ): 0819 _base(base.toInt()), 0820 _pressed(pressed), 0821 _size(size) 0822 {} 0823 0824 //! equal to operator 0825 bool operator == (const DockWidgetButtonKey& other) const 0826 { 0827 return _base == other._base && 0828 _pressed == other._pressed && 0829 _size == other._size; 0830 } 0831 0832 //! less than operator 0833 bool operator < (const DockWidgetButtonKey& other) const 0834 { 0835 if( _base != other._base ) return _base < other._base; 0836 else if( _pressed != other._pressed ) return _pressed < other._pressed; 0837 else return _size < other._size; 0838 } 0839 0840 private: 0841 0842 guint32 _base; 0843 bool _pressed; 0844 int _size; 0845 }; 0846 0847 } 0848 0849 #endif