1999-09-27 18:44:28 +00:00
|
|
|
|
// -*- C++ -*-
|
|
|
|
|
/* This file is part of
|
|
|
|
|
* ======================================================
|
1999-12-01 00:57:31 +00:00
|
|
|
|
*
|
|
|
|
|
* LyX, The Document Processor
|
2000-01-24 18:34:46 +00:00
|
|
|
|
* Copyright 1995 Matthias Ettrich
|
2000-03-12 10:35:05 +00:00
|
|
|
|
* Copyright 1995-2000 The LyX Team.
|
1999-12-01 00:57:31 +00:00
|
|
|
|
*
|
2000-03-12 10:35:05 +00:00
|
|
|
|
* This file is Copyright 1996-2000
|
1999-12-01 00:57:31 +00:00
|
|
|
|
* Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
*
|
|
|
|
|
* ====================================================== */
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
1999-11-15 12:01:38 +00:00
|
|
|
|
#ifndef TOOLBAR_H
|
|
|
|
|
#define TOOLBAR_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
#pragma interface
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include FORMS_H_LOCATION
|
|
|
|
|
#include "lyxfunc.h"
|
|
|
|
|
#include "combox.h"
|
|
|
|
|
|
|
|
|
|
/** The LyX toolbar class
|
|
|
|
|
This class {\em is} the LyX toolbar, and is not likely to be enhanced
|
|
|
|
|
further until we begin the move to Qt. We will probably have to make our
|
|
|
|
|
own QToolBar, at least until Troll Tech makes theirs.
|
|
|
|
|
*/
|
|
|
|
|
class Toolbar {
|
|
|
|
|
public:
|
|
|
|
|
///
|
2000-03-12 10:35:05 +00:00
|
|
|
|
Toolbar(LyXView * o, int x, int y);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
~Toolbar() {
|
|
|
|
|
clean();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
|
int get_toolbar_func(string const & func);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
/// The special toolbar actions
|
|
|
|
|
enum TOOLBARITEMS {
|
|
|
|
|
/// adds space between buttons in the toolbar
|
|
|
|
|
TOOL_SEPARATOR = -1,
|
|
|
|
|
/// a special combox insead of a button
|
|
|
|
|
TOOL_LAYOUTS = -2,
|
|
|
|
|
/// begin a new line of button (not working)
|
|
|
|
|
TOOL_NEWLINE = -3
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
///
|
1999-12-01 00:57:31 +00:00
|
|
|
|
Combox * combox;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
/// (re)sets the toolbar
|
1999-12-01 00:57:31 +00:00
|
|
|
|
void set(bool doingmain = false);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
/** this is to be the entry point to the toolbar
|
|
|
|
|
frame, where you can change the toolbar realtime. */
|
|
|
|
|
void edit();
|
|
|
|
|
/// add a new button to the toolbar.
|
1999-12-01 00:57:31 +00:00
|
|
|
|
void add(int , bool doclean = true);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// name of func instead of kb_action
|
1999-12-01 00:57:31 +00:00
|
|
|
|
void add(string const & , bool doclean = true);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// invokes the n'th icon in the toolbar
|
|
|
|
|
void push(int);
|
|
|
|
|
/// activates the toolbar
|
|
|
|
|
void activate();
|
|
|
|
|
/// deactivates the toolbar
|
|
|
|
|
void deactivate();
|
|
|
|
|
|
1999-10-25 14:18:30 +00:00
|
|
|
|
///
|
1999-12-01 00:57:31 +00:00
|
|
|
|
static void ToolbarCB(FL_OBJECT *, long);
|
2000-02-15 14:28:15 +00:00
|
|
|
|
|
|
|
|
|
#if FL_REVISION < 89
|
1999-10-25 14:18:30 +00:00
|
|
|
|
///
|
|
|
|
|
static void BubbleTimerCB(FL_OBJECT *, long);
|
|
|
|
|
///
|
1999-12-01 00:57:31 +00:00
|
|
|
|
static int BubblePost(FL_OBJECT * ob, int event,
|
|
|
|
|
FL_Coord mx, FL_Coord my, int key, void * xev);
|
2000-02-15 14:28:15 +00:00
|
|
|
|
#endif
|
1999-10-25 14:18:30 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
private:
|
|
|
|
|
///
|
|
|
|
|
struct toolbarItem
|
|
|
|
|
{
|
|
|
|
|
///
|
1999-12-01 00:57:31 +00:00
|
|
|
|
toolbarItem * next;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
|
|
|
|
int action;
|
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
|
string help;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
1999-12-01 00:57:31 +00:00
|
|
|
|
FL_OBJECT * icon;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2000-02-15 14:28:15 +00:00
|
|
|
|
toolbarItem() {
|
1999-10-02 16:21:10 +00:00
|
|
|
|
next = 0;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
action = LFUN_NOACTION;
|
1999-10-02 16:21:10 +00:00
|
|
|
|
icon = 0;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
|
~toolbarItem() {
|
|
|
|
|
if (icon) {
|
1999-09-27 18:44:28 +00:00
|
|
|
|
fl_delete_object(icon);
|
|
|
|
|
fl_free_object(icon);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/// a list containing all the buttons
|
1999-12-01 00:57:31 +00:00
|
|
|
|
toolbarItem * toollist;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
1999-12-01 00:57:31 +00:00
|
|
|
|
LyXView * owner;
|
2000-02-15 14:28:15 +00:00
|
|
|
|
#if FL_REVISION < 89
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
1999-12-01 00:57:31 +00:00
|
|
|
|
FL_OBJECT * bubble_timer;
|
2000-02-15 14:28:15 +00:00
|
|
|
|
#endif
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// Starting position
|
|
|
|
|
int sxpos, sypos;
|
|
|
|
|
///
|
|
|
|
|
int xpos;
|
|
|
|
|
///
|
|
|
|
|
int ypos;
|
|
|
|
|
///
|
|
|
|
|
int buttonwidth;
|
|
|
|
|
///
|
|
|
|
|
int height;
|
|
|
|
|
///
|
|
|
|
|
int standardspacing;
|
|
|
|
|
///
|
|
|
|
|
int sepspace;
|
|
|
|
|
///
|
|
|
|
|
bool cleaned;
|
|
|
|
|
|
|
|
|
|
///
|
1999-12-01 00:57:31 +00:00
|
|
|
|
char const ** getPixmap(kb_action, string const & arg = string());
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// removes all toolbar buttons from the toolbar.
|
|
|
|
|
void clean();
|
|
|
|
|
|
|
|
|
|
/** more...
|
|
|
|
|
*/
|
2000-04-04 00:19:15 +00:00
|
|
|
|
void reset();// {
|
|
|
|
|
// toollist = 0;
|
|
|
|
|
// cleaned = false;
|
|
|
|
|
//
|
|
|
|
|
// lightReset();
|
|
|
|
|
// }
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
/** more...
|
|
|
|
|
*/
|
2000-04-04 00:19:15 +00:00
|
|
|
|
void lightReset() {
|
1999-09-27 18:44:28 +00:00
|
|
|
|
standardspacing = 2; // the usual space between items
|
|
|
|
|
sepspace = 6; // extra space
|
|
|
|
|
xpos = sxpos - standardspacing;
|
|
|
|
|
ypos = sypos;
|
|
|
|
|
buttonwidth = 30; // the standard button width
|
|
|
|
|
height = 30; // the height of all items in the toolbar
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
#endif
|