/usr/include/codeblocks/scrollingdialog.h is in codeblocks-dev 10.05-2.1.
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 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | /////////////////////////////////////////////////////////////////////////////
// Name: scrollingdialog.h
// Purpose: wxScrollingDialog
// Author: Julian Smart
// Modified by: Jens Lody
// Created: 2007-12-11
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence:
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SCROLLINGDIALOG_H_
#define _WX_SCROLLINGDIALOG_H_
#include "wx/dialog.h"
#include "wx/propdlg.h"
/*!
* Base class for layout adapters - code that, for example, turns a dialog into a
* scrolling dialog if there isn't enough screen space. You can derive further
* adapter classes to do any other kind of adaptation, such as applying a watermark, or adding
* a help mechanism.
*/
class wxScrollingDialog;
class wxDialogHelper;
class wxBoxSizer;
class wxButton;
class wxScrolledWindow;
#if !wxCHECK_VERSION(2,9,0)
class wxDialogLayoutAdapter: public wxObject
{
DECLARE_CLASS(wxDialogLayoutAdapter)
public:
wxDialogLayoutAdapter() {}
/// Override this function to indicate that adaptation should be done
virtual bool CanDoLayoutAdaptation(wxDialogHelper* dialog) = 0;
/// Override this function to do the adaptation
virtual bool DoLayoutAdaptation(wxDialogHelper* dialog) = 0;
};
/*!
* Standard adapter. Does scrolling adaptation for paged and regular dialogs.
*
*/
class wxStandardDialogLayoutAdapter: public wxDialogLayoutAdapter
{
DECLARE_CLASS(wxStandardDialogLayoutAdapter)
public:
wxStandardDialogLayoutAdapter() {}
// Overrides
/// Indicate that adaptation should be done
virtual bool CanDoLayoutAdaptation(wxDialogHelper* dialog);
/// Do layout adaptation
virtual bool DoLayoutAdaptation(wxDialogHelper* dialog);
// Implementation
/// Find a standard or horizontal box sizer
virtual wxSizer* FindButtonSizer(bool stdButtonSizer, wxDialogHelper* dialog, wxSizer* sizer, int& retBorder, int accumlatedBorder = 0);
/// Check if this sizer contains standard buttons, and so can be repositioned in the dialog
virtual bool IsOrdinaryButtonSizer(wxDialogHelper* dialog, wxBoxSizer* sizer);
/// Check if this is a standard button
virtual bool IsStandardButton(wxDialogHelper* dialog, wxButton* button);
/// Find 'loose' main buttons in the existing layout and add them to the standard dialog sizer
virtual bool FindLooseButtons(wxDialogHelper* dialog, wxStdDialogButtonSizer* buttonSizer, wxSizer* sizer, int& count);
/// Reparent the controls to the scrolled window, except those in buttonSizer
virtual void ReparentControls(wxWindow* parent, wxWindow* reparentTo, wxSizer* buttonSizer = NULL);
/// A function to fit the dialog around its contents, and then adjust for screen size.
/// If scrolled windows are passed, scrolling is enabled in the required orientation(s).
virtual bool FitWithScrolling(wxDialog* dialog, wxScrolledWindow* scrolledWindow);
virtual bool FitWithScrolling(wxDialog* dialog, wxWindowList& windows);
/// Find whether scrolling will be necessary for the dialog, returning wxVERTICAL, wxHORIZONTAL or both
virtual int MustScroll(wxDialog* dialog, wxSize& windowSize, wxSize& displaySize);
};
/*!
* A base class for dialogs that have adaptation. In wxWidgets 3.0, this will not
* be needed since the new functionality will be implemented in wxDialogBase.
*/
class wxDialogHelper
{
public:
wxDialogHelper(wxDialog* dialog = NULL) { Init(); m_dialog = dialog; }
virtual ~wxDialogHelper() {}
void Init();
void SetDialog(wxDialog* dialog) { m_dialog = dialog; }
wxDialog* GetDialog() const { return m_dialog; }
/// Do the adaptation
virtual bool DoLayoutAdaptation();
/// Can we do the adaptation?
virtual bool CanDoLayoutAdaptation();
/// Returns a content window if there is one
virtual wxWindow* GetContentWindow() const { return NULL; }
/// Add an id to the list of custom button identifiers that should be in the button sizer
void AddButtonId(wxWindowID id) { m_buttonIds.Add((int) id); }
wxArrayInt& GetButtonIds() { return m_buttonIds; }
/// Is this id in the custom button id array?
bool IsUserButtonId(wxWindowID id) { return (m_buttonIds.Index((int) id) != wxNOT_FOUND); }
// ACCESSORS
/// Level of adaptation, from none (Level 0) to full (Level 3). To disable adaptation,
/// set level 0, for example in your dialog constructor. You might
/// do this if you know that you are displaying on a large screen and you don't want the
/// dialog changed.
void SetLayoutAdaptationLevel(int level) { m_layoutAdaptationLevel = level; }
/// Get level of adaptation
int GetLayoutAdaptationLevel() const { return m_layoutAdaptationLevel; }
/// Returns true if the adaptation has been done
void SetLayoutAdaptationDone(bool adaptationDone) { m_layoutLayoutAdaptationDone = adaptationDone; }
bool GetLayoutAdaptationDone() const { return m_layoutLayoutAdaptationDone; }
/// Set layout adapter class, returning old adapter
static wxDialogLayoutAdapter* SetLayoutAdapter(wxDialogLayoutAdapter* adapter);
static wxDialogLayoutAdapter* GetLayoutAdapter() { return sm_layoutAdapter; }
/// Global switch for layout adaptation
static bool GetLayoutAdaptation() { return sm_layoutAdaptation; }
static void SetLayoutAdaptation(bool enable) { sm_layoutAdaptation = enable; }
protected:
wxDialog* m_dialog;
bool m_layoutLayoutAdaptationDone;
wxArrayInt m_buttonIds;
int m_layoutAdaptationLevel;
static wxDialogLayoutAdapter* sm_layoutAdapter;
static bool sm_layoutAdaptation;
};
#endif //#if !wxCHECK_VERSION(2,9,0)
/*!
* A class that makes its content scroll if necessary
*/
class wxScrollingDialog: public wxDialog
#if !wxCHECK_VERSION(2,9,0)
, public wxDialogHelper
#endif
{
DECLARE_CLASS(wxScrollingDialog)
public:
wxScrollingDialog()
{
#if !wxCHECK_VERSION(2,9,0)
Init();
#else
SetLayoutAdaptationMode(wxDIALOG_ADAPTATION_MODE_ENABLED);
#endif
}
wxScrollingDialog(wxWindow *parent,
int id = wxID_ANY,
const wxString& title = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE,
const wxString& name = _("dialogBox"))
{
#if !wxCHECK_VERSION(2,9,0)
Init();
#else
SetLayoutAdaptationMode(wxDIALOG_ADAPTATION_MODE_ENABLED);
#endif
Create(parent, id, title, pos, size, style, name);
}
#if !wxCHECK_VERSION(2,9,0)
bool Create(wxWindow *parent,
int id = wxID_ANY,
const wxString& title = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE,
const wxString& name = _("dialogBox"));
void Init();
/// Override Show to rejig the control and sizer hierarchy if necessary
virtual bool Show(bool show = true);
/// Override ShowModal to rejig the control and sizer hierarchy if necessary
virtual int ShowModal();
#endif
};
/*!
* A wxPropertySheetDialog class that makes its content scroll if necessary.
*/
class wxScrollingPropertySheetDialog : public wxPropertySheetDialog
#if !wxCHECK_VERSION(2,9,0)
, public wxDialogHelper
#endif
{
public:
wxScrollingPropertySheetDialog() : wxPropertySheetDialog()
{
#if !wxCHECK_VERSION(2,9,0)
Init();
#else
SetLayoutAdaptationMode(wxDIALOG_ADAPTATION_MODE_ENABLED);
#endif
}
wxScrollingPropertySheetDialog(wxWindow* parent, wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& sz = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE,
const wxString& name = wxDialogNameStr)
{
#if !wxCHECK_VERSION(2,9,0)
Init();
#else
SetLayoutAdaptationMode(wxDIALOG_ADAPTATION_MODE_ENABLED);
#endif
Create(parent, id, title, pos, sz, style, name);
}
#if !wxCHECK_VERSION(2,9,0)
//// Accessors
/// Returns the content window
virtual wxWindow* GetContentWindow() const;
/// Operations
/// Override Show to rejig the control and sizer hierarchy if necessary
virtual bool Show(bool show = true);
/// Override ShowModal to rejig the control and sizer hierarchy if necessary
virtual int ShowModal();
private:
void Init();
#endif
protected:
DECLARE_DYNAMIC_CLASS(wxScrollingPropertySheetDialog)
};
#endif
// _WX_SCROLLINGDIALOG_H_
|