PageView.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // _____ _
  2. // |_ _| |_ _ _ ___ ___ _ __ __ _
  3. // | | | ' \| '_/ -_) -_) ' \/ _` |_
  4. // |_| |_||_|_| \___\___|_|_|_\__,_(_)
  5. //
  6. // Threema iOS Client
  7. // Copyright (c) 2015-2020 Threema GmbH
  8. //
  9. // This program is free software: you can redistribute it and/or modify
  10. // it under the terms of the GNU Affero General Public License, version 3,
  11. // as published by the Free Software Foundation.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU Affero General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Affero General Public License
  19. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. #import <UIKit/UIKit.h>
  21. #import <Foundation/Foundation.h>
  22. #define MAX_ANIMATION_DURATION 0.3
  23. #define MIN_PAGE_PAN_POINTS 50.0
  24. #define MIN_PAGE_PAN_SPEED 150.0
  25. #define DEFAULT_PAGE_GAP 5.0
  26. #define DEFAULT_PARALLAX_FACTOR 1.0/10.0
  27. typedef enum PagingDirection {
  28. LEFT,
  29. RIGHT
  30. } PagingDirection;
  31. @protocol PageViewDataSource
  32. - (UIView *) currentView: (CGRect) frame;
  33. - (UIView *) nextView: (CGRect) frame;
  34. - (UIView *) previousView: (CGRect) frame;
  35. - (BOOL) moveToPrevious;
  36. - (BOOL) moveToNext;
  37. @end
  38. @protocol PageViewDelegate
  39. - (void) willPageFrom: (UIView *) fromView toView: (UIView *) toView;
  40. - (void) didPageFrom: (UIView *) fromView toView: (UIView *) toView;
  41. @end
  42. @interface PageView : UIView
  43. @property (nonatomic) id<PageViewDataSource> datasource;
  44. @property (weak, nonatomic) NSObject<PageViewDelegate> *delegate;
  45. @property (nonatomic) UIView *bgView;
  46. @property (nonatomic) UIView *centerView;
  47. @property (nonatomic) UIView *leftView;
  48. @property (nonatomic) UIView *rightView;
  49. @property CGFloat pageGap;
  50. @property CGFloat parallaxFactor;
  51. - (void) resetPageFrames;
  52. - (void) reset;
  53. - (void) pageRight;
  54. - (void) pageLeft;
  55. - (void) enablePanGesture:(BOOL)enablePan;
  56. @end