@peceha, post #1
@peceha, post #3
#include "MainWindow.h"
#include "RException.h"
#include <intuition/intuitionbase.h>
#include <pragma/exec_lib.h>
#include <pragma/intuition_lib.h>
extern struct IntuitionBase* IntuitionBase;
static const NewWindow NewMainWindow =
{
0, // LeftEdge
0, // TopEdge
320, // Width
160, // Height
~0, // DetailPen
~0, // BlockPen
IDCMP_NEWSIZE |
IDCMP_REFRESHWINDOW |
IDCMP_MOUSEBUTTONS |
IDCMP_GADGETDOWN |
IDCMP_GADGETUP |
IDCMP_MENUPICK |
IDCMP_CLOSEWINDOW |
IDCMP_RAWKEY |
IDCMP_ACTIVEWINDOW |
IDCMP_INACTIVEWINDOW |
IDCMP_INTUITICKS, // IDCMPFlags
WFLG_CLOSEGADGET |
WFLG_DRAGBAR |
WFLG_DEPTHGADGET |
WFLG_SIZEBBOTTOM |
WFLG_SIZEBRIGHT |
WFLG_SIZEGADGET |
WFLG_SIMPLE_REFRESH |
WFLG_ACTIVATE, // Flags
0, // FirstGadget
0, // CheckMark
(UBYTE*)"Redit", // Title
0, // Screen
0, // BitMap
160, // MinWidth
80, // MinHeight
~0, // MaxWidth
~0, // MaxHeight
WBENCHSCREEN // Type
};
MainWindow::MainWindow(struct Screen* screen) :
BaseWindow(),
m_screen(screen)
{
OpenWindow(NewMainWindow);
}
MainWindow::~MainWindow()
{
}
void MainWindow::FollowMouse(BOOL on)
{
Window* const wnd = GetWindow();
::Forbid();
if(on)
{
wnd->Flags |= WFLG_REPORTMOUSE;
::ModifyIDCMP(wnd, wnd->IDCMPFlags | IDCMP_MOUSEMOVE);
}
else
{
wnd->Flags &= ~WFLG_REPORTMOUSE;
::ModifyIDCMP(wnd, wnd->IDCMPFlags & ~IDCMP_MOUSEMOVE);
}
::Permit();
}
void MainWindow::AdjustNewWindow(NewWindow& nw)
{
WORD Width = nw.Width, Height = nw.Height;
BYTE TitleBarHeight = 0;
if(m_screen)
{
Width = m_screen->Width;
Height = m_screen->Height;
TitleBarHeight = m_screen->WBorTop + m_screen->Font->ta_YSize + 1;
nw.Screen = m_screen;
nw.Type = PUBLICSCREEN;
}
else
{
const ULONG lock = LockIBase(0);
struct Screen* screen = IntuitionBase->FirstScreen;
while(screen)
{
if(screen->Flags & WBENCHSCREEN)
{
Width = screen->Width;
Height = screen->Height;
TitleBarHeight = screen->WBorTop + screen->Font->ta_YSize + 1;
break;
}
screen = screen->NextScreen;
}
UnlockIBase(lock);
}
const WORD MaxWidth = 800;
const WORD MaxHeight = 600;
if(Width > MaxWidth)
{
nw.Width = MaxWidth;
nw.LeftEdge = (Width - MaxWidth) / 2;
}
else
{
nw.Width = Width;
nw.LeftEdge = 0;
}
const WORD WinHeight = Height - TitleBarHeight;
if(WinHeight > MaxHeight)
{
nw.Height = MaxHeight;
nw.TopEdge = TitleBarHeight + ((WinHeight - MaxHeight) / 2);
}
else
{
nw.Height = WinHeight;
nw.TopEdge = TitleBarHeight;
}
if(IntuitionBase->LibNode.lib_Version >= 39)
{
nw.Flags |= WFLG_NEWLOOKMENUS;
}
}@peceha, post #4
const WORD MaxWidth = 800; const WORD MaxHeight = 600;na swoje rozmiary, o ile są one mniejsze.
@Krashan, post #5
@Krashan, post #7
@peceha, post #9
@forge, post #10
SORRY ... AN ERROR HAS OCCURED!
Interpreter: executing non-function in line 4
(effect "lower_right" "radial" $FF0000 $FFFF00
@forge, post #13
@forge, post #13
@peceha, post #16