19static uint32 Fibonacci(
int n)
21 if (n == 0 || n == 1) {
26 uint32 answer = older + old;
28 for (
int i = 2; i < n; i++) {
49 InitialFullSize(fullSize),
50 WantAnimation(animated)
67 menu.
AppendMenu(MF_STRING, SC_ROLLDIALOG,
_T(
"&Shrink"));
79TRollDialog::Resize(
bool currentlyFullSize)
82 int oldBottom = r.bottom;
86 for (
int step = 0; delta < Height; step++) {
87 if (currentlyFullSize)
88 r.bottom = oldBottom - delta;
90 r.bottom = oldBottom + delta;
92 delta =
static_cast<int>(Fibonacci(step));
96 if (currentlyFullSize)
97 r.bottom = oldBottom - Height;
99 r.bottom = oldBottom + Height;
119 menu.
ModifyMenu(SC_ROLLDIALOG, MF_BYCOMMAND | MF_STRING, SC_ROLLDIALOG,
_T(
"&Expand"));
137 menu.
ModifyMenu(SC_ROLLDIALOG, MF_BYCOMMAND | MF_STRING, SC_ROLLDIALOG,
_T(
"&Shrink"));
149 uint command = cmdType & 0xFFF0;
151 if (command == SC_ROLLDIALOG || command == SC_RESTORE) {
157 else if (command == SC_MINIMIZE)
159 else if (command == SC_MAXIMIZE)
Typically used to obtain information from a user, a dialog box is a window inside of which other cont...
void SetupWindow() override
Overrides the virtual function defined in TWindow.
TDialog(TWindow *parent, TResId resId, TModule *module=nullptr)
Constructor for a TDialog object.
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
TPoint is a support class, derived from tagPOINT.
TRect is a mathematical class derived from tagRect.
Allow a dialog to "roll" up and down, similar to the Corel interface.
void Expand()
Event handler for the system menu option "expand".
void SetupWindow() override
Adds the shrink system menu option, if desired.
bool IsFullSize
track if the dialog is currently full size
void Shrink()
Event handler for the system menu option "shrink".
void EvSysCommand(uint, const TPoint &)
Event handler for the system menu choice.
TRollDialog(TWindow *parent, TResId resId, bool animated=true, bool fullSize=true, TModule *module=0)
Sets up data members for the various properties of the dialog.
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
TRect GetWindowRect() const
Gets the screen coordinates of the window's rectangle.
bool MoveWindow(int x, int y, int w, int h, bool repaint=false)
Repositions the specified window.
uint32 GetStyle() const
Gets the style bits of the underlying window or the 'Style' member of the attribute structure associa...
void EvSysCommand(uint cmdType, const TPoint &point)
Responds to a user-selected command from the System menu or when the user selects the maximize or min...
void GetClientRect(TRect &rect) const
Gets the coordinates of the window's client area and then copies them into the object referred to by ...
#define DEFINE_RESPONSE_TABLE1(cls, base)
Macro to define a response table for a class with one base.
Object Windows Library (OWLNext Core).