本文整理汇总了C++中Ctrl类的典型用法代码示例。如果您正苦于以下问题:C++ Ctrl类的具体用法?C++ Ctrl怎么用?C++ Ctrl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Ctrl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LLOG
bool MenuBar::HotKey(dword key)
{
if(Ctrl::HotKey(key))
return true;
if(IsChild()) {
if((key == (K_ALT_KEY|K_KEYUP) || key == K_F10) && (submenu || HasFocusDeep())) {
LLOG("CloseMenu()");
CloseMenu();
if(restorefocus)
restorefocus->SetFocus();
s_doaltkey = false;
return true;
}
if(key == K_ALT_KEY) {
LLOG("K_ALT_KEY");
s_doaltkey = true;
return true;
}
if((key == K_F10 || key == (K_ALT_KEY|K_KEYUP) && s_doaltkey)
&& !submenu && !HasFocusDeep() && GetTopWindow() && GetTopWindow()->IsForeground()) {
LLOG("Open menu by F10 or ALT-UP");
SetupRestoreFocus();
for(Ctrl *q = pane.GetFirstChild(); q; q = q->GetNext())
if(q->SetFocus()) return true;
}
}
LLOG("MenuBar::HotKey");
return (key == K_LEFT || key == K_RIGHT) && parentmenu ? parentmenu->Key(key, 1) : false;
}
示例2: GetOwner
// get user options, process and save.
void
Options::onbtnSave()
{
int dontsplash = optSplash.Get(); // get the value from option control
int savewinpos = optSaveWinPos.Get();// get the value from option control
Ctrl* owner = GetOwner(); // get a handle to the Options dislog owner which is MyUppApp main window.
Rect rc; // create a struct to store window position and size
if ( savewinpos != 1 ) { // if Save Window option is not checked.
rc.left = 0; // set window position x to 0
rc.top = 0; // set window position y to 0
} else {
rc = owner->GetRect(); // get the position and size of MyUppApp main window
}
String cfg; // create a string to store config data
cfg << "Splash=" << dontsplash << "\n" // save user's choice
"SaveWinPos=" << savewinpos << "\n" // save user's choice
"PosX=" << rc.left << "\n" // save window x position
"PosY=" << rc.top << "\n"; // save window y position
if( !SaveFile(cfgfile, cfg) ) // save the config file
Exclamation("Error saving configuration!"); // if failed show error dialog
else
PromptOK("Options saved!"); // show success dialog
Break(IDOK); // close this dialog
}
示例3: ShowToolTip
void ShowToolTip()
{
LLOG("ShowToolTip");
CloseToolTip();
if(tipctrl) {
String text = tipctrl->GetTip();
LLOG("-> showing tip: " << text << " tipctrl: " << UPP::Name(tipctrl));
Ctrl *top = tipctrl->GetTopCtrl();
if(!text.IsEmpty() && top && (top->IsForeground() || top->IsPopUp())) {
LLOG("-> foreground");
ToolTip& q = AppToolTip();
q.Set(text);
Size sz = q.GetMinSize();
Rect r = top->GetWorkArea();
Point p = GetMousePos() + Size(0, 22);
if(p.y + sz.cy > r.bottom)
p = GetMousePos() - Size(0, 22);
q.PopUp(top, p, !showmode);
showmode = true;
KillTimeCallback((void *)EndShowMode);
return;
}
LLOG("-> background / empty text, top = " << UPP::Name(top));
}
SetTimeCallback(200, callback(EndShowMode), (void *)EndShowMode);
}
示例4: RemoveFullRefresh
void Ctrl::RemoveFullRefresh()
{
GuiLock __;
fullrefresh = false;
for(Ctrl *q = GetFirstChild(); q; q = q->GetNext())
q->RemoveFullRefresh();
}
示例5: GetFirstChild
Ctrl * DockPane::FindCtrl(int ix)
{
Ctrl *c = GetFirstChild();
for (int i = 0; i < ix && c; i++)
c = c->GetNext();
return c;
}
示例6: tm
void Themed::ReadTheme()
{
int q = theme.Find(ToLower(GetClass()));
if(q < 0) return;
ClassTheme& cm = theme[q];
ThemeProperties tm(cm.data.property, cm.data.image, true);
Properties(tm);
Ctrl *p = dynamic_cast<Ctrl *>(this);
if(p)
for(Ctrl *q = p->GetFirstChild(); q; q = q->GetNext()) {
Themed *t = dynamic_cast<Themed *>(q);
if(t) {
int i = cm.child.Find(t->GetClass());
if(i >= 0) {
ThemeProperties tm(cm.child[i].property, cm.child[i].image, true);
t->Properties(tm);
}
i = cm.child.Find(t->id);
if(i >= 0) {
q->SetPos(cm.child[i].pos);
ThemeProperties tm(cm.child[i].property, cm.child[i].image, true);
t->Properties(tm);
}
}
}
}
示例7: max
void DisplayPopup::Sync()
{
if(display && ctrl && !ctrl->IsDragAndDropTarget() && !IsDragAndDropTarget()) {
Ctrl *top = ctrl->GetTopCtrl();
if(top && top->HasFocusDeep()) {
Size sz = display->GetStdSize(value);
if(sz.cx + 2 * margin > item.GetWidth() || sz.cy > item.GetHeight()) {
slim = item + ctrl->GetScreenView().TopLeft();
if(slim.Contains(GetMousePos())) {
// Rect wa = GetWorkArea();
Rect r = item;
r.right = max(r.right, r.left + sz.cx + 2 * margin);
r.bottom = max(r.bottom, r.top + sz.cy);
r.Inflate(1, 1);
r.Offset(ctrl->GetScreenView().TopLeft());
SetRect(r);
if(!IsOpen())
Ctrl::PopUp(ctrl, true, false, false);
Refresh();
return;
}
}
}
}
if(IsOpen())
Close();
}
示例8: GetDockAlign
void DockWindow::Undock(DockCont &c)
{
if (!c.IsFloating() && !c.IsHidden()) {
if (c.IsAutoHide()) {
for (int i = 0; i < 4; i++) {
int ix = hideframe[i].FindCtrl(c);
if (ix >= 0) {
hideframe[i].RemoveCtrl(ix);
hideframe[i].RefreshFrame();
break;
}
}
}
else {
int dock = GetDockAlign(c);
if (dock >= 0 && dock < 4) {
Ctrl *p = &c;
while (p && p->GetParent() != &dockpane[dock]) p = p->GetParent();
ASSERT(p);
bool v = !IsTB(dock);
c.SyncUserSize(v, !v);
}
Undock0(c);
}
c.StateNotDocked();
}
}
示例9: Reject
void TopWindow::Reject()
{
for(Ctrl *q = GetFirstChild(); q; q = q->GetNext())
q->Reject();
if(!backup.IsEmpty())
Restore();
}
示例10: 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;
}
示例11: LLOG
void Ctrl::WndUpdate(const Rect& r)
{
GuiLock __;
LLOG("WndUpdate " << UPP::Name(this));
Ctrl *top = GetTopCtrl();
if(top->IsOpen()) {
HWND hwnd = top->GetHWND();
HDC hdc = GetDC(hwnd);
HRGN hrgn = CreateRectRgn(0, 0, 0, 0);
if(GetUpdateRgn(hwnd, hrgn, FALSE) != NULLREGION) {
SelectClipRgn(hdc, hrgn);
SystemDraw draw(hdc);
bool hcr = focusCtrl && focusCtrl->GetTopCtrl() == top &&
caretRect.Intersects(r + top->GetRect().TopLeft());
if(hcr) ::HideCaret(hwnd);
draw.Clip(r);
top->UpdateArea(draw, r);
ValidateRect(hwnd, r);
SelectClipRgn(hdc, NULL);
if(hcr) ::ShowCaret(hwnd);
}
ReleaseDC(hwnd, hdc);
DeleteObject(hrgn);
}
}
示例12: GetActiveCtrl
void Ctrl::PopUp(Ctrl *owner, bool savebits, bool activate, bool dropshadow, bool topmost)
{
popup = false;
Ctrl *q = owner ? owner->GetTopCtrl() : GetActiveCtrl();
PopUpHWND(q ? q->GetHWND() : NULL, savebits, activate, dropshadow, topmost);
if(top) top->owner = owner;
}
示例13: EnterGuiMutex
ViewDraw::ViewDraw(Ctrl *ctrl)
{
EnterGuiMutex();
Ctrl *top = ctrl->GetTopCtrl();
cr = gdk_cairo_create(top->gdk());
Clipoff(ctrl->GetScreenView() - top->GetScreenRect().TopLeft());
}
示例14: layout
VisGenDlg::VisGenDlg(LayoutData& layout, const Vector<int>& cursor)
: layout(layout)
{
type <<= 0;
CtrlLayoutOKCancel(*this, "Code generator");
type <<= THISBACK(Type);
// needs to be before Refresh to maintain the proper order of action
toupper1 << [=] { tolower1 <<= false; initcaps1 <<= false; };
tolower1 << [=] { toupper1 <<= false; initcaps1 <<= false; };
initcaps1 << [=] { toupper1 <<= false; tolower1 <<= false; };
toupper2 << [=] { tolower2 <<= false; initcaps2 <<= false; };
tolower2 << [=] { toupper2 <<= false; initcaps2 <<= false; };
initcaps2 << [=] { toupper2 <<= false; tolower2 <<= false; };
for(Ctrl *q = GetFirstChild(); q; q = q->GetNext())
if(dynamic_cast<Option *>(q))
*q << [=] { Refresh(); };
name << [=] { Refresh(); };
Refresh();
view.Highlight("cpp");
view.HideBar();
view.SetFont(CourierZ(12));
if(cursor.GetCount())
sel <<= cursor;
else
for(int i = 0; i < layout.item.GetCount(); i++)
sel.Add(i);
}
示例15: GetCtrl
Image DockCont::GetHighlightImage()
{
Ctrl *ctrl = GetCtrl(GetCursor());
ImageDraw img(ctrl->GetRect().GetSize());
ctrl->DrawCtrlWithParent(img);
return img;
}