mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-24 22:02:44 -06:00
Major improvement to TabBar package
FileTabsExample added MultiList package removed. Reason: Promoted to uppsrc. QuickTabsTest removed. Reason: Redundant git-svn-id: svn://ultimatepp.org/upp/trunk@1271 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
5ec3907a04
commit
8a3520a676
17 changed files with 2286 additions and 4363 deletions
41
bazaar/FileTabsExample/FileTabsExample.h
Normal file
41
bazaar/FileTabsExample/FileTabsExample.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef _FileTabsExample_FileTabsExample_h
|
||||
#define _FileTabsExample_FileTabsExample_h
|
||||
|
||||
#include <CtrlLib/CtrlLib.h>
|
||||
#include <TabBar/TabBar.h>
|
||||
using namespace Upp;
|
||||
|
||||
#define LAYOUTFILE <FileTabsExample/FileTabsExample.lay>
|
||||
#include <CtrlCore/lay.h>
|
||||
|
||||
class FileTabsExample : public WithFileTabsExampleLayout<TopWindow> {
|
||||
private:
|
||||
FileTabs bar[4];
|
||||
String barbackup;
|
||||
public:
|
||||
typedef FileTabsExample CLASSNAME;
|
||||
FileTabsExample();
|
||||
|
||||
// TabBar events
|
||||
void OnCursor();
|
||||
bool OnCloseConfirm(Value v);
|
||||
bool OnCloseAllConfirm();
|
||||
// Buttons
|
||||
void OnAdd();
|
||||
void OnInsert();
|
||||
// Options
|
||||
void OnGrouping();
|
||||
void OnGroupSort();
|
||||
void OnSeparators();
|
||||
void OnStacking();
|
||||
void OnIcons();
|
||||
void OnPrompt();
|
||||
void OnAllAlign();
|
||||
void OnInactive();
|
||||
// Ctrl overloads
|
||||
virtual bool Key(dword key, int count);
|
||||
virtual void DragAndDrop(Point p, PasteClip& d);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
20
bazaar/FileTabsExample/FileTabsExample.lay
Normal file
20
bazaar/FileTabsExample/FileTabsExample.lay
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
LAYOUT(FileTabsExampleLayout, 660, 348)
|
||||
ITEM(EditString, fileinput, HSizePosZ(8, 72).TopPosZ(44, 20))
|
||||
ITEM(Button, addfile, SetLabel(t_("Add")).RightPosZ(4, 64).TopPosZ(44, 20))
|
||||
ITEM(Option, grouping, SetLabel(t_("Group tabs")).LeftPosZ(8, 132).TopPosZ(84, 16))
|
||||
ITEM(Option, groupsort, SetLabel(t_("Sort tabs by group")).LeftPosZ(8, 132).TopPosZ(104, 16))
|
||||
ITEM(Option, separators, SetLabel(t_("Visually seperate groups")).LeftPosZ(8, 132).TopPosZ(124, 16))
|
||||
ITEM(Option, stacking, SetLabel(t_("Stack tabs")).LeftPosZ(144, 132).TopPosZ(84, 16))
|
||||
ITEM(Option, normalicons, SetLabel(t_("Icons for normal tabs")).LeftPosZ(144, 132).TopPosZ(104, 16))
|
||||
ITEM(Option, stackedicons, SetLabel(t_("Icons for stacked tabs")).LeftPosZ(144, 132).TopPosZ(124, 16))
|
||||
ITEM(Option, prompt, SetLabel(t_("Prompt before tab close")).LeftPosZ(280, 132).TopPosZ(84, 16))
|
||||
ITEM(Option, inactive, SetLabel(t_("Show inactive tabs")).LeftPosZ(280, 132).TopPosZ(124, 16))
|
||||
ITEM(Option, allalign, SetLabel(t_("Show all alignments")).LeftPosZ(280, 132).TopPosZ(104, 16))
|
||||
ITEM(LabelBox, dv___11, SetLabel(t_("Options")).HSizePosZ(4, 0).TopPosZ(68, 76))
|
||||
ITEM(Label, selection, HSizePosZ(4, 4).TopPosZ(184, 19))
|
||||
ITEM(Label, dv___13, SetLabel(t_("Selected file (form top bar only):")).HSizePosZ(4, 4).TopPosZ(164, 19))
|
||||
ITEM(LabelBox, dv___14, SetLabel(t_("Add Files")).HSizePosZ(4, 0).TopPosZ(0, 68))
|
||||
ITEM(Label, dv___15, SetLabel(t_("- Drag files onto this window\n- Enter full paths below (files do not need to exist)")).HSizePosZ(8, 4).TopPosZ(12, 32))
|
||||
ITEM(Button, insert, SetLabel(t_("Insert")).LeftPosZ(4, 64).BottomPosZ(5, 24))
|
||||
END_LAYOUT
|
||||
|
||||
12
bazaar/FileTabsExample/FileTabsExample.upp
Normal file
12
bazaar/FileTabsExample/FileTabsExample.upp
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
uses
|
||||
CtrlLib,
|
||||
TabBar;
|
||||
|
||||
file
|
||||
FileTabsExample.h,
|
||||
main.cpp,
|
||||
FileTabsExample.lay;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
5
bazaar/FileTabsExample/init
Normal file
5
bazaar/FileTabsExample/init
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#ifndef _FileTabsExample_icpp_init_stub
|
||||
#define _FileTabsExample_icpp_init_stub
|
||||
#include "CtrlLib/init"
|
||||
#include "TabBar/init"
|
||||
#endif
|
||||
180
bazaar/FileTabsExample/main.cpp
Normal file
180
bazaar/FileTabsExample/main.cpp
Normal file
|
|
@ -0,0 +1,180 @@
|
|||
#include "FileTabsExample.h"
|
||||
|
||||
#define FILE_LIMIT 5
|
||||
#define PACKAGE_LIMIT 5
|
||||
|
||||
FileTabsExample::FileTabsExample()
|
||||
{
|
||||
CtrlLayout(*this, "FileTabs Example");
|
||||
Sizeable();
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
bar[i].SetAlign((i+1) % 4);
|
||||
AddFrame(bar[0]);
|
||||
|
||||
bar[0] <<= THISBACK(OnCursor);
|
||||
|
||||
addfile <<= THISBACK(OnAdd);
|
||||
insert <<= THISBACK(OnInsert);
|
||||
|
||||
grouping <<= THISBACK(OnGrouping);
|
||||
groupsort <<= THISBACK(OnGroupSort);
|
||||
separators <<= THISBACK(OnSeparators);
|
||||
stacking <<= THISBACK(OnStacking);
|
||||
normalicons <<= THISBACK(OnIcons);
|
||||
stackedicons <<= THISBACK(OnIcons);
|
||||
prompt <<= THISBACK(OnPrompt);
|
||||
allalign <<= THISBACK(OnAllAlign);
|
||||
|
||||
grouping <<= true;
|
||||
inactive <<= true;
|
||||
normalicons <<= true;
|
||||
|
||||
OnInsert();
|
||||
OnCursor();
|
||||
}
|
||||
|
||||
void FileTabsExample::OnCursor()
|
||||
{
|
||||
if (bar[0].HasCursor())
|
||||
selection = (String)~bar[0];
|
||||
else
|
||||
selection = "No tab selected";
|
||||
}
|
||||
|
||||
void FileTabsExample::OnInsert()
|
||||
{
|
||||
Vector<String> files;
|
||||
files.Add("C:\\uppsvn\\bazaar\\TabBar\\FileTabs.h");
|
||||
files.Add("C:\\uppsvn\\bazaar\\TabBar\\TabBar.cpp");
|
||||
files.Add("C:\\uppsvn\\bazaar\\TabBar\\TabBar.h");
|
||||
files.Add("C:\\uppsvn\\bazaar\\TabBar\\TabBar.iml");
|
||||
files.Add("C:\\uppsvn\\bazaar\\TabBar\\TabBar.upp");
|
||||
files.Add("C:\\uppsvn\\bazaar\\TabBar\\FileTabs.cpp");
|
||||
files.Add("C:\\uppsvn\\bazaar\\UppDocking\\Docking.lay");
|
||||
files.Add("C:\\uppsvn\\bazaar\\UppDocking\\Docking.t");
|
||||
files.Add("C:\\uppsvn\\bazaar\\UppDocking\\DockTabBar.cpp");
|
||||
files.Add("C:\\uppsvn\\bazaar\\UppDocking\\DockTabBar.h");
|
||||
files.Add("C:\\uppsvn\\bazaar\\UppDocking\\DockMenu.cpp");
|
||||
files.Add("C:\\uppsvn\\bazaar\\UppDocking\\DockMenu.h");
|
||||
files.Add("C:\\uppsvn\\bazaar\\UppDocking\\DockPane.cpp");
|
||||
files.Add("C:\\uppsvn\\bazaar\\UppDocking\\DockWindow.cpp");
|
||||
files.Add("C:\\uppsvn\\bazaar\\UppDocking\\Docking.h");
|
||||
files.Add("C:\\uppsvn\\bazaar\\UppDocking\\Docking.upp");
|
||||
files.Add("C:\\uppsvn\\bazaar\\UppDocking\\DockPane.h");
|
||||
files.Add("C:\\uppsvn\\bazaar\\UppDocking\\DockableCtrl.cpp");
|
||||
files.Add("C:\\uppsvn\\bazaar\\UppDocking\\DockableCtrl.h");
|
||||
files.Add("C:\\uppsvn\\bazaar\\UppDocking\\DockConfig.cpp");
|
||||
files.Add("C:\\uppsvn\\bazaar\\UppDocking\\DockCont.cpp");
|
||||
files.Add("C:\\uppsvn\\bazaar\\UppDocking\\DockCont.h");
|
||||
files.Add("C:\\uppsvn\\bazaar\\UppDocking\\Docking.iml");
|
||||
files.Add("C:\\uppsvn\\bazaar\\FileTabsExample\\FileTabsExample.h");
|
||||
files.Add("C:\\uppsvn\\bazaar\\FileTabsExample\\FileTabsExample.lay");
|
||||
files.Add("C:\\uppsvn\\bazaar\\FileTabsExample\\FileTabsExample.upp");
|
||||
files.Add("C:\\uppsvn\\bazaar\\FileTabsExample\\main.cpp");
|
||||
for (int i = 0; i < 4; i++)
|
||||
bar[i].AddFiles(files, false);
|
||||
}
|
||||
|
||||
bool FileTabsExample::OnCloseConfirm(Value v)
|
||||
{
|
||||
return PromptOKCancel(Format("Close '%s'?", DeQtf((String)v))) == 0;
|
||||
}
|
||||
|
||||
bool FileTabsExample::OnCloseAllConfirm()
|
||||
{
|
||||
return PromptOKCancel("Close all tabs?") == 0;
|
||||
}
|
||||
|
||||
void FileTabsExample::OnAdd()
|
||||
{
|
||||
if (!fileinput.GetLength()) return;
|
||||
for (int i = 0; i < 4; i++)
|
||||
bar[i].AddFile(~fileinput);
|
||||
}
|
||||
|
||||
void FileTabsExample::OnGrouping()
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
bar[i].Grouping(~grouping);
|
||||
}
|
||||
|
||||
void FileTabsExample::OnGroupSort()
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
bar[i].GroupSort(~groupsort);
|
||||
}
|
||||
|
||||
void FileTabsExample::OnSeparators()
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
bar[i].GroupSeparators(~separators);
|
||||
}
|
||||
|
||||
void FileTabsExample::OnStacking()
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
bar[i].Stacking(~stacking);
|
||||
}
|
||||
|
||||
void FileTabsExample::OnIcons()
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
bar[i].FileIcons(~normalicons, ~stackedicons);
|
||||
}
|
||||
|
||||
void FileTabsExample::OnPrompt()
|
||||
{
|
||||
if (prompt) {
|
||||
bar[0].CancelClose = THISBACK(OnCloseConfirm);
|
||||
bar[0].CancelCloseAll = THISBACK(OnCloseAllConfirm);
|
||||
}
|
||||
else {
|
||||
bar[0].CancelClose.Clear();
|
||||
bar[0].CancelCloseAll.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
void FileTabsExample::OnAllAlign()
|
||||
{
|
||||
if (allalign) {
|
||||
for (int i = 1; i < 4; i++)
|
||||
AddFrame(bar[i]);
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < 4; i++)
|
||||
bar[i].Remove();
|
||||
ClearFrames();
|
||||
AddFrame(bar[0]);
|
||||
}
|
||||
}
|
||||
|
||||
void FileTabsExample::OnInactive()
|
||||
{
|
||||
for (int i = 1; i < 4; i++)
|
||||
bar[i].InactiveDisabled(~inactive);
|
||||
}
|
||||
|
||||
bool FileTabsExample::Key(dword key, int count)
|
||||
{
|
||||
if (key == K_RETURN && fileinput.HasFocus()) {
|
||||
addfile.PseudoPush();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void FileTabsExample::DragAndDrop(Point p, PasteClip& d)
|
||||
{
|
||||
if (AcceptFiles(d))
|
||||
for (int i = 0; i < 4; i++)
|
||||
bar[i].AddFiles(GetFiles(d));
|
||||
}
|
||||
|
||||
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
FileTabsExample().Run();
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,219 +0,0 @@
|
|||
#ifndef _RowList_MultiList_h_
|
||||
#define _RowList_MultiList_h_
|
||||
|
||||
#include <CtrlLib/CtrlLib.h>
|
||||
using namespace Upp;
|
||||
|
||||
class MultiList : public Ctrl, private CtrlFrame {
|
||||
public:
|
||||
virtual void Serialize(Stream& s);
|
||||
virtual void Paint(Draw& w);
|
||||
virtual void Layout();
|
||||
virtual Image CursorImage(Point p, dword);
|
||||
virtual void LeftDown(Point p, dword);
|
||||
virtual void LeftUp(Point p, dword);
|
||||
virtual void LeftDouble(Point p, dword);
|
||||
virtual void RightDown(Point p, dword);
|
||||
virtual void LeftDrag(Point p, dword keyflags);
|
||||
virtual void MouseMove(Point p, dword);
|
||||
virtual void MouseLeave();
|
||||
virtual void MouseWheel(Point p, int zdelta, dword keyflags);
|
||||
virtual bool Key(dword key, int count);
|
||||
virtual void GotFocus();
|
||||
virtual void LostFocus();
|
||||
virtual void CancelMode();
|
||||
virtual void DragEnter();
|
||||
virtual void DragAndDrop(Point p, PasteClip& d);
|
||||
virtual void DragRepeat(Point p);
|
||||
virtual void DragLeave();
|
||||
|
||||
private:
|
||||
virtual void FrameLayout(Rect& r);
|
||||
virtual void FrameAddSize(Size& sz);
|
||||
virtual void FramePaint(Draw& draw, const Rect& r);
|
||||
|
||||
private:
|
||||
int ncl;
|
||||
int cx;
|
||||
int cy;
|
||||
int cursor, anchor;
|
||||
int dx;
|
||||
int ci;
|
||||
int mpos;
|
||||
ScrollBar sb;
|
||||
Scroller scroller;
|
||||
CtrlFrame *frame;
|
||||
int dropitem;
|
||||
bool insert;
|
||||
bool clickkill;
|
||||
bool nobg;
|
||||
bool popupex;
|
||||
bool selclick;
|
||||
int mode;
|
||||
|
||||
enum {
|
||||
MODE_COLUMNS,
|
||||
MODE_LIST,
|
||||
MODE_ROWS
|
||||
};
|
||||
|
||||
DisplayPopup info;
|
||||
|
||||
const Display *display;
|
||||
|
||||
struct Item {
|
||||
bool sel;
|
||||
bool canselect;
|
||||
Value key;
|
||||
Value value;
|
||||
const Display *display;
|
||||
};
|
||||
|
||||
Array<Item> item;
|
||||
int selcount;
|
||||
bool multi;
|
||||
|
||||
struct ItemOrder;
|
||||
friend struct ItemOrder;
|
||||
|
||||
void SetSb();
|
||||
void Scroll();
|
||||
int GetSbPos() const { return GetSbPos(GetSize()); }
|
||||
int GetSbPos(const Size &sz) const;
|
||||
void ScrollInto(int item);
|
||||
|
||||
dword SwapKey(dword key);
|
||||
int GetDragColumn(int x) const;
|
||||
int RoundedCy();
|
||||
void Page(bool down);
|
||||
void PointDown(Point p);
|
||||
void DoClick(Point p, dword flags);
|
||||
void ShiftSelect();
|
||||
void RefreshItem(int i, int ex = 0);
|
||||
void RefreshCursor() { RefreshItem(cursor); }
|
||||
void GetItemStyle(int i, Color& ink, Color& paper, dword& style);
|
||||
dword PaintItem(Draw& w, int i, const Rect& r);
|
||||
void SyncInfo();
|
||||
void SetCursor0(int c, bool sel);
|
||||
void UpdateSelect();
|
||||
void RefreshSel();
|
||||
|
||||
bool DnDInsert(int i, int py, PasteClip& d, int q);
|
||||
void DnD(int _drop, bool _insert);
|
||||
|
||||
void PaintRows(Draw &w, Size &sz);
|
||||
public:
|
||||
Callback WhenLeftClick;
|
||||
Callback1<Point> WhenLeftClickPos;
|
||||
Callback WhenLeftDouble;
|
||||
Callback1<Bar&> WhenBar;
|
||||
Callback WhenSel;
|
||||
|
||||
Callback WhenDrag;
|
||||
Callback2<int, PasteClip&> WhenDropItem;
|
||||
Callback2<int, PasteClip&> WhenDropInsert;
|
||||
Callback1<PasteClip&> WhenDrop;
|
||||
|
||||
// depracated - use WhenSel
|
||||
Callback WhenSelection;
|
||||
Callback WhenEnterItem;
|
||||
Callback WhenKillCursor;
|
||||
|
||||
int GetColumnItems() const;
|
||||
int GetColumnCx(int i = 0) const;
|
||||
int GetPageItems() const;
|
||||
|
||||
int GetItem(Point p);
|
||||
Rect GetItemRect(int i) const;
|
||||
|
||||
int GetCursor() const { return cursor; }
|
||||
void SetCursor(int c);
|
||||
void KillCursor();
|
||||
bool IsCursor() const { return cursor >= 0; }
|
||||
|
||||
void SetSbPos(int y);
|
||||
|
||||
void SetFrame(CtrlFrame& frame);
|
||||
|
||||
MultiList &ListMode() { mode = MODE_LIST; scroller.Clear(); sb.Vert(); return *this; }
|
||||
MultiList &RowMode() { mode = MODE_ROWS; scroller.Clear(); sb.Vert(); return *this; }
|
||||
MultiList &ColumnMode() { mode = MODE_COLUMNS; scroller.Clear(); sb.Horz(); return *this; }
|
||||
|
||||
void Clear();
|
||||
void Add(const Value& val, bool canselect = true);
|
||||
void Add(const Value& val, const Display& display, bool canselect = true);
|
||||
void Add(const Value& key, const Value& val, bool canselect = true);
|
||||
void Add(const Value& key, const Value& val, const Display& display, bool canselect = true);
|
||||
|
||||
int GetCount() const { return item.GetCount(); }
|
||||
const Value& Get(int i) const { return item[i].key; }
|
||||
const Value& GetValue(int i) const { return item[i].value; }
|
||||
const Value& operator[](int i) const { return item[i].key; }
|
||||
|
||||
void Set(int ii, const Value& val, bool canselect = true);
|
||||
void Set(int ii, const Value& val, const Display& display, bool canselect = true);
|
||||
void Set(int ii, const Value& key, const Value& val, bool canselect = true);
|
||||
void Set(int ii, const Value& key, const Value& val, const Display& display, bool canselect = true);
|
||||
void Set(const Value &key, const Value& val, const Display& display, bool canselect = true);
|
||||
void Set(const Value &key, const Value& val, bool canselect = true);
|
||||
|
||||
void Insert(int ii, const Value& val, bool canselect = true);
|
||||
void Insert(int ii, const Value& val, const Display& display, bool canselect = true);
|
||||
void Insert(int ii, const Value& key, const Value& val, bool canselect = true);
|
||||
void Insert(int ii, const Value& key, const Value& val, const Display& display, bool canselect = true);
|
||||
void Remove(int ii);
|
||||
void Remove(const Value & key) { int ii = Find(key); if (ii >= 0) Remove(ii); }
|
||||
|
||||
void RemoveSelection();
|
||||
|
||||
int Find(const Value &key) const;
|
||||
|
||||
bool IsSelection() const { return selcount > 0; }
|
||||
void ClearSelection();
|
||||
void SelectOne(int i, bool sel);
|
||||
bool IsSelected(int i) const;
|
||||
bool IsSelected(const Value &key) const { int ii = Find(key); return (ii >= 0 && IsSelected(ii)); }
|
||||
bool IsSel(int i) const;
|
||||
|
||||
void Sort(const ValueOrder& order);
|
||||
|
||||
virtual Value GetData() const;
|
||||
virtual void SetData(const Value& key);
|
||||
|
||||
Image GetDragSample();
|
||||
|
||||
void InsertDrop(int ii, const Vector<Value>& data, PasteClip& d, bool self);
|
||||
void InsertDrop(int ii, const Vector<Value>& keys, const Vector<Value>& data, PasteClip& d, bool self);
|
||||
void InsertDrop(int ii, const MultiList& src, PasteClip& d);
|
||||
void InsertDrop(int ii, const ColumnList& src, PasteClip& d);
|
||||
void InsertDrop(int ii, PasteClip& d);
|
||||
|
||||
MultiList& Columns(int _n) { ncl = max(_n, 1); Refresh(); return *this; }
|
||||
int GetColumns() const { return ncl; }
|
||||
MultiList& ItemHeight(int _cy) { cy = max(_cy, 1); RefreshLayout(); Refresh(); return *this; }
|
||||
int GetItemHeight() const { return cy; }
|
||||
MultiList& ItemWidth(int _cx) { cx = max(1, _cx); RefreshLayout(); Refresh(); return *this; }
|
||||
int GetItemWidth() const { return cx; }
|
||||
MultiList& RoundSize(bool b = true);
|
||||
MultiList& NoRoundSize() { return RoundSize(false); }
|
||||
MultiList& ClickKill(bool b = true) { clickkill = b; return *this; }
|
||||
MultiList& NoClickKill() { return ClickKill(false); }
|
||||
MultiList& SetDisplay(const Display& d) { display = &d; return *this; }
|
||||
MultiList& NoBackground(bool b = true) { nobg = b; Transparent(); Refresh(); return *this; }
|
||||
MultiList& Multi(bool b = true) { multi = b; return *this; }
|
||||
bool IsMulti() const { return multi; }
|
||||
MultiList& MultiSelect(bool b = true) { multi = b; return *this; }
|
||||
bool IsMultiSelect() const { return multi; }
|
||||
MultiList& PopUpEx(bool b = true) { popupex = b; return *this; }
|
||||
MultiList& NoPopUpEx() { return PopUpEx(false); }
|
||||
|
||||
MultiList& SetScrollBarStyle(const ScrollBar::Style& s) { sb.SetStyle(s); return *this; }
|
||||
|
||||
typedef MultiList CLASSNAME;
|
||||
|
||||
MultiList();
|
||||
virtual ~MultiList();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
description "Bazaar: A list ctrl featuring 3 display modes and key/value support. Author: James Thomas (mrjt)";
|
||||
|
||||
file
|
||||
MultiList.h,
|
||||
MultiList.cpp;
|
||||
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
#ifndef _MultiList_icpp_init_stub
|
||||
#define _MultiList_icpp_init_stub
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,221 +0,0 @@
|
|||
#ifndef _QuickTabs_QuickTabs_h
|
||||
#define _QuickTabs_QuickTabs_h
|
||||
|
||||
#include <CtrlLib/CtrlLib.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
#define IMAGECLASS Img
|
||||
#define IMAGEFILE <QuickTabs/QuickTabs.iml>
|
||||
#include <Draw/iml_header.h>
|
||||
|
||||
enum
|
||||
{
|
||||
QT_MARGIN = 6,
|
||||
QT_SPACE = 10,
|
||||
QT_SBHEIGHT = 4,
|
||||
QT_SBSEPARATOR = 1,
|
||||
QT_FILEICON = 16,
|
||||
QT_SPACEICON = 5
|
||||
};
|
||||
|
||||
struct FloatFrame : FrameCtrl<Ctrl>
|
||||
{
|
||||
enum
|
||||
{
|
||||
LAYOUT_LEFT = 0,
|
||||
LAYOUT_TOP = 1,
|
||||
LAYOUT_RIGHT = 2,
|
||||
LAYOUT_BOTTOM = 3
|
||||
};
|
||||
|
||||
int layout;
|
||||
int size;
|
||||
int border;
|
||||
|
||||
bool horizontal;
|
||||
|
||||
FloatFrame() : border(0), size(0), layout(LAYOUT_TOP), horizontal(true) {}
|
||||
virtual void FrameLayout(Rect &r);
|
||||
virtual void FrameAddSize(Size& sz);
|
||||
virtual void FramePaint(Draw& w, const Rect& r);
|
||||
void Fix(Size& sz);
|
||||
void Fix(Point& p);
|
||||
};
|
||||
|
||||
class TabScrollBar : public FloatFrame
|
||||
{
|
||||
private:
|
||||
int total;
|
||||
double pos, ps;
|
||||
int new_pos;
|
||||
int old_pos;
|
||||
double start_pos;
|
||||
double size;
|
||||
double cs, ics;
|
||||
void UpdatePos(bool update = true);
|
||||
bool ready;
|
||||
Size sz;
|
||||
|
||||
public:
|
||||
TabScrollBar();
|
||||
|
||||
virtual void Paint(Draw &w);
|
||||
virtual void LeftDown(Point p, dword keyflags);
|
||||
virtual void LeftUp(Point p, dword keyflags);
|
||||
virtual void MouseMove(Point p, dword keyflags);
|
||||
virtual void MouseWheel(Point p, int zdelta, dword keyflags);
|
||||
virtual void Layout();
|
||||
|
||||
int GetPos() const;
|
||||
void SetPos(int p, bool dontscale = false);
|
||||
void AddPos(int p, bool dontscale = false);
|
||||
int GetTotal() const;
|
||||
void AddTotal(int t);
|
||||
void SetTotal(int t);
|
||||
void GoEnd();
|
||||
void GoBegin();
|
||||
void Set(const TabScrollBar& t);
|
||||
Callback WhenScroll;
|
||||
};
|
||||
|
||||
struct Tab : Moveable<Tab>
|
||||
{
|
||||
String name;
|
||||
String group;
|
||||
bool visible;
|
||||
int x, cx;
|
||||
int y, cy;
|
||||
int id;
|
||||
Size tsz;
|
||||
Tab() : visible(true), id(-1)
|
||||
{}
|
||||
int Right() { return x + cx; }
|
||||
bool HasMouse(const Point& p);
|
||||
bool HasMouseCross(const Point& p, int w, int h);
|
||||
};
|
||||
|
||||
struct Group : Moveable<Group>
|
||||
{
|
||||
Group() {}
|
||||
String name;
|
||||
String path;
|
||||
int active;
|
||||
int count;
|
||||
int first;
|
||||
int last;
|
||||
};
|
||||
|
||||
class QuickTabs : public FloatFrame
|
||||
{
|
||||
public:
|
||||
|
||||
private:
|
||||
|
||||
int id;
|
||||
TabScrollBar sc;
|
||||
void Scroll();
|
||||
|
||||
Vector<Group> groups;
|
||||
Vector<Tab> tabs;
|
||||
int highlight;
|
||||
int active;
|
||||
int target;
|
||||
int cross;
|
||||
bool crosses;
|
||||
bool file_icons;
|
||||
bool isctrl;
|
||||
bool isdrag;
|
||||
bool grouping;
|
||||
Point mouse, oldp;
|
||||
int group;
|
||||
|
||||
const TabCtrl::Style *style;
|
||||
|
||||
virtual void Paint(Draw &w);
|
||||
virtual void LeftDown(Point p, dword keysflags);
|
||||
virtual void LeftUp(Point p, dword keysflags);
|
||||
virtual void RightDown(Point p, dword keyflags);
|
||||
virtual void MiddleDown(Point p, dword keyflags);
|
||||
virtual void MiddleUp(Point p, dword keyflags);
|
||||
virtual void MouseMove(Point p, dword keysflags);
|
||||
virtual void MouseLeave();
|
||||
virtual void DragAndDrop(Point p, PasteClip& d);
|
||||
virtual void LeftDrag(Point p, dword keyflags);
|
||||
virtual void DragEnter();
|
||||
virtual void DragLeave();
|
||||
virtual void DragRepeat(Point p);
|
||||
virtual void CancelMode();
|
||||
virtual void MouseWheel(Point p, int zdelta, dword keyflags);
|
||||
|
||||
void DrawTab(Draw& w, Size &sz, int i);
|
||||
void DrawLabel(Draw& w, int x, int y, Tab& t);
|
||||
void Repos();
|
||||
int Find(int id);
|
||||
int GetNext(int n);
|
||||
int GetPrev(int n);
|
||||
|
||||
int GetWidth(int n);
|
||||
int GetTargetTab(Point p);
|
||||
|
||||
int GetWidth();
|
||||
int GetHeight();
|
||||
|
||||
void Menu(Bar& bar);
|
||||
void GroupMenu(Bar &bar, int n);
|
||||
|
||||
void CloseAll();
|
||||
|
||||
void MakeGroups();
|
||||
int FindGroup(const String& g);
|
||||
|
||||
void DoGrouping(int n);
|
||||
void DoCloseGroup(int n);
|
||||
|
||||
String GetGroupName() const { return group == 0 ? Null : groups[group].path; }
|
||||
int SetGroup(const String &s) { group = max(0, FindGroup(s)); return group; }
|
||||
int SetGroup(int c) { int t = group; group = c; return group; }
|
||||
int GetGroup() const { return group; }
|
||||
void SetActiveGroup(int id) { groups[group].active = id; }
|
||||
int GetActiveGroup() const { return groups[group].active; }
|
||||
int GetFirst() const { return groups[group].first; }
|
||||
int GetLast() const { return groups[group].last; }
|
||||
bool IsGroupAll() const { return group == 0; }
|
||||
|
||||
public:
|
||||
Callback WhenCloseRest;
|
||||
|
||||
QuickTabs();
|
||||
|
||||
void Add(const char *name, bool make_active = false);
|
||||
void Close(int n);
|
||||
void Clear();
|
||||
|
||||
QuickTabs& FileIcons(bool b = true);
|
||||
QuickTabs& Crosses(bool b = true);
|
||||
QuickTabs& Grouping(bool b = true);
|
||||
|
||||
typedef QuickTabs CLASSNAME;
|
||||
|
||||
int GetCount() const { return tabs.GetCount(); }
|
||||
int GetCursor() const { return active; }
|
||||
String GetFile(int n) const { return tabs[n].name; }
|
||||
bool FindSetFile(const String& fn);
|
||||
void SetAddFile(const String& fn);
|
||||
void RenameFile(const String& fn, const String& nn);
|
||||
void Set(const QuickTabs& t);
|
||||
|
||||
QuickTabs& SetLayout(int l);
|
||||
|
||||
QuickTabs& SetStyle(const TabCtrl::Style& s) { style = &s; Refresh(); return *this; }
|
||||
static const TabCtrl::Style& StyleDefault();
|
||||
|
||||
int GetNextId();
|
||||
|
||||
const Vector<Tab>& GetTabs() { return tabs; }
|
||||
int GetPos() { return sc.GetPos(); }
|
||||
|
||||
void SetCursor(int n);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
PREMULTIPLIED
|
||||
IMAGE_ID(BA)
|
||||
IMAGE_ID(BH)
|
||||
IMAGE_ID(BN)
|
||||
IMAGE_ID(LA)
|
||||
IMAGE_ID(LH)
|
||||
IMAGE_ID(RA)
|
||||
IMAGE_ID(RH)
|
||||
IMAGE_ID(RN)
|
||||
IMAGE_ID(DND)
|
||||
IMAGE_ID(LN)
|
||||
IMAGE_ID(CR0)
|
||||
IMAGE_ID(CR1)
|
||||
IMAGE_ID(CR2)
|
||||
IMAGE_ID(UD)
|
||||
IMAGE_ID(UD2)
|
||||
IMAGE_ID(CHK)
|
||||
IMAGE_ID(AD)
|
||||
IMAGE_ID(AR)
|
||||
IMAGE_ID(ARH)
|
||||
|
||||
IMAGE_BEGIN_DATA
|
||||
IMAGE_DATA(120,156,237,154,9,108,84,215,21,134,71,74,147,32,148,86,81,33,138,186,168,161,85,81,165,86,170,26,85,170,18,213)
|
||||
IMAGE_DATA(144,218,98,80,12,178,193,1,146,154,136,69,74,28,182,0,45,78,41,78,33,114,98,21,146,180,180,13,9,105,138,205)
|
||||
IMAGE_DATA(226,221,216,120,55,54,222,247,109,12,6,19,140,61,227,241,224,89,188,239,118,241,70,212,191,231,92,124,135,251,134,177)
|
||||
IMAGE_DATA(141,52,173,70,145,252,208,167,119,255,119,207,121,239,190,247,223,227,123,109,161,123,90,247,93,157,60,190,159,92,7,79)
|
||||
IMAGE_DATA(24,27,27,243,136,153,153,25,143,152,158,158,254,90,51,53,53,229,17,147,147,147,94,101,98,98,194,171,12,15,15,123)
|
||||
IMAGE_DATA(68,79,79,143,87,233,237,237,245,42,222,30,127,127,127,191,87,25,24,24,240,136,193,193,65,143,24,26,26,242,8,79)
|
||||
IMAGE_DATA(231,191,183,209,169,139,81,84,84,20,60,97,113,49,90,92,140,22,23,163,197,197,104,113,49,90,92,140,60,94,140,202)
|
||||
IMAGE_DATA(202,202,224,9,163,163,163,30,97,183,219,61,194,102,179,121,21,171,213,250,181,198,219,223,207,83,44,22,139,71,24,141)
|
||||
IMAGE_DATA(70,143,48,153,76,30,209,214,214,230,17,102,179,217,35,218,219,219,189,202,157,59,119,60,194,219,243,223,225,112,120,68)
|
||||
IMAGE_DATA(103,103,167,71,120,123,49,9,15,15,247,8,221,55,148,197,200,245,207,117,178,221,210,210,34,86,110,110,183,82,123,124)
|
||||
IMAGE_DATA(124,92,236,228,89,115,155,119,229,188,51,149,127,170,187,123,247,174,56,75,205,49,140,140,231,133,71,246,75,205,72,61)
|
||||
IMAGE_DATA(50,50,34,144,154,95,212,85,51,82,247,245,245,9,164,230,137,193,139,147,170,153,185,250,229,98,166,106,158,28,82,115)
|
||||
IMAGE_DATA(91,237,151,19,71,106,110,119,117,117,57,53,183,93,117,119,119,183,83,203,157,164,170,121,103,200,90,53,215,85,187,53)
|
||||
IMAGE_DATA(75,254,90,202,237,164,164,36,167,89,201,201,201,26,179,162,163,163,53,102,197,198,196,104,204,138,139,139,213,152,21,31)
|
||||
IMAGE_DATA(31,167,49,43,41,49,81,99,22,223,95,53,235,82,74,138,198,172,212,75,151,52,102,165,165,165,106,204,74,79,79,215)
|
||||
IMAGE_DATA(152,145,153,145,161,49,43,39,59,91,211,159,147,147,163,49,43,247,114,174,198,172,188,188,60,141,89,249,249,249,26,179)
|
||||
IMAGE_DATA(164,150,102,21,20,20,104,204,42,44,44,212,152,85,82,82,162,49,171,112,54,94,154,197,90,53,199,85,107,204,82,43)
|
||||
IMAGE_DATA(138,15,54,136,141,146,215,216,32,190,121,235,236,53,54,136,141,146,85,227,90,85,210,36,181,202,216,20,25,47,77,146)
|
||||
IMAGE_DATA(90,154,164,106,30,164,212,114,208,82,75,147,164,150,91,61,169,165,73,115,245,75,147,164,150,166,168,253,124,77,106,54)
|
||||
IMAGE_DATA(69,213,108,2,95,83,53,35,53,27,164,106,105,146,212,242,247,60,215,247,115,87,85,194,3,213,172,200,200,72,49,219)
|
||||
IMAGE_DATA(93,205,226,234,114,53,139,171,64,53,139,171,76,53,139,171,76,53,75,86,153,52,135,171,76,53,139,159,171,154,197,247)
|
||||
IMAGE_DATA(87,205,226,42,83,205,226,42,83,205,226,42,83,205,224,42,83,205,226,42,83,251,185,202,84,179,184,202,84,179,184,202)
|
||||
IMAGE_DATA(84,179,184,202,84,179,184,170,84,179,164,150,230,112,149,169,102,113,149,169,102,113,149,169,102,45,84,85,172,53,102,149)
|
||||
IMAGE_DATA(150,150,162,170,170,202,105,22,255,134,200,27,203,242,242,114,113,173,163,163,67,124,112,190,86,83,83,227,252,24,124,173)
|
||||
IMAGE_DATA(130,98,84,93,89,89,233,220,152,184,211,85,85,90,93,77,207,85,243,107,170,171,181,186,198,85,215,56,55,190,172,107)
|
||||
IMAGE_DATA(73,203,141,172,208,181,181,206,141,41,235,58,210,114,163,201,186,190,190,222,185,113,148,90,110,228,220,105,131,193,224,220)
|
||||
IMAGE_DATA(168,177,110,104,104,208,140,191,193,208,160,25,31,107,185,49,146,241,143,162,165,57,172,231,221,96,212,252,84,7,21,245)
|
||||
IMAGE_DATA(154,107,204,162,254,255,235,135,252,112,183,193,224,234,226,42,227,54,87,21,207,94,174,50,57,155,121,38,112,149,113,53)
|
||||
IMAGE_DATA(113,91,206,40,174,30,119,90,206,64,174,38,85,115,53,169,154,171,73,205,231,106,210,234,26,141,174,157,213,178,194,184)
|
||||
IMAGE_DATA(154,88,203,10,171,155,213,178,194,184,90,88,203,10,147,90,86,152,212,178,162,184,154,84,205,179,157,181,172,48,174,30)
|
||||
IMAGE_DATA(117,252,82,203,241,201,120,89,65,143,162,101,101,177,126,168,178,190,69,255,228,113,96,255,190,240,211,159,158,202,46,43)
|
||||
IMAGE_DATA(45,70,81,97,254,188,148,22,23,130,99,101,78,69,121,41,140,173,183,97,105,111,67,187,217,228,22,238,107,51,181,130)
|
||||
IMAGE_DATA(99,239,63,167,8,55,174,95,197,205,166,70,52,221,184,54,47,50,166,184,40,95,192,121,215,27,27,4,215,174,214,139)
|
||||
IMAGE_DATA(190,198,107,6,231,53,21,142,173,40,47,209,228,113,108,199,29,51,186,187,236,206,220,78,135,85,192,49,146,242,178,98)
|
||||
IMAGE_DATA(228,230,102,227,26,245,95,165,231,52,54,242,143,43,43,173,69,118,113,182,90,45,162,205,24,12,181,180,100,148,208,71)
|
||||
IMAGE_DATA(175,67,17,61,43,61,53,5,13,245,181,168,175,173,70,93,77,149,56,219,58,44,112,216,58,156,240,119,204,201,202,64)
|
||||
IMAGE_DATA(222,229,108,65,86,70,26,82,146,19,81,95,87,77,147,177,82,80,83,93,65,223,207,8,27,61,139,225,113,23,22,228)
|
||||
IMAGE_DATA(33,255,202,101,113,46,42,188,130,244,180,20,36,196,199,136,248,234,170,114,145,211,102,106,161,111,110,18,200,54,223,71)
|
||||
IMAGE_DATA(126,139,210,146,66,90,251,47,210,254,226,188,136,175,170,44,19,125,95,222,188,46,226,249,190,57,217,25,228,107,179,128)
|
||||
IMAGE_DATA(253,226,28,62,243,24,99,163,207,163,170,162,12,149,228,103,97,126,158,120,95,62,243,123,240,57,55,39,11,217,153,233)
|
||||
IMAGE_DATA(40,42,184,130,178,146,34,148,211,188,186,148,156,68,251,147,56,241,252,146,226,2,228,209,183,189,156,147,73,123,132,44)
|
||||
IMAGE_DATA(241,62,252,76,190,206,253,242,121,236,65,124,92,180,152,51,23,147,226,133,86,199,194,154,199,93,89,81,170,33,51,35)
|
||||
IMAGE_DATA(85,51,71,147,18,226,196,251,186,35,45,53,89,144,152,16,235,204,209,20,7,31,135,223,124,35,220,248,198,46,52,7)
|
||||
IMAGE_DATA(4,205,75,203,235,59,192,177,50,199,180,119,63,134,170,232,39,65,51,173,193,183,140,238,161,190,17,195,117,152,246,188)
|
||||
IMAGE_DATA(45,114,91,67,118,163,43,54,21,221,201,57,232,74,202,186,79,66,230,131,118,226,44,212,238,190,152,77,231,108,220,222)
|
||||
IMAGE_DATA(178,21,183,54,110,65,103,108,6,28,103,47,10,108,255,140,163,184,76,216,35,19,97,143,74,130,227,92,178,64,180,57)
|
||||
IMAGE_DATA(38,58,21,173,187,247,163,121,227,102,202,75,167,62,202,249,34,14,255,182,88,113,111,106,146,238,155,73,58,22,83,35)
|
||||
IMAGE_DATA(163,2,199,5,202,191,144,2,71,76,26,140,33,251,80,19,184,65,104,123,100,60,28,241,105,152,158,156,192,189,123,51)
|
||||
IMAGE_DATA(152,161,243,228,192,128,104,51,150,127,197,192,188,255,61,56,62,143,70,227,91,123,144,229,191,14,157,103,226,97,59,125)
|
||||
IMAGE_DATA(30,29,167,206,162,57,58,14,83,180,225,157,161,141,177,164,226,248,95,209,232,19,0,211,170,87,97,246,217,140,226,117)
|
||||
IMAGE_DATA(65,136,209,175,69,215,39,95,192,118,242,83,226,20,172,39,78,98,136,54,142,147,19,147,130,49,250,73,119,123,107,8)
|
||||
IMAGE_DATA(236,171,233,125,244,193,232,37,178,253,3,113,202,207,15,221,20,107,139,248,16,182,63,127,132,62,171,13,125,253,131,24)
|
||||
IMAGE_DATA(24,28,70,119,103,23,250,169,221,223,221,139,129,144,80,140,232,183,96,204,63,24,201,47,175,67,196,106,31,116,135,29)
|
||||
IMAGE_DATA(131,237,112,24,44,161,71,208,220,216,4,27,197,23,28,141,64,238,107,219,97,233,176,194,76,88,66,14,98,84,255,42)
|
||||
IMAGE_DATA(198,41,239,220,26,61,194,95,242,65,239,190,3,176,147,159,183,131,118,34,89,31,136,156,176,247,112,211,103,131,24,91)
|
||||
IMAGE_DATA(238,142,93,72,217,246,22,28,126,65,24,245,255,237,253,60,189,30,31,109,8,128,37,104,27,108,65,59,112,99,85,48)
|
||||
IMAGE_DATA(12,47,6,163,241,215,91,232,27,4,163,211,55,24,131,126,175,162,151,24,165,247,26,33,198,253,183,226,184,175,175,152)
|
||||
IMAGE_DATA(51,159,173,245,69,255,230,32,244,236,13,68,231,129,64,244,254,46,16,131,135,2,49,26,26,136,187,127,8,192,132,228)
|
||||
IMAGE_DATA(157,13,72,219,164,215,204,209,15,252,245,136,90,175,199,153,245,107,112,38,96,13,34,233,124,54,208,15,231,2,238,115)
|
||||
IMAGE_DATA(129,218,199,95,242,117,230,60,84,28,159,135,30,74,168,255,225,10,148,235,116,243,82,253,204,51,224,88,153,99,120,106)
|
||||
IMAGE_DATA(57,122,18,50,48,84,209,128,161,82,131,123,168,175,63,35,31,134,165,203,68,110,221,138,21,48,135,70,160,253,216,223)
|
||||
IMAGE_DATA(208,254,238,95,238,115,228,227,7,237,176,89,184,125,244,36,157,79,162,114,233,82,84,208,243,205,161,39,96,220,115,84)
|
||||
IMAGE_DATA(208,178,227,29,138,251,24,173,33,97,84,4,127,130,113,239,49,129,104,83,191,233,247,17,168,91,178,28,149,50,143,250)
|
||||
IMAGE_DATA(90,118,254,17,227,77,45,248,207,244,140,184,127,203,206,195,152,25,26,22,152,14,132,195,116,240,125,152,14,29,135,225)
|
||||
IMAGE_DATA(177,101,72,165,188,118,186,135,113,87,24,204,71,78,224,43,154,212,124,112,238,116,79,31,228,113,243,205,195,184,241,236)
|
||||
IMAGE_DATA(11,104,223,17,138,252,199,159,198,223,41,207,178,231,93,24,119,30,66,203,182,253,168,166,201,39,115,229,145,244,242,70)
|
||||
IMAGE_DATA(20,80,220,117,162,137,56,79,28,38,58,94,15,129,113,211,118,24,95,217,134,86,255,77,24,180,118,80,1,126,37,24)
|
||||
IMAGE_DATA(31,30,69,173,110,9,218,249,254,68,39,241,15,98,43,97,243,127,5,70,191,117,48,174,13,64,151,137,86,198,190,65)
|
||||
IMAGE_DATA(244,209,59,217,172,118,244,80,187,199,209,133,222,37,43,49,76,177,227,196,251,132,47,97,127,254,5,152,126,246,60,190)
|
||||
IMAGE_DATA(92,249,115,84,23,151,195,68,241,81,191,242,195,103,212,119,171,213,132,38,162,121,233,115,24,35,125,151,56,72,248,240)
|
||||
IMAGE_DATA(179,159,253,1,204,203,190,131,58,106,127,64,124,242,139,23,197,252,224,177,157,214,125,19,17,186,167,68,91,205,91,191)
|
||||
IMAGE_DATA(124,25,110,209,217,68,148,16,185,132,252,6,252,62,253,179,239,196,57,195,179,121,107,9,158,51,219,233,220,67,56,190)
|
||||
IMAGE_DATA(77,177,223,163,184,231,40,254,71,20,251,99,29,166,126,162,195,180,100,165,14,31,206,230,200,57,186,154,230,206,94,186)
|
||||
IMAGE_DATA(182,139,216,77,236,33,222,38,14,204,142,235,16,161,87,114,104,15,252,152,179,48,104,196,112,199,170,95,234,86,51,178)
|
||||
IMAGE_DATA(29,240,27,93,160,72,120,156,210,23,74,86,81,227,212,138,116,213,226,120,146,254,61,194,241,112,226,131,235,112,211,15)
|
||||
IMAGE_DATA(55,184,139,159,43,110,161,251,207,61,174,39,117,79,204,17,59,239,224,23,26,236,255,102,112,115,29,79,60,236,194,66)
|
||||
IMAGE_DATA(95,124,174,235,11,57,241,168,241,11,143,199,117,208,234,31,35,93,175,187,235,83,255,55,238,92,215,213,190,133,226,221)
|
||||
IMAGE_DATA(221,223,245,218,127,1,218,41,220,130,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
|
||||
IMAGE_END_DATA(2496, 19)
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
uses
|
||||
CtrlLib;
|
||||
|
||||
file
|
||||
QuickTabs.h,
|
||||
QuickTabs.cpp,
|
||||
QuickTabs.iml;
|
||||
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
#ifndef _QuickTabs_icpp_init_stub
|
||||
#define _QuickTabs_icpp_init_stub
|
||||
#include "CtrlLib/init"
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -101,59 +101,67 @@ public:
|
|||
struct Style : public TabCtrl::Style { };
|
||||
|
||||
protected:
|
||||
enum
|
||||
{
|
||||
enum {
|
||||
TB_MARGIN = 6,
|
||||
TB_SPACE = 10,
|
||||
TB_SBHEIGHT = 4,
|
||||
TB_SBSEPARATOR = 1,
|
||||
TB_FILEICON = 16,
|
||||
TB_ICON = 16,
|
||||
TB_SPACEICON = 5
|
||||
};
|
||||
|
||||
struct Tab : Moveable<Tab>
|
||||
{
|
||||
struct Tab : Moveable<Tab> {
|
||||
int id;
|
||||
|
||||
Value data;
|
||||
String group;
|
||||
BiVector<Value> stack;
|
||||
|
||||
Image img;
|
||||
Value key;
|
||||
Value value;
|
||||
String group;
|
||||
|
||||
String stackid;
|
||||
unsigned sort_order;
|
||||
int stack;
|
||||
|
||||
bool visible;
|
||||
|
||||
Point pos;
|
||||
Size size;
|
||||
|
||||
int stdcx;
|
||||
|
||||
Point cross_pos;
|
||||
Size cross_size;
|
||||
|
||||
Point tab_pos;
|
||||
Size tab_size;
|
||||
|
||||
Tab() : visible(true), id(-1)
|
||||
Tab() : visible(true), id(-1), stack(-1), sort_order(0)
|
||||
{}
|
||||
int Right() const { return pos.x + size.cx; }
|
||||
bool HasMouse(const Point& p) const;
|
||||
bool HasMouseCross(const Point& p) const;
|
||||
bool HasIcon() const { return !img.IsEmpty(); }
|
||||
int Right() const { return pos.x + size.cx; }
|
||||
};
|
||||
|
||||
struct Group : Moveable<Group>
|
||||
{
|
||||
struct Group : Moveable<Group> {
|
||||
Group() {}
|
||||
String name;
|
||||
Value data;
|
||||
int active;
|
||||
int count;
|
||||
int first;
|
||||
int last;
|
||||
};
|
||||
struct TabGroupSort {
|
||||
bool operator()(const Tab &a, const Tab &b) const { return a.group < b.group; }
|
||||
};
|
||||
struct TabStackSort {
|
||||
bool operator()(const Tab &a, const Tab &b) const { return a.sort_order < b.sort_order || (a.stackid == b.stackid && a.sort_order < b.sort_order); }
|
||||
};
|
||||
protected:
|
||||
|
||||
TabScrollBar sc;
|
||||
|
||||
Vector<Group> groups;
|
||||
Vector<Tab> tabs;
|
||||
int active;
|
||||
TabScrollBar sc;
|
||||
|
||||
Vector<Group> groups;
|
||||
Vector<Tab> tabs;
|
||||
Vector<int> separators;
|
||||
int active;
|
||||
|
||||
private:
|
||||
int id;
|
||||
|
|
@ -170,17 +178,20 @@ private:
|
|||
bool inactivedisabled:1;
|
||||
bool stacking:1;
|
||||
bool groupsort:1;
|
||||
Gate2<Value, Value> stackfunc;
|
||||
int neverempty;
|
||||
bool groupseps:1;
|
||||
bool allownullcursor:1;
|
||||
bool icons:1;
|
||||
int mintabcount;
|
||||
Point mouse, oldp;
|
||||
int group;
|
||||
const Display *display;
|
||||
Image dragtab;
|
||||
int stackcount;
|
||||
|
||||
static Style leftstyle, rightstyle, bottomstyle;
|
||||
const Style *style[4];
|
||||
|
||||
void PaintTab(Draw &w, const Style &s, const Size &sz, int i, bool enable, bool dragsample = false);
|
||||
void PaintTab(Draw &w, const Style &s, const Size &sz, int i, bool enable, bool dragsample = false);
|
||||
|
||||
int TabPos(const String &g, bool &first, int i, int j, bool inactive);
|
||||
void SyncScrollBar(bool synctotal = true);
|
||||
|
|
@ -191,14 +202,20 @@ private:
|
|||
int GetPrev(int n) const;
|
||||
|
||||
int GetWidth(int n);
|
||||
int GetExtraWidth();
|
||||
int GetWidth() const;
|
||||
int GetHeight(bool scrollbar = true) const;
|
||||
|
||||
void DoStacking();
|
||||
void DoUnstacking();
|
||||
void StackRemove(BiVector<Value> &stack, int ix);
|
||||
int FindInStack(const Value &data, int &stackix) const;
|
||||
void CycleTabStack(int n);
|
||||
void InsertIntoStack(Tab &t, int ix);
|
||||
int FindStackHead(int stackix) const;
|
||||
int FindStackTail(int stackix) const;
|
||||
bool IsStackHead(int n) const;
|
||||
bool IsStackTail(int n) const;
|
||||
int SetStackHead(Tab &t);
|
||||
void CycleTabStack(int head, int n);
|
||||
int CycleTabStack(int n);
|
||||
|
||||
static int GetStyleHeight(const Style& s);
|
||||
|
||||
|
|
@ -227,77 +244,100 @@ protected:
|
|||
virtual void FrameLayout(Rect& r);
|
||||
virtual void Layout();
|
||||
|
||||
// Mouse handling/tab positioning
|
||||
bool ProcessMouse(int i, const Point& p);
|
||||
|
||||
bool ProcessStackMouse(int i, const Point& p);
|
||||
void SetHighlight(int n);
|
||||
int GetTargetTab(Point p);
|
||||
void Repos();
|
||||
|
||||
// Grouping
|
||||
void MakeGroups();
|
||||
int FindGroup(const String& g) const;
|
||||
void CloseAll();
|
||||
void CloseAll(int exception);
|
||||
void DoGrouping(int n);
|
||||
void DoCloseGroup(int n);
|
||||
void NewGroup(const String &name, const Value &data = Value());
|
||||
|
||||
virtual WString ParseLabel(const WString& s);
|
||||
// Sub-class display overide & helpers
|
||||
virtual void PaintTabData(Draw& w, const Rect &t, const Tab& tab, const Font &font,
|
||||
Color ink, dword style);
|
||||
void NewGroup(const String &name);
|
||||
|
||||
// Insertion without repos/refresh - for batch actions
|
||||
void InsertKey0(int ix, const Value &key, const Value &value, Image icon = Null, String group = Null);
|
||||
|
||||
// Sub-class Paint override
|
||||
virtual void PaintTab(Draw& w, const Rect &r, const Tab& tab, const Font &font,
|
||||
Color ink, dword style);
|
||||
virtual void PaintStackedTab(Draw& w, const Rect &r, const Tab& tab, const Font &font,
|
||||
Color ink, dword style);
|
||||
virtual Size GetStdSize(const Tab &t);
|
||||
virtual Size GetStackedSize(const Tab &t);
|
||||
Size GetStdSize(const Value &v);
|
||||
|
||||
|
||||
// Paint helpers
|
||||
int GetTextAngle() { return AlignedFrame::IsVert() ? (GetAlign() == LEFT ? 900 : 2700) : 0; }
|
||||
Point GetTextPosition(const Rect& r, int cy, int space) const;
|
||||
Point GetImagePosition(const Rect& r, int cx, int cy, int space, int side) const;
|
||||
int GetTargetTab(Point p);
|
||||
bool PaintIcons() { return icons; }
|
||||
|
||||
const Style &GetStyle() { return *style[GetAlign()]; }
|
||||
|
||||
// Sub-class menu overrides
|
||||
virtual void ContextMenu(Bar& bar);
|
||||
virtual void GroupMenu(Bar &bar, int n);
|
||||
|
||||
struct TabGroupSort {
|
||||
bool operator () (const Tab& a, const Tab& b) const { return a.group < b.group; }
|
||||
};
|
||||
// Sorting/Stacking overriddes
|
||||
virtual String GetStackId(const Tab &a) { NEVER(); return false; }
|
||||
virtual unsigned GetStackSortOrder(const Tab &a) { return 0; }
|
||||
public:
|
||||
typedef TabBar CLASSNAME;
|
||||
|
||||
Callback WhenHighlight;
|
||||
Callback1<Value> WhenClose;
|
||||
Callback WhenCloseAll;
|
||||
Callback WhenLeftDouble;
|
||||
Callback WhenHighlight; // Executed on tab mouse-over
|
||||
Callback WhenLeftDouble; // Executed on left-button double-click (clicked tab will be the active tab)
|
||||
Gate1<Value> CancelClose; // Return true to cancel action. Parameter: Key of closed tab
|
||||
Callback1<Value> WhenClose; // Executed before tab closing. Parameter: Key of closed tab
|
||||
Gate CancelCloseAll; // Return true to cancel action;
|
||||
Callback WhenCloseAll; // Executed before 'Close All' action
|
||||
|
||||
TabBar();
|
||||
|
||||
TabBar& Add(const Value &data) { return Add(data, Null, false); }
|
||||
TabBar& Add(const Value &data, bool make_active) { return Add(data, Null, make_active); }
|
||||
TabBar& Add(const Value &data, const char *group, bool make_active = false) { return Add(data, String(group), make_active); }
|
||||
TabBar& Add(const Value &data, String group, bool make_active = false);
|
||||
TabBar& Insert(int ix, const Value &data, bool make_active = false) { return Insert(ix, data, Null, make_active); }
|
||||
TabBar& Insert(int ix, const Value &data, String group = Null, bool make_active = false);
|
||||
TabBar& Add(const Value &value, Image icon = Null, String group = Null, bool make_active = false);
|
||||
TabBar& Insert(int ix, const Value &value, Image icon = Null, String group = Null, bool make_active = false);
|
||||
|
||||
TabBar& AddKey(const Value &key, const Value &value, Image icon = Null, String group = Null, bool make_active = false);
|
||||
TabBar& InsertKey(int ix, const Value &key, const Value &value, Image icon = Null, String group = Null, bool make_active = false);
|
||||
|
||||
void Close(int n);
|
||||
void CloseData(const Value &data);
|
||||
void CloseData(const Value &key);
|
||||
void Clear();
|
||||
|
||||
TabBar& Crosses(bool b = true);
|
||||
TabBar& Grouping(bool b = true);
|
||||
TabBar& GroupSort(bool b = true);
|
||||
TabBar& GroupSort(bool b = true);
|
||||
TabBar& GroupSeparators(bool b = true);
|
||||
TabBar& AutoScrollHide(bool b = true);
|
||||
TabBar& InactiveDisabled(bool b = true);
|
||||
TabBar& AllowNullCursor(bool b = true);
|
||||
TabBar& Icons(bool v = true);
|
||||
|
||||
TabBar& Stacking(bool b = true);
|
||||
bool IsStacking() { return stacking; }
|
||||
|
||||
TabBar& NeverEmpty() { MinTabCount(1); }
|
||||
TabBar& MinTabCount(int cnt) { mintabcount = max(cnt, 0); Refresh(); return *this; }
|
||||
|
||||
TabBar& SetDisplay(const Display &d) { display = &d; Refresh(); }
|
||||
TabBar& SetBorder(int border) { AlignedFrame::SetBorder(border); return *this; }
|
||||
int Find(const Value &v) const;
|
||||
int FindKey(const Value &v) const;
|
||||
int FindValue(const Value &v) const;
|
||||
|
||||
Value Get(int n) const { ASSERT(n >= 0 && n < tabs.GetCount()); return tabs[n].data;}
|
||||
void Set(int n, const Value &data, const String &group = Null);
|
||||
virtual Value GetData() const { return HasCursor() ? Get(active) : Value(); }
|
||||
virtual void SetData(const Value &data);
|
||||
Value GetKey(int n) const { ASSERT(n >= 0 && n < tabs.GetCount()); return tabs[n].key;}
|
||||
Value GetValue(int n) const { ASSERT(n >= 0 && n < tabs.GetCount()); return tabs[n].value;}
|
||||
Value Get(const Value &key) const { return GetValue(FindKey(key)); }
|
||||
void Set(int n, const Value &newkey, const Value &newvalue);
|
||||
void Set(const Value &key, const Value &newvalue);
|
||||
void Set(int n, const Value &newvalue);
|
||||
void SetTabGroup(int n, const String &group);
|
||||
|
||||
virtual Value GetData() const { return (HasCursor() && active < GetCount()) ? GetKey(active) : Value(); }
|
||||
virtual void SetData(const Value &key);
|
||||
|
||||
Value GetGroupData(const String &s) const { return GetGroupData(FindGroup(s)); }
|
||||
void SetGroupData(const String &s, const Value &data) { SetGroupData(FindGroup(s), data); }
|
||||
Value GetGroupData(int n) const { ASSERT(n >= 0 && n < groups.GetCount()); return groups[n].data; }
|
||||
void SetGroupData(int n, const Value &data) { ASSERT(n >= 0 && n < groups.GetCount()); groups[n].data = data;}
|
||||
|
||||
String GetGroupName() const { return (group == 0) ? Null : groups[group].name; }
|
||||
String GetGroupName(int i) const { return groups[i].name; }
|
||||
int SetGroup(const String &s) { DoGrouping(max(0, FindGroup(s))); return group; }
|
||||
|
|
@ -309,36 +349,32 @@ public:
|
|||
int GetFirst() const { return groups[group].first; }
|
||||
int GetLast() const { return groups[group].last; }
|
||||
bool IsGroupAll() const { return group == 0; }
|
||||
int GetCount() const { return tabs.GetCount(); }
|
||||
|
||||
int GetCursor() const { return active; }
|
||||
int GetHighlight() const { return highlight; }
|
||||
void SetCursor(int n);
|
||||
void KillCursor() { active = -1; Refresh(); }
|
||||
void SetTabGroup(int n, const String &group);
|
||||
|
||||
bool HasCursor() const { return active >= 0; }
|
||||
int GetHighlight() const { return highlight; }
|
||||
bool HasHighlight() const { return highlight >= 0; }
|
||||
int GetCount() const { return tabs.GetCount(); }
|
||||
|
||||
TabBar& StackingFunc(Gate2<Value, Value> func);
|
||||
TabBar& NoStacking();
|
||||
bool IsStacking() { return stacking; }
|
||||
|
||||
TabBar& NeverEmpty(int limit = 1) { neverempty = max(limit, 1); Refresh(); return *this; }
|
||||
TabBar& CanEmpty() { neverempty = 0; Refresh(); return *this; }
|
||||
void SetCursor(int n);
|
||||
void KillCursor() { SetCursor(-1); }
|
||||
|
||||
Image GetDragSample();
|
||||
Image GetDragSample(int n);
|
||||
|
||||
Vector<Value> GetKeys() const;
|
||||
Vector<Image> GetIcons() const;
|
||||
TabBar& CopySettings(const TabBar &src);
|
||||
|
||||
TabBar& SetStyle(int align, const Style& s) { ASSERT(align >= 0 && align < 4); style[align] = &s; Refresh(); return *this; }
|
||||
static const Style& StyleDefault();
|
||||
static const Style& StyleLeft();
|
||||
static const Style& StyleRight();
|
||||
static const Style& StyleBottom();
|
||||
static const Style& AlignStyle(int align, Style &s);
|
||||
static void ResetStyles();
|
||||
|
||||
virtual void Serialize(Stream& s);
|
||||
static void ResetStyles();
|
||||
};
|
||||
|
||||
#include "FileTabs.h"
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ uses
|
|||
file
|
||||
TabBar.h,
|
||||
TabBar.cpp,
|
||||
FileTabs.h,
|
||||
FileTabs.cpp,
|
||||
TabBar.iml;
|
||||
|
||||
mainconfig
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue