2009-08-17 10:41:51 +00:00
|
|
|
/***************************************************************************
|
|
|
|
|
|
|
|
gmainwindow.h
|
|
|
|
|
|
|
|
(c) 2000-2009 Benoît Minisini <gambas@users.sourceforge.net>
|
|
|
|
|
|
|
|
This program 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 2, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
This program 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 this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
***************************************************************************/
|
2007-12-30 16:41:49 +00:00
|
|
|
#ifndef __GMAINWINDOW_H
|
|
|
|
#define __GMAINWINDOW_H
|
|
|
|
|
|
|
|
#include "gbutton.h"
|
|
|
|
|
|
|
|
class gMainWindow : public gContainer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
gMainWindow(int plug = 0);
|
|
|
|
gMainWindow(gContainer *parent);
|
|
|
|
~gMainWindow();
|
|
|
|
|
|
|
|
//"Properties"
|
2008-04-18 23:43:38 +00:00
|
|
|
bool hasBorder();
|
|
|
|
bool isResizable();
|
|
|
|
int getType();
|
2007-12-30 16:41:49 +00:00
|
|
|
gPicture *icon() { return _icon; }
|
|
|
|
gPicture *picture() { return _picture; }
|
|
|
|
bool mask() { return _mask; }
|
|
|
|
int menuCount();
|
|
|
|
bool modal();
|
|
|
|
const char* text();
|
|
|
|
bool topOnly();
|
|
|
|
bool skipTaskBar();
|
|
|
|
bool minimized();
|
|
|
|
bool maximized();
|
|
|
|
bool fullscreen();
|
|
|
|
bool getSticky();
|
|
|
|
int getStacking();
|
|
|
|
bool isPersistent() { return persistent; }
|
|
|
|
bool isClosed() { return !opened; }
|
2008-12-28 19:01:39 +00:00
|
|
|
bool isHidden() { return _hidden; }
|
2007-12-30 16:41:49 +00:00
|
|
|
|
|
|
|
int controlCount();
|
|
|
|
gControl *getControl(char *name);
|
|
|
|
gControl *getControl(int i);
|
|
|
|
|
2008-04-18 23:43:38 +00:00
|
|
|
void setBorder(bool b);
|
|
|
|
void setResizable(bool b);
|
|
|
|
void setType(int type);
|
2007-12-30 16:41:49 +00:00
|
|
|
void setIcon(gPicture *pic);
|
|
|
|
void setMask(bool vl);
|
|
|
|
void setPicture(gPicture *pic);
|
|
|
|
void setText(const char *txt);
|
|
|
|
void setTopOnly(bool vl);
|
|
|
|
void setSkipTaskBar(bool b);
|
|
|
|
void setMinimized(bool vl);
|
|
|
|
void setMaximized(bool vl);
|
|
|
|
void setFullscreen(bool vl);
|
|
|
|
void setSticky(bool vl);
|
|
|
|
void setStacking(int vl);
|
|
|
|
void setPersistent(bool vl);
|
2008-04-18 23:43:38 +00:00
|
|
|
|
2007-12-30 16:41:49 +00:00
|
|
|
virtual void setVisible(bool vl);
|
|
|
|
virtual void setRealBackground(gColor vl);
|
2009-03-15 11:32:01 +00:00
|
|
|
virtual void setFont(gFont *ft);
|
2007-12-30 16:41:49 +00:00
|
|
|
|
|
|
|
virtual int clientWidth();
|
|
|
|
virtual int clientHeight();
|
|
|
|
virtual int clientX();
|
|
|
|
virtual int clientY();
|
2009-02-04 22:51:20 +00:00
|
|
|
virtual int containerX();
|
|
|
|
virtual int containerY();
|
2007-12-30 16:41:49 +00:00
|
|
|
|
|
|
|
bool spontaneous() { return !_not_spontaneous; }
|
2008-11-23 12:31:41 +00:00
|
|
|
|
|
|
|
void setMenuBarVisible(bool v);
|
|
|
|
bool isMenuBarVisible();
|
2007-12-30 16:41:49 +00:00
|
|
|
|
|
|
|
//"Methods"
|
|
|
|
void center();
|
|
|
|
void showModal();
|
|
|
|
void raise();
|
|
|
|
virtual void move(int x, int y);
|
|
|
|
virtual void resize(int w, int h);
|
|
|
|
bool close();
|
|
|
|
virtual void reparent(gContainer *newpr, int x, int y);
|
|
|
|
|
|
|
|
//"Signals"
|
|
|
|
void (*onOpen)(gMainWindow *sender);
|
|
|
|
void (*onShow)(gMainWindow *sender);
|
|
|
|
void (*onHide)(gMainWindow *sender);
|
|
|
|
void (*onMove)(gMainWindow *sender);
|
|
|
|
void (*onResize)(gMainWindow *sender);
|
|
|
|
bool (*onClose)(gMainWindow *sender);
|
|
|
|
void (*onActivate)(gMainWindow *sender);
|
|
|
|
void (*onDeactivate)(gMainWindow *sender);
|
|
|
|
|
|
|
|
//"Static"
|
|
|
|
static GList *windows;
|
|
|
|
static int count() { return g_list_length(windows); }
|
|
|
|
static gMainWindow *get(int index) { return (gMainWindow *)g_list_nth_data(windows, index); }
|
|
|
|
static gMainWindow *_active;
|
|
|
|
static void setActiveWindow(gControl *control);
|
|
|
|
static gMainWindow *_current;
|
|
|
|
|
|
|
|
//"Private"
|
|
|
|
void initialize();
|
|
|
|
void drawMask();
|
|
|
|
void initWindow();
|
|
|
|
void emitOpen();
|
|
|
|
void remap();
|
|
|
|
bool doClose();
|
2008-11-10 17:01:48 +00:00
|
|
|
void afterShow();
|
2009-06-22 11:16:34 +00:00
|
|
|
void checkMenuBar();
|
|
|
|
int menuBarHeight();
|
|
|
|
void configure();
|
|
|
|
void embedMenuBar(GtkWidget *border);
|
|
|
|
|
2007-12-30 16:41:49 +00:00
|
|
|
GtkWindowGroup *group;
|
|
|
|
GtkAccelGroup *accel;
|
|
|
|
GtkMenuBar *menuBar;
|
2009-06-22 11:16:34 +00:00
|
|
|
GtkFixed *layout;
|
2007-12-30 16:41:49 +00:00
|
|
|
int stack;
|
2009-02-15 23:49:07 +00:00
|
|
|
int _type;
|
2007-12-30 16:41:49 +00:00
|
|
|
gPicture *_icon;
|
|
|
|
gPicture *_picture;
|
|
|
|
char *_title;
|
|
|
|
GdkPixmap *_background;
|
|
|
|
GtkStyle *_style;
|
|
|
|
|
|
|
|
gControl *focus;
|
|
|
|
gButton *_default;
|
|
|
|
gButton *_cancel;
|
|
|
|
|
|
|
|
int _next_w, _next_h;
|
|
|
|
guint _next_timer;
|
|
|
|
|
|
|
|
unsigned _mask : 1;
|
|
|
|
unsigned top_only : 1;
|
|
|
|
unsigned _resized : 1;
|
|
|
|
unsigned persistent : 1;
|
|
|
|
unsigned sticky : 1;
|
|
|
|
unsigned opened : 1;
|
|
|
|
unsigned _closing : 1;
|
|
|
|
unsigned _not_spontaneous : 1;
|
|
|
|
unsigned _skip_taskbar : 1;
|
|
|
|
unsigned _masked : 1;
|
2008-05-21 09:41:25 +00:00
|
|
|
unsigned _xembed : 1;
|
2008-11-10 17:01:48 +00:00
|
|
|
unsigned _activate : 1;
|
2008-12-28 19:01:39 +00:00
|
|
|
unsigned _hidden : 1;
|
2009-06-22 11:16:34 +00:00
|
|
|
unsigned _hideMenuBar : 1;
|
|
|
|
unsigned _showMenuBar : 1;
|
2007-12-30 16:41:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|