/usr/include/wxsmith/wxwidgets/wxsitemeditorcontent.h is in libwxsmithlib-dev 13.12+dfsg-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | /*
* This file is part of wxSmith plugin for Code::Blocks Studio
* Copyright (C) 2006-2007 Bartlomiej Swiecki
*
* wxSmith is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* wxSmith is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with wxSmith. If not, see <http://www.gnu.org/licenses/>.
*
* $Revision: 8307 $
* $Id: wxsitemeditorcontent.h 8307 2012-08-31 21:05:19Z mortenmacfly $
* $HeadURL: http://svn.code.sf.net/p/codeblocks/code/branches/release-xx.yy/src/plugins/contrib/wxSmith/wxwidgets/wxsitemeditorcontent.h $
*/
#ifndef WXSITEMEDITORCONTENT_H
#define WXSITEMEDITORCONTENT_H
#include "wxsdrawingwindow.h"
class wxsItemEditorDragAssist;
class wxsItemResData;
class wxsItemEditor;
class wxsItemInfo;
class wxsParent;
class wxsItem;
/** \brief Class with window editor content (graphical area for editing resource) */
class wxsItemEditorContent: public wxsDrawingWindow
{
public:
/** \brief Ctor */
wxsItemEditorContent(wxWindow* Parent,wxsItemResData* Data,wxsItemEditor* Editor);
/** \brief Dctor */
virtual ~wxsItemEditorContent();
/** \brief Function shiwch must be called before changing preview */
void BeforePreviewChanged();
/** \brief Function which must be called after changing preview */
void AfterPreviewChanged();
/** \brief Function refreshing current selection (calculating new positions) */
void RefreshSelection();
/** \brief Starting sequence of adding new item by pointing with mouse */
void InsertByPointing(const wxsItemInfo* Info);
protected:
/** \brief painting additional stuff */
virtual void PaintExtra(wxDC* DC);
/** \brief Using post-screenshoot procedure to get item's placement */
virtual void ScreenShootTaken();
private:
/** \brief Enum type describing placement of drag box */
enum DragBoxType
{
LeftTop = 0,
Top,
RightTop,
Left,
Right,
LeftBtm,
Btm,
RightBtm,
/*************/
DragBoxTypeCnt
};
/** \brief enum for available mouse states */
enum MouseStatesT
{
msIdle,
msDraggingPointInit,
msDraggingPoint,
msDraggingItemInit,
msDraggingItem,
msTargetSearch,
msWaitForIdle,
};
/** \brief Structure describing one dragging point */
struct DragPointData
{
wxsItem* Item; ///< \brief Associated item
DragBoxType Type; ///< \brief Type of this drag box
bool Grey; ///< \brief If true, this drag point will be drawn grey
int PosX; ///< \brief X position of this drag point
int PosY; ///< \brief Y position of this drag point
int DragInitPosX; ///< \brief X position before dragging
int DragInitPosY; ///< \brief Y position before dragging
DragPointData* ItemPoints[DragBoxTypeCnt]; ///< \brief Pointers to all drag points for this item
};
/** \brief Declaration of vector containing all drag points */
WX_DEFINE_ARRAY(DragPointData*,DragPointsT);
/** \brief Structure containing rect for each item */
WX_DECLARE_VOIDPTR_HASH_MAP(wxRect,ItemToRectT);
/** \brief Structure containing wxWindow for each item */
WX_DECLARE_VOIDPTR_HASH_MAP(wxWindow*,ItemToWindowT);
wxsItemResData* m_Data; ///< \brief Data of handled resource
wxsItemEditor* m_Editor; ///< \brief Main editor class
DragPointsT m_DragPoints; ///< \brief Array of visible drag points
ItemToRectT m_ItemToRect; ///< \brief Coordinates of each item stored here
ItemToWindowT m_ItemToWindow; ///< \brief Window in editor area for each item is stored here
bool m_RebuildMaps; ///< \brief Set to true when internal maps need to be recalculated
MouseStatesT m_MouseState; ///< \brief Current mouse state
static const int m_DragBoxSize = 6; ///< \brief Size of boxes used to drag borders of widgets
static const int m_MinDragDistance = 8; ///< \brief Minimal distance which must be done to apply dragging
DragPointData* m_CurDragPoint; ///< \brief Dragged drag point
wxsItem* m_CurDragItem; ///< \brief Dragged item
int m_DragInitPosX; ///< \brief Initial mouse x position when dragging
int m_DragInitPosY; ///< \brief Initial mouse y position when dragging
wxsItemEditorDragAssist* m_Assist; ///< \brief Assisting class
wxsItem* m_AssistTarget;
wxsParent* m_AssistParent;
bool m_AssistAddAfter;
const wxsItemInfo* m_TargetInfo; ///< \brief Info of item added by pointing with mouse
int m_TargetX;
int m_TargetY;
/** \brief Processing mouse events */
void OnMouse(wxMouseEvent& event);
void OnMouseIdle(wxMouseEvent& event);
void OnMouseDraggingPoint(wxMouseEvent& event);
void OnMouseDraggingPointInit(wxMouseEvent& event);
void OnMouseDraggingItem(wxMouseEvent& event);
void OnMouseDraggingItemInit(wxMouseEvent& event);
void OnMouseTargetSearch(wxMouseEvent& event);
/** \brief Processing mouse events */
void OnKeyDown(wxKeyEvent& event);
#if wxCHECK_VERSION(2, 9, 0)
inline void SetCur(wxStockCursor Cur) { SetCursor(wxCursor(Cur)); }
#else
inline void SetCur(int Cur) { SetCursor(wxCursor(Cur)); }
#endif
void RebuildDragPoints();
void ClearDragPoints();
void GreyDragPoints();
void AddDragPoints(wxsItem* Item,wxsItem* RootSelection);
void UpdateDragPoints(DragPointData* anyPoint);
wxsItem* FindItemAtPos(int PosX,int PosY,wxsItem* SearchIn);
DragPointData* FindDragPointAtPos(int PosX,int PosY);
DragPointData* FindDragPointFromItem(wxsItem* Item);
/** \brief Searching for new parent item during item dragging mode */
bool FindDraggingItemTarget(int PosX,int PosY,wxsItem* Dragging,wxsParent*& NewParent,wxsItem*& AtCursor,bool& AddAfter);
/** \brief Getting bounding rect for given item */
bool FindAbsoluteRect(wxsItem* Item,int& PosX,int& PosY,int& SizeX,int& SizeY);
/** \brief Getting preview window for given item */
wxWindow* GetPreviewWindow(wxsItem* Item);
/** \brief Function clearing ItemToRect and ItemToWindow maps */
void ClearMaps();
/** \brief Function updating ItemToRect and ItemToWindow maps */
void RecalculateMaps();
void RecalculateMapsReq(wxsItem* Item);
/** \brief Adding item in point-by-mouse mode */
void AddItemAtTarget(wxsParent* AssistParent,int Position,const wxsItemInfo* Info,int PosX,int PosY);
/** \brief Snappign coordinates to grid if necessary for coordinates relative to parent */
void GridFixup(wxWindow* PreviewWindow,int& PosX,int& PosY);
/** \brief Snapping coordinates to grid if necessary for global coordinates */
void GridFixupForGlobalCoordinates(int& PosX,int& PosY,wxsItem* Owner);
/** \brief Checking if we're using continuous insert mode */
static bool IsContinousInsert();
friend class wxsItemEditorDragAssist;
DECLARE_EVENT_TABLE()
};
#endif
|