diff options
author | elfmz <fenix1905@tut.by> | 2021-12-31 00:27:16 +0300 |
---|---|---|
committer | elfmz <fenix1905@tut.by> | 2021-12-31 02:27:02 +0300 |
commit | a14dc1a81c797928d4f1b7d6a6b46ecc63f98308 (patch) | |
tree | c27c61ac33582bc4d469c6608cd042add388f230 /far2l/src/frame.hpp | |
parent | d5f1bf245e96834d44390d1723cfef3dfbb1fb02 (diff) |
shuffle a bit far2l sources
Diffstat (limited to 'far2l/src/frame.hpp')
-rw-r--r-- | far2l/src/frame.hpp | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/far2l/src/frame.hpp b/far2l/src/frame.hpp new file mode 100644 index 00000000..867186e1 --- /dev/null +++ b/far2l/src/frame.hpp @@ -0,0 +1,130 @@ +#pragma once + +/* +frame.hpp + +Немодальное окно (базовый класс для FilePanels, FileEditor, FileViewer) +*/ +/* +Copyright (c) 1996 Eugene Roshal +Copyright (c) 2000 Far Group +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the authors may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "scrobj.hpp" +#include "FARString.hpp" + + +class KeyBar; + +// ПРОСЬБА НЕ ЗАБЫВАТЬ СИНХРОНИЗИРОВАТЬ ИЗМЕНЕНИЯ +// WTYPE_* (plugin.hpp) и MODALTYPE_*!!! +// (и не надо убирать этот комментарий, пока ситуация не изменится ;) +enum +{ + MODALTYPE_VIRTUAL, + MODALTYPE_PANELS=1, + MODALTYPE_VIEWER, + MODALTYPE_EDITOR, + MODALTYPE_DIALOG, + MODALTYPE_VMENU, + MODALTYPE_HELP, + MODALTYPE_COMBOBOX, + MODALTYPE_FINDFOLDER, + MODALTYPE_USER, +}; + +class Frame: public ScreenObject +{ + friend class Manager; + private: +// Frame **ModalStack; +// int ModalStackCount, ModalStackSize; + Frame *FrameToBack; + Frame *NextModal,*PrevModal; + bool RegularIdle = false; + + protected: + int DynamicallyBorn; + int CanLoseFocus; + int ExitCode; + int KeyBarVisible; + int TitleBarVisible; + KeyBar *FrameKeyBar; + int MacroMode; + + public: + Frame(); + virtual ~Frame(); + +// virtual int ProcessKey(int Key); +// virtual int ProcessMouse(MOUSE_EVENT_RECORD *MouseEvent); + + virtual int GetCanLoseFocus(int DynamicMode=FALSE) { return(CanLoseFocus); }; + void SetCanLoseFocus(int Mode) { CanLoseFocus=Mode; }; + void SetRegularIdle(bool enabled); + int GetExitCode() { return ExitCode; }; + virtual void SetExitCode(int Code) { ExitCode=Code; }; + + virtual BOOL IsFileModified() const { return FALSE; }; + + virtual const wchar_t *GetTypeName() {return L"[FarModal]";}; + virtual int GetTypeAndName(FARString &strType, FARString &strName) {return(MODALTYPE_VIRTUAL);}; + virtual int GetType() { return MODALTYPE_VIRTUAL; } + + virtual void OnDestroy(); // вызывается перед уничтожением окна + virtual void OnCreate() {}; // вызывается перед созданием окна + virtual void OnChangeFocus(int focus); // вызывается при смене фокуса + virtual void Refresh() {OnChangeFocus(1);}; // Просто перерисоваться :) + + virtual void InitKeyBar() {} + void SetKeyBar(KeyBar *FrameKeyBar); + void UpdateKeyBar(); + virtual void RedrawKeyBar() { Frame::UpdateKeyBar(); }; + + int IsTitleBarVisible() const {return TitleBarVisible;}; + + /* $ 12.05.2001 DJ */ + int IsTopFrame(); + virtual int GetMacroMode() { return MacroMode; } + /* DJ $ */ + void Push(Frame* Modalized); + Frame *GetTopModal() {return NextModal;}; +// bool Pop(); +// Frame *operator[](int Index); +// int operator[](Frame *ModalFarame); +// int ModalCount() {return ModalStackCount;} + void DestroyAllModal(); + void SetDynamicallyBorn(int Born) {DynamicallyBorn=Born;} + int GetDynamicallyBorn() {return DynamicallyBorn;}; + virtual int FastHide(); +// int IndexOf(Frame *aFrame); + bool RemoveModal(Frame *aFrame); + virtual void ResizeConsole(); + bool HasSaveScreen(); +// bool ifFullConsole(); + virtual FARString &GetTitle(FARString &Title,int SubLen=-1,int TruncSize=0) { return Title; }; + virtual bool ProcessEvents() {return true;}; +}; |