child_frame.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:7k
- /*
- * ===========================================================================
- * PRODUCTION $Log: child_frame.hpp,v $
- * PRODUCTION Revision 1000.0 2003/10/31 22:36:59 gouriano
- * PRODUCTION PRODUCTION: IMPORTED [ORIGINAL] Dev-tree R1.5
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_WIDGETS_TOPLEVEL___CHILD_FRAME__HPP
- #define GUI_WIDGETS_TOPLEVEL___CHILD_FRAME__HPP
- /* $Id: child_frame.hpp,v 1000.0 2003/10/31 22:36:59 gouriano Exp $
- * ===========================================================================
- *
- * PUBLIC DOMAIN NOTICE
- * National Center for Biotechnology Information
- *
- * This software/database is a "United States Government Work" under the
- * terms of the United States Copyright Act. It was written as part of
- * the author's official duties as a United States Government employee and
- * thus cannot be copyrighted. This software/database is freely available
- * to the public for use. The National Library of Medicine and the U.S.
- * Government have not placed any restriction on its use or reproduction.
- *
- * Although all reasonable efforts have been taken to ensure the accuracy
- * and reliability of the software and data, the NLM and the U.S.
- * Government do not and cannot warrant the performance or results that
- * may be obtained by using this software or data. The NLM and the U.S.
- * Government disclaim all warranties, express or implied, including
- * warranties of performance, merchantability or fitness for any particular
- * purpose.
- *
- * Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- * Authors: Mike DiCuccio
- *
- * File Description:
- * CChildFrame -- internal widget class that represents the frame
- * surrounding a given MDI child
- */
- #include <gui/widgets/toplevel/child.hpp>
- #include <FL/Fl.H>
- #include <FL/Fl_Group.H>
- #include <FL/Fl_Window.H>
- BEGIN_NCBI_SCOPE
- // private internal class for managing child frames
- class CChildFrame : public Fl_Window
- {
- friend class CTopLevel;
- public:
- // enumerated list of possible child window states
- enum EState {
- eNormal,
- eMaximized,
- eMinimized,
- };
- CChildFrame(int x, int y, int w, int h, const char* label = NULL);
- ~CChildFrame();
- // get the current frame window state
- EState GetState (void) const { return m_State; }
- bool GetMaximized(void) const { return (m_State == eMaximized); }
- bool GetMinimized(void) const { return (m_State == eMinimized); }
- // attach / detach this frame to/from a child
- void Attach(CChild* child);
- void Detach(void);
- // FLTK overload: event handler
- int handle(int event);
- // FLTK overload: label
- void label(const char* text);
- const char* label(void) const;
- // accessors
- Fl_Group* GetSysButtons(void) { return m_SysButtons; }
- Fl_Group* GetTitle (void) { return m_Title; }
- Fl_Group* GetTitleBar (void) { return m_TitleBar; }
- // static accessors
- static Fl_Color GetSelectedColor (void);
- static Fl_Boxtype GetSysButtonBox (void);
- static Fl_Color GetSysButtonColor(void);
- static int GetTitleAlign (void);
- static int GetTitleBarHeight(void);
- static Fl_Color GetTitleColor (void);
- static Fl_Font GetTitleFont (void);
- static int GetTitleSize (void);
- static void SetSelectedColor (Fl_Color color);
- static void SetSysButtonBox (Fl_Boxtype box);
- static void SetSysButtonColor(Fl_Color color);
- static void SetTitleAlign (int align);
- static void SetTitleBarHeight(int h);
- static void SetTitleColor (Fl_Color color);
- static void SetTitleFont (Fl_Font font);
- static void SetTitleSize (int h);
- private:
- // group for the title bar
- Fl_Group* m_TitleBar;
- // group for the title itself
- Fl_Group* m_Title;
- // group for the system buttons
- Fl_Group* m_SysButtons;
- // the child we wrap
- CChild* m_Child;
- // state for this frame
- EState m_State;
- // saved position of the window, for restore from minimization /
- // maximization
- int m_SavedPos[4];
- // enumerated values of our current mouse state
- // this controls how we interact with the child frame
- enum EDragState {
- eIdle,
- eMoving,
- eResizing,
- };
- // flags that determine which edges of the window we're dragging
- enum FBorderDrag {
- fLeftBorderDrag = 0x01,
- fRightBorderDrag = 0x02,
- fTopBorderDrag = 0x04,
- fBottomBorderDrag = 0x08,
- };
- typedef int TBorderDrag; // bitmask of FBorderDrag
- // the state of our mouse-window interaction
- EDragState m_DragState;
- // flags that determine which edges of the window we're dragging
- TBorderDrag m_BorderDrag;
- // stored offsets of our window size for delayed drag / move
- // this is used to draw an overlay box
- int m_DragSize[4];
- // last mouse position of our event
- pair<int, int> m_LastMousePos;
- // statics for global look-and-feel
- static Fl_Boxtype sm_SysButtonBox;
- static Fl_Color sm_SysButtonColor;
- static Fl_Color sm_SelectedColor;
- static Fl_Color sm_UnselectedColor;
- static Fl_Font sm_TitleFont;
- static int sm_TitleSize;
- static int sm_TitleAlign;
- static Fl_Color sm_TitleColor;
- static int sm_TitleBarHeight;
- };
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: child_frame.hpp,v $
- * Revision 1000.0 2003/10/31 22:36:59 gouriano
- * PRODUCTION: IMPORTED [ORIGINAL] Dev-tree R1.5
- *
- * Revision 1.5 2003/09/29 15:52:06 dicuccio
- * Deprecated gui/scope.hpp. Merged gui/core/types.hpp into gui/types.hpp
- *
- * Revision 1.4 2003/03/17 14:55:41 dicuccio
- * Lots of clean-up. Fixed memory leaks in test program; added more explicit
- * destruction pathway to support integration into Genome Workbench. Added
- * explicit calls to cascade / tile widgets in a toplevel workspace.
- *
- * Revision 1.3 2003/03/07 18:14:58 dicuccio
- * Code clean-up. Added missing accessors for look-n-feel statics; aligned
- * accessors in code
- *
- * Revision 1.2 2003/03/07 17:49:25 dicuccio
- * Small clean-ups. Added description for each class.
- *
- * Revision 1.1 2003/03/07 17:36:08 dicuccio
- * Initial revision
- *
- * ===========================================================================
- */
- #endif // GUI_WIDGETS_TOPLEVEL___CHILD_FRAME__HPP