本文整理汇总了C++中PasteClip类的典型用法代码示例。如果您正苦于以下问题:C++ PasteClip类的具体用法?C++ PasteClip怎么用?C++ PasteClip使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PasteClip类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GroupDrop
void DockBase::GroupDrop(int parent, int ii, PasteClip& d)
{
if (parent == 0) return d.Reject();
TreeCtrl& tree = grouptab.grouptree;
int p = tree.GetParent(parent);
if (p != 0) parent = p;
if(AcceptInternal<TreeCtrl>(d, "DockCtrlGroupTreeDrag"))
{
Vector<int> sel = tree.GetSel();
for (int i = 0; i < sel.GetCount(); i++)
{
int id = tree.Get(sel[i]);
String group = (String) tree.GetValue(parent);
if(group == t_("Default") || FindWidgetinGroup(group, id))
return d.Reject();
AddWidgettoGroup(group, id);
tree.Open(parent);
}
return;
}
tree.SetFocus();
}
示例2: DndTargets
PasteClip Ctrl::GtkDnd(GtkWidget *widget, GdkDragContext *context, gint x, gint y,
guint time, gpointer user_data, bool paste)
{
DndTargets(context);
g_object_ref(context); // make sure these always survive the action...
g_object_ref(widget);
dnd_context = context;
dnd_widget = widget;
dnd_time = time;
PasteClip clip;
clip.type = 1;
clip.paste = paste;
clip.accepted = false;
clip.allowed = DND_MOVE|DND_COPY;
gint dummy;
GdkModifierType mod;
gdk_window_get_pointer(gdk_get_default_root_window(), &dummy, &dummy, &mod);
clip.action = mod & GDK_CONTROL_MASK ? DND_COPY : DND_MOVE;
Ctrl *w = DragWnd(user_data);
if(w) {
gint mx, my;
GdkModifierType mod;
gdk_window_get_pointer(gdk_get_default_root_window(), &mx, &my, &mod);
CurrentState = mod;
CurrentMousePos = Point(x, y) + w->GetScreenRect().TopLeft();
w->DnD(CurrentMousePos, clip);
}
gdk_drag_status(context, clip.IsAccepted() ? clip.GetAction() == DND_MOVE ? GDK_ACTION_MOVE
: GDK_ACTION_COPY
: GdkDragAction(0), time);
return clip;
}
示例3: DragAndDrop
void DndTest::DragAndDrop(Point p, PasteClip& d)
{
if(d.IsAvailable("files")) {
files = GetClipFiles(d.Get("files"));
Refresh();
}
}
示例4: AcceptFiles
bool AcceptFiles(PasteClip& clip)
{
if(clip.Accept("files")) {
clip.SetAction(DND_COPY);
return true;
}
return false;
}
示例5: GetWString
WString GetWString(PasteClip& clip)
{
GuiLock __;
if(clip.Accept("wtext")) {
String s = ~clip;
return WString((const wchar *)~s, wstrlen((const wchar *)~s));
}
if(clip.Accept("text"))
return (~clip).ToWString();
return Null;
}
示例6: GetString
String GetString(PasteClip& clip)
{
GuiLock __;
if(clip.Accept("wtext")) {
String s = ~clip;
return WString((const wchar *)~s, wstrlen((const wchar *)~s)).ToString();
}
if(clip.IsAvailable("text"))
return ~clip;
return Null;
}
示例7: DnD
void DnDLoop::DnD(bool paste)
{
PasteClip d;
d.paste = paste;
d.accepted = false;
d.allowed = (byte)actions;
d.action = GetCtrl() ? DND_COPY : DND_MOVE;
d.dnd = true;
if(target)
target->DnD(GetMousePos(), d);
action = d.IsAccepted() ? d.GetAction() : DND_NONE;
}
示例8: LLOG
gboolean Ctrl::GtkDragDrop(GtkWidget *widget, GdkDragContext *context, gint x, gint y,
guint time, gpointer user_data)
{
LLOG("GtkDragDrop");
PasteClip clip = GtkDnd(widget, context, x, y, time, user_data, true);
gtk_drag_finish(context, clip.IsAccepted(), clip.IsAccepted() && clip.GetAction() == DND_MOVE, time);
g_object_unref(widget);
g_object_unref(context);
DnDLeave();
return TRUE;
}
示例9: GetImage
Image GetImage(PasteClip& clip)
{
GuiLock __;
Image m;
if(Accept<Image>(clip)) {
LoadFromString(m, ~clip);
if(!m.IsEmpty())
return m;
}
if(clip.Accept("dib")) {
String data = ~clip;
if((unsigned)data.GetCount() < sizeof(BITMAPINFO)) return Null;
BITMAPINFO *lpBI = (BITMAPINFO *)~data;
BITMAPINFOHEADER& hdr = lpBI->bmiHeader;
byte *bits = (byte *)lpBI + hdr.biSize;
if(hdr.biBitCount <= 8)
bits += (hdr.biClrUsed ? hdr.biClrUsed : 1 << hdr.biBitCount) * sizeof(RGBQUAD);
if(hdr.biBitCount >= 16 || hdr.biBitCount == 32) {
if(hdr.biCompression == 3)
bits += 12;
if(hdr.biClrUsed != 0)
bits += hdr.biClrUsed * sizeof(RGBQUAD);
}
int h = abs((int)hdr.biHeight);
ImageDraw iw(hdr.biWidth, h);
::StretchDIBits(iw.GetHandle(),
0, 0, hdr.biWidth, h,
0, 0, hdr.biWidth, h,
bits, lpBI, DIB_RGB_COLORS, SRCCOPY);
return iw;
}
return Null;
}
示例10: DnDInsert
void WorkspaceWork::DnDInsert(int line, PasteClip& d)
{
if(GetActivePackage() == METAPACKAGE)
return;
if(GetInternalPtr<UppList>(d, "package-file") == &filelist && d.Accept())
DoMove(line < fileindex.GetCount() ? fileindex[line] : actual.file.GetCount(), true);
}
示例11: DragAndDrop
void LineEdit::DragAndDrop(Point p, PasteClip& d)
{
if(IsReadOnly()) return;
int c = GetMousePos(p);
if(AcceptText(d)) {
NextUndo();
int a = sb.y;
int sell, selh;
WString text = GetWString(d);
if(GetSelection(sell, selh)) {
if(c >= sell && c < selh) {
if(!IsReadOnly())
RemoveSelection();
if(IsDragAndDropSource())
d.SetAction(DND_COPY);
c = sell;
}
else
if(d.GetAction() == DND_MOVE && IsDragAndDropSource()) {
if(c > sell)
c -= selh - sell;
if(!IsReadOnly())
RemoveSelection();
d.SetAction(DND_COPY);
}
}
int count = Insert(c, text);
sb.y = a;
SetFocus();
SetSelection(c, c + count);
Action();
return;
}
if(!d.IsAccepted()) return;
if(!isdrag) {
isdrag = true;
ScrollIntoCursor();
}
Point dc = Null;
if(c >= 0)
dc = GetColumnLine(c);
if(dc != dropcaret) {
RefreshDropCaret();
dropcaret = dc;
RefreshDropCaret();
}
}
示例12: DragAndDrop
void DocEdit::DragAndDrop(Point p, PasteClip& d)
{
if(IsReadOnly()) return;
int c = GetMousePos(p);
if(AcceptText(d)) {
NextUndo();
int a = sb;
int sell, selh;
WString txt = GetWString(d);
if(GetSelection(sell, selh)) {
if(c >= sell && c < selh) {
if(!IsReadOnly())
RemoveSelection();
if(IsDragAndDropSource())
d.SetAction(DND_COPY);
c = sell;
}
else
if(d.GetAction() == DND_MOVE && IsDragAndDropSource()) {
if(c > sell)
c -= selh - sell;
if(!IsReadOnly())
RemoveSelection();
d.SetAction(DND_COPY);
}
}
int count = Insert(c, txt);
sb = a;
SetFocus();
SetSelection(c, c + count);
Action();
return;
}
if(!d.IsAccepted()) return;
Point dc = Null;
if(c >= 0) {
Point cr = GetCaret(c);
dc = Point(cr.x + 1, cr.y);
}
if(dc != dropcaret) {
RefreshDropCaret();
dropcaret = dc;
RefreshDropCaret();
}
}
示例13: DragAndDrop
void MyApp::DragAndDrop(Point p, PasteClip& clip)
{
if(clip.Accept("MyAppData")) {
String bin = clip;
if(bin.GetLength() > sizeof(Color)) { // prudent check
pos = p;
memcpy(&data.color, ~bin, sizeof(Color));
data.text = bin.Mid(sizeof(Color));
}
Refresh();
}
if(AcceptText(clip)) {
pos = p;
data.text = GetString(clip);
}
dragpos = clip.IsAccepted() ? p : Null;
Refresh();
}
示例14: DropWatch
void Pdb::DropWatch(PasteClip& clip)
{
String s = StringStream(GetString(clip)).GetLine();
if(s.GetCount()) {
watches.Add(s);
clip.SetAction(DND_COPY);
Data();
}
}
示例15: DropSum
void DropSum(int ii, PasteClip& d) {
if(AcceptInternal<ColumnList>(d, "mydrag")) {
const ColumnList& src = GetInternal<ColumnList>(d);
int sum = 0;
for(int i = 0; i < src.GetCount(); i++)
if(src.IsSel(i))
sum += atoi(~String(src[i]));
list.Set(ii, AsString(sum));
d.SetAction(DND_COPY);
list.SetCursor(ii);
}
}