00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef PGSCROLLFRAME_H
00016 #define PGSCROLLFRAME_H
00017
00018 #include "pandabase.h"
00019
00020 #include "pgVirtualFrame.h"
00021 #include "pgSliderBarNotify.h"
00022 #include "pgSliderBar.h"
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 class EXPCL_PANDA_PGUI PGScrollFrame : public PGVirtualFrame, public PGSliderBarNotify {
00040 PUBLISHED:
00041 PGScrollFrame(const string &name = "");
00042 virtual ~PGScrollFrame();
00043
00044 protected:
00045 PGScrollFrame(const PGScrollFrame ©);
00046
00047 public:
00048 virtual PandaNode *make_copy() const;
00049 virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data);
00050 virtual void xform(const LMatrix4 &mat);
00051
00052 PUBLISHED:
00053 void setup(PN_stdfloat width, PN_stdfloat height,
00054 PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top,
00055 PN_stdfloat slider_width, PN_stdfloat bevel);
00056
00057 INLINE void set_virtual_frame(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top);
00058 INLINE void set_virtual_frame(const LVecBase4 &virtual_frame);
00059 INLINE const LVecBase4 &get_virtual_frame() const;
00060 INLINE bool has_virtual_frame() const;
00061 INLINE void clear_virtual_frame();
00062
00063 INLINE void set_manage_pieces(bool manage_pieces);
00064 INLINE bool get_manage_pieces() const;
00065
00066 INLINE void set_auto_hide(bool auto_hide);
00067 INLINE bool get_auto_hide() const;
00068
00069 INLINE void set_horizontal_slider(PGSliderBar *horizontal_slider);
00070 INLINE void clear_horizontal_slider();
00071 INLINE PGSliderBar *get_horizontal_slider() const;
00072
00073 INLINE void set_vertical_slider(PGSliderBar *vertical_slider);
00074 INLINE void clear_vertical_slider();
00075 INLINE PGSliderBar *get_vertical_slider() const;
00076
00077 void remanage();
00078 INLINE void recompute();
00079
00080 protected:
00081 virtual void frame_changed();
00082
00083 virtual void item_transform_changed(PGItem *item);
00084 virtual void item_frame_changed(PGItem *item);
00085 virtual void item_draw_mask_changed(PGItem *item);
00086 virtual void slider_bar_adjust(PGSliderBar *slider_bar);
00087
00088 private:
00089 void recompute_clip();
00090
00091 void recompute_canvas();
00092 PN_stdfloat interpolate_canvas(PN_stdfloat clip_min, PN_stdfloat clip_max,
00093 PN_stdfloat canvas_min, PN_stdfloat canvas_max,
00094 PGSliderBar *slider_bar);
00095
00096 private:
00097 bool _needs_remanage;
00098 bool _needs_recompute_clip;
00099 bool _needs_recompute_canvas;
00100
00101 LVecBase4 _orig_clip_frame;
00102
00103 bool _has_virtual_frame;
00104 LVecBase4 _virtual_frame;
00105
00106 bool _manage_pieces;
00107 bool _auto_hide;
00108
00109 PT(PGSliderBar) _horizontal_slider;
00110 PT(PGSliderBar) _vertical_slider;
00111
00112 public:
00113 static TypeHandle get_class_type() {
00114 return _type_handle;
00115 }
00116 static void init_type() {
00117 PGVirtualFrame::init_type();
00118 register_type(_type_handle, "PGScrollFrame",
00119 PGVirtualFrame::get_class_type());
00120 }
00121 virtual TypeHandle get_type() const {
00122 return get_class_type();
00123 }
00124 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00125
00126 private:
00127 static TypeHandle _type_handle;
00128 };
00129
00130 #include "pgScrollFrame.I"
00131
00132 #endif