/usr/include/wx-3.0/wx/wxPython/i_files/_gbsizer.i is in python-wxgtk3.0-dev 3.0.2.0+dfsg-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | /////////////////////////////////////////////////////////////////////////////
// Name: _gbsizer.i
// Purpose: SWIG interface stuff for wxGBGridBagSizer and etc.
//
// Author: Robin Dunn
//
// Created: 05-Nov-2003
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
%}
//---------------------------------------------------------------------------
%typemap(in) wxGBPosition& (wxGBPosition temp) {
$1 = &temp;
if ( ! wxGBPosition_helper($input, &$1)) SWIG_fail;
}
%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER) wxGBPosition& {
$1 = wxPySimple_typecheck($input, wxT("wxGBPosition"), 2);
}
%typemap(in) wxGBSpan& (wxGBSpan temp) {
$1 = &temp;
if ( ! wxGBSpan_helper($input, &$1)) SWIG_fail;
}
%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER) wxGBSpan& {
$1 = wxPySimple_typecheck($input, wxT("wxGBSpan"), 2);
}
%{
bool wxGBPosition_helper(PyObject* source, wxGBPosition** obj)
{
if (source == Py_None) {
**obj = wxGBPosition(-1,-1);
return true;
}
return wxPyTwoIntItem_helper(source, obj, wxT("wxGBPosition"));
}
bool wxGBSpan_helper(PyObject* source, wxGBSpan** obj)
{
if (source == Py_None) {
**obj = wxGBSpan(-1,-1);
return true;
}
return wxPyTwoIntItem_helper(source, obj, wxT("wxGBSpan"));
}
%}
//---------------------------------------------------------------------------
%newgroup;
DocStr(wxGBPosition,
"This class represents the position of an item in a virtual grid of
rows and columns managed by a `wx.GridBagSizer`. wxPython has
typemaps that will automatically convert from a 2-element sequence of
integers to a wx.GBPosition, so you can use the more pythonic
representation of the position nearly transparently in Python code.", "");
class wxGBPosition
{
public:
wxGBPosition(int row=0, int col=0);
~wxGBPosition();
int GetRow() const;
int GetCol() const;
void SetRow(int row);
void SetCol(int col);
%extend {
KeepGIL(__eq__);
DocStr(__eq__, "Compare GBPosition for equality.", "");
bool __eq__(PyObject* other) {
wxGBPosition temp, *obj = &temp;
if ( other == Py_None ) return false;
if ( ! wxGBPosition_helper(other, &obj) ) {
PyErr_Clear();
return false;
}
return self->operator==(*obj);
}
KeepGIL(__ne__);
DocStr(__ne__, "Compare GBPosition for inequality.", "");
bool __ne__(PyObject* other) {
wxGBPosition temp, *obj = &temp;
if ( other == Py_None ) return true;
if ( ! wxGBPosition_helper(other, &obj)) {
PyErr_Clear();
return true;
}
return self->operator!=(*obj);
}
}
%extend {
void Set(int row=0, int col=0) {
self->SetRow(row);
self->SetCol(col);
}
PyObject* Get() {
wxPyBlock_t blocked = wxPyBeginBlockThreads();
PyObject* tup = PyTuple_New(2);
PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->GetRow()));
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->GetCol()));
wxPyEndBlockThreads(blocked);
return tup;
}
}
%pythoncode {
asTuple = wx.deprecated(Get, "asTuple is deprecated, use `Get` instead")
def __str__(self): return str(self.Get())
def __repr__(self): return 'wx.GBPosition'+str(self.Get())
def __len__(self): return len(self.Get())
def __getitem__(self, index): return self.Get()[index]
def __setitem__(self, index, val):
if index == 0: self.SetRow(val)
elif index == 1: self.SetCol(val)
else: raise IndexError
def __nonzero__(self): return self.Get() != (0,0)
__safe_for_unpickling__ = True
def __reduce__(self): return (wx.GBPosition, self.Get())
}
%pythoncode {
row = property(GetRow, SetRow)
col = property(GetCol, SetCol)
}
};
DocStr(wxGBSpan,
"This class is used to hold the row and column spanning attributes of
items in a `wx.GridBagSizer`. wxPython has typemaps that will
automatically convert from a 2-element sequence of integers to a
wx.GBSpan, so you can use the more pythonic representation of the span
nearly transparently in Python code.
", "");
class wxGBSpan
{
public:
DocCtorStr(
wxGBSpan(int rowspan=1, int colspan=1),
"Construct a new wxGBSpan, optionally setting the rowspan and
colspan. The default is (1,1). (Meaning that the item occupies one
cell in each direction.", "");
~wxGBSpan();
int GetRowspan() const;
int GetColspan() const;
void SetRowspan(int rowspan);
void SetColspan(int colspan);
%extend {
KeepGIL(__eq__);
DocStr(__eq__, "Compare wxGBSpan for equality.", "");
bool __eq__(PyObject* other) {
wxGBSpan temp, *obj = &temp;
if ( other == Py_None ) return false;
if ( ! wxGBSpan_helper(other, &obj) ) {
PyErr_Clear();
return false;
}
return self->operator==(*obj);
}
KeepGIL(__ne__);
DocStr(__ne__, "Compare GBSpan for inequality.", "");
bool __ne__(PyObject* other) {
wxGBSpan temp, *obj = &temp;
if ( other == Py_None ) return true;
if ( ! wxGBSpan_helper(other, &obj)) {
PyErr_Clear();
return true;
}
return self->operator!=(*obj);
}
}
%extend {
void Set(int rowspan=1, int colspan=1) {
self->SetRowspan(rowspan);
self->SetColspan(colspan);
}
PyObject* Get() {
wxPyBlock_t blocked = wxPyBeginBlockThreads();
PyObject* tup = PyTuple_New(2);
PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->GetRowspan()));
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->GetColspan()));
wxPyEndBlockThreads(blocked);
return tup;
}
}
%pythoncode {
asTuple = wx.deprecated(Get, "asTuple is deprecated, use `Get` instead")
def __str__(self): return str(self.Get())
def __repr__(self): return 'wx.GBSpan'+str(self.Get())
def __len__(self): return len(self.Get())
def __getitem__(self, index): return self.Get()[index]
def __setitem__(self, index, val):
if index == 0: self.SetRowspan(val)
elif index == 1: self.SetColspan(val)
else: raise IndexError
def __nonzero__(self): return self.Get() != (0,0)
__safe_for_unpickling__ = True
def __reduce__(self): return (wx.GBSpan, self.Get())
}
%pythoncode {
rowspan = property(GetRowspan, SetRowspan)
colspan = property(GetColspan, SetColspan)
}
};
%immutable;
const wxGBSpan wxDefaultSpan;
%mutable;
//---------------------------------------------------------------------------
DocStr(wxGBSizerItem,
"The wx.GBSizerItem class is used to track the additional data about
items in a `wx.GridBagSizer` such as the item's position in the grid
and how many rows or columns it spans.
", "");
class wxGBSizerItem : public wxSizerItem
{
public:
DocCtorStr(
wxGBSizerItem(),
"Constructs an empty wx.GBSizerItem. Either a window, sizer or spacer
size will need to be set, as well as a position and span before this
item can be used in a Sizer.
You will probably never need to create a wx.GBSizerItem directly as they
are created automatically when the sizer's Add method is called.", "");
~wxGBSizerItem();
%extend {
DocStr(wxGBSizerItem( wxWindow *window, const wxGBPosition& pos,const wxGBSpan& span,int flag,int border,PyObject* userData=NULL ),
"Construct a `wx.GBSizerItem` for a window.", "");
%RenameCtor(GBSizerItemWindow, wxGBSizerItem( wxWindow *window,
const wxGBPosition& pos,
const wxGBSpan& span=wxDefaultSpan,
int flag=0,
int border=0,
PyObject* userData=NULL ))
{
wxPyUserData* data = NULL;
if ( userData ) {
wxPyBlock_t blocked = wxPyBeginBlockThreads();
data = new wxPyUserData(userData);
wxPyEndBlockThreads(blocked);
}
return new wxGBSizerItem(window, pos, span, flag, border, data);
}
DocStr(wxGBSizerItem( wxSizer *sizer,const wxGBPosition& pos,const wxGBSpan& span,int flag,int border,PyObject* userData=NULL ),
"Construct a `wx.GBSizerItem` for a sizer", "");
%disownarg( wxSizer *sizer );
%RenameCtor(GBSizerItemSizer, wxGBSizerItem( wxSizer *sizer,
const wxGBPosition& pos,
const wxGBSpan& span=wxDefaultSpan,
int flag=0,
int border=0,
PyObject* userData=NULL ))
{
wxPyUserData* data = NULL;
if ( userData ) {
wxPyBlock_t blocked = wxPyBeginBlockThreads();
data = new wxPyUserData(userData);
wxPyEndBlockThreads(blocked);
}
return new wxGBSizerItem(sizer, pos, span, flag, border, data);
}
%cleardisown( wxSizer *sizer );
DocStr(wxGBSizerItem( int width,int height,const wxGBPosition& pos,const wxGBSpan& span,int flag,int border,PyObject* userData=NULL),
"Construct a `wx.GBSizerItem` for a spacer.", "");
%RenameCtor(GBSizerItemSpacer, wxGBSizerItem( int width,
int height,
const wxGBPosition& pos,
const wxGBSpan& span=wxDefaultSpan,
int flag=0,
int border=0,
PyObject* userData=NULL))
{
wxPyUserData* data = NULL;
if ( userData ) {
wxPyBlock_t blocked = wxPyBeginBlockThreads();
data = new wxPyUserData(userData);
wxPyEndBlockThreads(blocked);
}
return new wxGBSizerItem(width, height, pos, span, flag, border, data);
}
}
DocDeclStr(
wxGBPosition , GetPos() const,
"Get the grid position of the item", "");
%pythoncode { def GetPosTuple(self): return self.GetPos().Get() }
DocDeclStr(
wxGBSpan , GetSpan() const,
"Get the row and column spanning of the item", "");
%pythoncode { def GetSpanTuple(self): return self.GetSpan().Get() }
DocDeclStr(
bool , SetPos( const wxGBPosition& pos ),
"If the item is already a member of a sizer then first ensure that
there is no other item that would intersect with this one at the new
position, then set the new position. Returns True if the change is
successful and after the next Layout() the item will be moved.", "");
DocDeclStr(
bool , SetSpan( const wxGBSpan& span ),
"If the item is already a member of a sizer then first ensure that
there is no other item that would intersect with this one with its new
spanning size, then set the new spanning. Returns True if the change
is successful and after the next Layout() the item will be resized.
", "");
DocDeclStr(
bool , Intersects(const wxGBSizerItem& other),
"Returns True if this item and the other item instersect.", "");
DocDeclStrName(
bool , Intersects(const wxGBPosition& pos, const wxGBSpan& span),
"Returns True if the given pos/span would intersect with this item.", "",
IntersectsPos);
%extend {
DocStr(GetEndPos,
"Get the row and column of the endpoint of this item.", "");
wxGBPosition GetEndPos() {
int row, col;
self->GetEndPos(row, col);
return wxGBPosition(row, col);
}
}
DocDeclStr(
wxGridBagSizer* , GetGBSizer() const,
"Get the sizer this item is a member of.", "");
DocDeclStr(
void , SetGBSizer(wxGridBagSizer* sizer),
"Set the sizer this item is a member of.", "");
%property(EndPos, GetEndPos, doc="See `GetEndPos`");
%property(GBSizer, GetGBSizer, SetGBSizer, doc="See `GetGBSizer` and `SetGBSizer`");
%property(Pos, GetPos, SetPos, doc="See `GetPos` and `SetPos`");
%property(Span, GetSpan, SetSpan, doc="See `GetSpan` and `SetSpan`");
};
//---------------------------------------------------------------------------
wxLIST_WRAPPER_FAKE(wxSizerItemList, wxSizerItem, wxGBSizerItemList, wxGBSizerItem);
DocStr(wxGridBagSizer,
"A `wx.Sizer` that can lay out items in a virtual grid like a
`wx.FlexGridSizer` but in this case explicit positioning of the items
is allowed using `wx.GBPosition`, and items can optionally span more
than one row and/or column using `wx.GBSpan`. The total size of the
virtual grid is determined by the largest row and column that items are
positioned at, adjusted for spanning.
", "");
class wxGridBagSizer : public wxFlexGridSizer
{
public:
%pythonAppend wxGridBagSizer "self._setOORInfo(self)"
DocCtorStr(
wxGridBagSizer(int vgap = 0, int hgap = 0 ),
"Constructor, with optional parameters to specify the gap between the
rows and columns.", "");
%extend {
DocAStr(Add,
"Add(self, item, GBPosition pos, GBSpan span=DefaultSpan, int flag=0,
int border=0, userData=None) -> wx.GBSizerItem",
"Adds an item to the sizer at the grid cell *pos*, optionally spanning
more than one row or column as specified with *span*. The remaining
args behave similarly to `wx.Sizer.Add`.
Returns True if the item was successfully placed at the given cell
position, False if something was already there.
", "");
wxGBSizerItem* Add( PyObject* item,
const wxGBPosition& pos,
const wxGBSpan& span = wxDefaultSpan,
int flag = 0,
int border = 0,
PyObject* userData = NULL ) {
wxPyUserData* data = NULL;
wxPyBlock_t blocked = wxPyBeginBlockThreads();
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false);
if ( userData && (info.window || info.sizer || info.gotSize) )
data = new wxPyUserData(userData);
if ( info.sizer )
PyObject_SetAttrString(item,"thisown",Py_False);
wxPyEndBlockThreads(blocked);
// Now call the real Add method if a valid item type was found
if ( info.window )
return (wxGBSizerItem*)self->Add(info.window, pos, span, flag, border, data);
else if ( info.sizer )
return (wxGBSizerItem*)self->Add(info.sizer, pos, span, flag, border, data);
else if (info.gotSize)
return (wxGBSizerItem*)self->Add(info.size.GetWidth(), info.size.GetHeight(),
pos, span, flag, border, data);
return NULL;
}
}
%disownarg( wxGBSizerItem *item );
DocDeclAStrName(
wxGBSizerItem* , Add( wxGBSizerItem *item ),
"Add(self, GBSizerItem item) -> wx.GBSizerItem",
"Add an item to the sizer using a `wx.GBSizerItem`. Returns True if
the item was successfully placed at its given cell position, False if
something was already there.", "",
AddItem);
%cleardisown( wxGBSizerItem *item );
DocDeclStr(
wxSize , GetCellSize(int row, int col) const,
"Get the size of the specified cell, including hgap and
vgap. Only valid after a Layout.", "");
DocDeclStr(
wxSize , GetEmptyCellSize() const,
"Get the size used for cells in the grid with no item.", "");
DocDeclStr(
void , SetEmptyCellSize(const wxSize& sz),
"Set the size used for cells in the grid with no item.", "");
%nokwargs GetItemPosition;
%noautodoc GetItemPosition;
DocStr(GetItemPosition,
"GetItemPosition(self, item) -> GBPosition
Get the grid position of the specified *item* where *item* is either a
window or subsizer that is a member of this sizer, or a zero-based
index of an item.", "");
wxGBPosition GetItemPosition(wxWindow *window);
wxGBPosition GetItemPosition(wxSizer *sizer);
wxGBPosition GetItemPosition(size_t index);
%nokwargs SetItemPosition;
%noautodoc SetItemPosition;
DocStr(SetItemPosition,
"SetItemPosition(self, item, GBPosition pos) -> bool
Set the grid position of the specified *item* where *item* is either a
window or subsizer that is a member of this sizer, or a zero-based
index of an item. Returns True on success. If the move is not
allowed (because an item is already there) then False is returned.
", "");
bool SetItemPosition(wxWindow *window, const wxGBPosition& pos);
bool SetItemPosition(wxSizer *sizer, const wxGBPosition& pos);
bool SetItemPosition(size_t index, const wxGBPosition& pos);
%nokwargs GetItemSpan;
%noautodoc GetItemSpan;
DocStr(GetItemSpan,
"GetItemSpan(self, item) -> GBSpan
Get the row/col spanning of the specified *item* where *item* is
either a window or subsizer that is a member of this sizer, or a
zero-based index of an item.", "");
wxGBSpan GetItemSpan(wxWindow *window);
wxGBSpan GetItemSpan(wxSizer *sizer);
wxGBSpan GetItemSpan(size_t index);
%nokwargs SetItemSpan;
%noautodoc SetItemSpan;
DocStr(SetItemSpan,
"SetItemSpan(self, item, GBSpan span) -> bool
Set the row/col spanning of the specified *item* where *item* is
either a window or subsizer that is a member of this sizer, or a
zero-based index of an item. Returns True on success. If the move is
not allowed (because an item is already there) then False is returned.", "");
bool SetItemSpan(wxWindow *window, const wxGBSpan& span);
bool SetItemSpan(wxSizer *sizer, const wxGBSpan& span);
bool SetItemSpan(size_t index, const wxGBSpan& span);
%nokwargs FindItem;
%noautodoc FindItem;
DocStr(FindItem,
"FindItem(self, item) -> GBSizerItem
Find the sizer item for the given window or subsizer, returns None if
not found. (non-recursive)", "");
wxGBSizerItem* FindItem(wxWindow* window);
wxGBSizerItem* FindItem(wxSizer* sizer);
%pythoncode {
def GetItem(self, item):
gbsi = None
si = wx.FlexGridSizer.GetItem(self, item)
if not si:
return None
if type(item) is not int:
gbsi = self.FindItem(item)
if gbsi: return gbsi
return si
}
DocDeclStr(
wxGBSizerItem* , FindItemAtPosition(const wxGBPosition& pos),
"Return the sizer item for the given grid cell, or None if there is no
item at that position. (non-recursive)", "");
DocDeclStr(
wxGBSizerItem* , FindItemAtPoint(const wxPoint& pt),
"Return the sizer item located at the point given in *pt*, or None if
there is no item at that point. The (x,y) coordinates in pt correspond
to the client coordinates of the window using the sizer for
layout. (non-recursive)", "");
DocStr(GetChildren,
"Returns all of the `wx.GBSizerItem` objects managed by the sizer in a
list-like object.", "");
wxGBSizerItemList& GetChildren();
// DocDeclStr(
// wxGBSizerItem* , FindItemWithData(const wxObject* userData),
// "Return the sizer item that has a matching user data (it only compares
// pointer values) or None if not found. (non-recursive)", "");
// Look at all items and see if any intersect (or would overlap) the given
// item. Returns True if so, False if there would be no overlap. If an
// excludeItem is given then it will not be checked for intersection, for
// example it may be the item we are checking the position of.
DocDeclStr(
bool , CheckForIntersection(wxGBSizerItem* item, wxGBSizerItem* excludeItem = NULL),
"Look at all items and see if any intersect (or would overlap) the
given *item*. Returns True if so, False if there would be no overlap.
If an *excludeItem* is given then it will not be checked for
intersection, for example it may be the item we are checking the
position of.
", "");
DocDeclStrName(
bool , CheckForIntersection(const wxGBPosition& pos, const wxGBSpan& span, wxGBSizerItem* excludeItem = NULL),
"Look at all items and see if any intersect (or would overlap) the
given position and span. Returns True if so, False if there would be
no overlap. If an *excludeItem* is given then it will not be checked
for intersection, for example it may be the item we are checking the
position of.", "",
CheckForIntersectionPos);
};
//---------------------------------------------------------------------------
|