aboutsummaryrefslogtreecommitdiff
path: root/src/Tab.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/Tab.hh')
-rw-r--r--src/Tab.hh151
1 files changed, 0 insertions, 151 deletions
diff --git a/src/Tab.hh b/src/Tab.hh
deleted file mode 100644
index 3681c09..0000000
--- a/src/Tab.hh
+++ /dev/null
@@ -1,151 +0,0 @@
1// Tab.hh for Fluxbox Window Manager
2// Copyright (c) 2001-2002 Henrik Kinnunen (fluxgen@linuxmail.org)
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE.
21
22// $Id: Tab.hh,v 1.18 2003/04/09 17:20:03 rathnor Exp $
23
24#ifndef TAB_HH
25#define TAB_HH
26
27#include <X11/Xlib.h>
28#include <strings.h>
29//class FluxboxWindow;
30#include "Window.hh"
31/**
32Note: Tab is a friend of FluxboxWindow
33*/
34class Tab {
35public:
36 enum Placement{ PTOP = 0, PBOTTOM = 5, PLEFT = 10, PRIGHT = 15, PNONE = 20};
37 enum Alignment{ ALEFT = 0, ACENTER, ARIGHT, ARELATIVE, ANONE };
38
39 Tab(FluxboxWindow *win, Tab *prev=0, Tab *next=0);
40 ~Tab();
41
42 void setConfigured(bool value) { m_configured = value; }
43 Tab *next() { return m_next; }
44 Tab *prev() { return m_prev; }
45 Tab *last() { return getLast(this); }
46 Tab *first() { return getFirst(this); }
47 FluxboxWindow *getWindow() { return m_win; }
48
49 void focus();
50 void decorate();
51 void deiconify();
52 void iconify();
53 void raise();
54 void lower();
55 void withdraw();
56 void stick();
57 void resize();
58 void shade();
59 void setPosition(); //position tab to follow (FluxboxWindow *) m_win
60 void moveNext();
61 void movePrev();
62 void insert(Tab *next);
63
64 //event handlers
65 void buttonReleaseEvent(XButtonEvent *be);
66 void buttonPressEvent(XButtonEvent *be);
67 void exposeEvent(XExposeEvent *ee);
68 void motionNotifyEvent(XMotionEvent *me);
69
70 void disconnect();
71
72 //accessors
73
74 static const char *getTabPlacementString(Tab::Placement placement);
75 static Tab::Placement getTabPlacementNum(const char *string);
76 static const char *getTabAlignmentString(Tab::Alignment alignment);
77 static Tab::Alignment getTabAlignmentNum(const char *string);
78
79 const Tab *next() const { return m_next; }
80 const Tab *prev() const { return m_prev; }
81 const Tab *last() const { return getLast(const_cast<Tab *>(this)); }
82 const Tab *first() const { return getFirst(const_cast<Tab *>(this)); }
83
84 const FluxboxWindow *getWindow() const { return m_win; }
85 Window getTabWindow() const { return m_tabwin; }
86 unsigned int getTabWidth() const { return m_size_w; }
87 unsigned int getTabHeight() const { return m_size_h; }
88
89 void resizeGroup(); // used when (un)shading windows
90 void calcIncrease();
91 bool configured() const { return m_configured; }
92 void draw(bool pressed) const;
93
94 bool addWindowToGroup(FluxboxWindow *window);
95
96 static Tab *getFirst(Tab *current);
97 static Tab *getLast(Tab *current);
98
99private:
100
101 bool m_configured;
102
103
104 //The size of the tab
105 unsigned int m_size_w;
106 unsigned int m_size_h;
107 //Increasements
108 int m_inc_x;
109 int m_inc_y;
110 static const int m_max_tabs;
111 bool m_focus, m_moving; // moving and focus
112 void createTabWindow(); // creates the X win of tab
113 void loadTheme(); // loads the textures with right width and height
114 int setPositionShadingHelper(bool shaded);
115 int setPositionTBAlignHelper(Alignment align);
116 int setPositionLRAlignHelper(Alignment align);
117 void setTabWidth(unsigned int w);
118 void setTabHeight(unsigned int h);
119 unsigned int numObjects();
120 unsigned int calcRelativeWidth();
121 unsigned int calcRelativeHeight();
122 unsigned int calcCenterXPos();
123 unsigned int calcCenterYPos();
124 int m_move_x, m_move_y; // Move coordinates, holds moving coordinates when draging
125 Tab *m_prev;
126 Tab *m_next;
127 FluxboxWindow *m_win;
128 Window m_tabwin;
129 Display *m_display;
130 Pixmap m_focus_pm, m_unfocus_pm;
131 unsigned long m_focus_pixel, m_unfocus_pixel;
132 static bool m_stoptabs; //used to "freeze" the tabs functions
133
134 struct t_tabplacementlist{
135 int tp;
136 const char *string;
137 inline bool operator == (int p) {
138 return (tp==p);
139 }
140 inline bool operator == (const char *str) {
141 if (strcasecmp(string, str) == 0)
142 return true;
143 return false;
144 }
145 };
146 static t_tabplacementlist m_tabplacementlist[];
147 static t_tabplacementlist m_tabalignmentlist[];
148
149};
150
151#endif //TAB_HH