/usr/include/d/gtkd-3/gtk/Adjustment.d is in libgtkd-3-dev 3.7.5-2build1.
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 | /*
* This file is part of gtkD.
*
* gtkD is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version, with
* some exceptions, please read the COPYING file.
*
* gtkD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with gtkD; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*/
// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage
module gtk.Adjustment;
private import glib.ConstructionException;
private import gobject.ObjectG;
private import gobject.Signals;
private import gtk.c.functions;
public import gtk.c.types;
public import gtkc.gtktypes;
private import std.algorithm;
/**
* The #GtkAdjustment object represents a value which has an associated lower
* and upper bound, together with step and page increments, and a page size.
* It is used within several GTK+ widgets, including #GtkSpinButton, #GtkViewport,
* and #GtkRange (which is a base class for #GtkScrollbar and #GtkScale).
*
* The #GtkAdjustment object does not update the value itself. Instead
* it is left up to the owner of the #GtkAdjustment to control the value.
*/
public class Adjustment : ObjectG
{
/** the main Gtk struct */
protected GtkAdjustment* gtkAdjustment;
/** Get the main Gtk struct */
public GtkAdjustment* getAdjustmentStruct(bool transferOwnership = false)
{
if (transferOwnership)
ownedRef = false;
return gtkAdjustment;
}
/** the main Gtk struct as a void* */
protected override void* getStruct()
{
return cast(void*)gtkAdjustment;
}
protected override void setStruct(GObject* obj)
{
gtkAdjustment = cast(GtkAdjustment*)obj;
super.setStruct(obj);
}
/**
* Sets our main struct and passes it to the parent class.
*/
public this (GtkAdjustment* gtkAdjustment, bool ownedRef = false)
{
this.gtkAdjustment = gtkAdjustment;
super(cast(GObject*)gtkAdjustment, ownedRef);
}
/** */
public static GType getType()
{
return gtk_adjustment_get_type();
}
/**
* Creates a new #GtkAdjustment.
*
* Params:
* value = the initial value
* lower = the minimum value
* upper = the maximum value
* stepIncrement = the step increment
* pageIncrement = the page increment
* pageSize = the page size
*
* Returns: a new #GtkAdjustment
*
* Throws: ConstructionException GTK+ fails to create the object.
*/
public this(double value, double lower, double upper, double stepIncrement, double pageIncrement, double pageSize)
{
auto p = gtk_adjustment_new(value, lower, upper, stepIncrement, pageIncrement, pageSize);
if(p is null)
{
throw new ConstructionException("null returned by new");
}
this(cast(GtkAdjustment*) p);
}
/**
* Emits a #GtkAdjustment::changed signal from the #GtkAdjustment.
* This is typically called by the owner of the #GtkAdjustment after it has
* changed any of the #GtkAdjustment properties other than the value.
*
* Deprecated: GTK+ emits #GtkAdjustment::changed itself whenever any
* of the properties (other than value) change
*/
public void changed()
{
gtk_adjustment_changed(gtkAdjustment);
}
/**
* Updates the #GtkAdjustment:value property to ensure that the range
* between @lower and @upper is in the current page (i.e. between
* #GtkAdjustment:value and #GtkAdjustment:value + #GtkAdjustment:page-size).
* If the range is larger than the page size, then only the start of it will
* be in the current page.
*
* A #GtkAdjustment::value-changed signal will be emitted if the value is changed.
*
* Params:
* lower = the lower value
* upper = the upper value
*/
public void clampPage(double lower, double upper)
{
gtk_adjustment_clamp_page(gtkAdjustment, lower, upper);
}
/**
* Sets all properties of the adjustment at once.
*
* Use this function to avoid multiple emissions of the
* #GtkAdjustment::changed signal. See gtk_adjustment_set_lower()
* for an alternative way of compressing multiple emissions of
* #GtkAdjustment::changed into one.
*
* Params:
* value = the new value
* lower = the new minimum value
* upper = the new maximum value
* stepIncrement = the new step increment
* pageIncrement = the new page increment
* pageSize = the new page size
*
* Since: 2.14
*/
public void configure(double value, double lower, double upper, double stepIncrement, double pageIncrement, double pageSize)
{
gtk_adjustment_configure(gtkAdjustment, value, lower, upper, stepIncrement, pageIncrement, pageSize);
}
/**
* Retrieves the minimum value of the adjustment.
*
* Returns: The current minimum value of the adjustment
*
* Since: 2.14
*/
public double getLower()
{
return gtk_adjustment_get_lower(gtkAdjustment);
}
/**
* Gets the smaller of step increment and page increment.
*
* Returns: the minimum increment of @adjustment
*
* Since: 3.2
*/
public double getMinimumIncrement()
{
return gtk_adjustment_get_minimum_increment(gtkAdjustment);
}
/**
* Retrieves the page increment of the adjustment.
*
* Returns: The current page increment of the adjustment
*
* Since: 2.14
*/
public double getPageIncrement()
{
return gtk_adjustment_get_page_increment(gtkAdjustment);
}
/**
* Retrieves the page size of the adjustment.
*
* Returns: The current page size of the adjustment
*
* Since: 2.14
*/
public double getPageSize()
{
return gtk_adjustment_get_page_size(gtkAdjustment);
}
/**
* Retrieves the step increment of the adjustment.
*
* Returns: The current step increment of the adjustment.
*
* Since: 2.14
*/
public double getStepIncrement()
{
return gtk_adjustment_get_step_increment(gtkAdjustment);
}
/**
* Retrieves the maximum value of the adjustment.
*
* Returns: The current maximum value of the adjustment
*
* Since: 2.14
*/
public double getUpper()
{
return gtk_adjustment_get_upper(gtkAdjustment);
}
/**
* Gets the current value of the adjustment.
* See gtk_adjustment_set_value().
*
* Returns: The current value of the adjustment
*/
public double getValue()
{
return gtk_adjustment_get_value(gtkAdjustment);
}
/**
* Sets the minimum value of the adjustment.
*
* When setting multiple adjustment properties via their individual
* setters, multiple #GtkAdjustment::changed signals will be emitted.
* However, since the emission of the #GtkAdjustment::changed signal
* is tied to the emission of the #GObject::notify signals of the changed
* properties, it’s possible to compress the #GtkAdjustment::changed
* signals into one by calling g_object_freeze_notify() and
* g_object_thaw_notify() around the calls to the individual setters.
*
* Alternatively, using a single g_object_set() for all the properties
* to change, or using gtk_adjustment_configure() has the same effect
* of compressing #GtkAdjustment::changed emissions.
*
* Params:
* lower = the new minimum value
*
* Since: 2.14
*/
public void setLower(double lower)
{
gtk_adjustment_set_lower(gtkAdjustment, lower);
}
/**
* Sets the page increment of the adjustment.
*
* See gtk_adjustment_set_lower() about how to compress multiple
* emissions of the #GtkAdjustment::changed signal when setting
* multiple adjustment properties.
*
* Params:
* pageIncrement = the new page increment
*
* Since: 2.14
*/
public void setPageIncrement(double pageIncrement)
{
gtk_adjustment_set_page_increment(gtkAdjustment, pageIncrement);
}
/**
* Sets the page size of the adjustment.
*
* See gtk_adjustment_set_lower() about how to compress multiple
* emissions of the GtkAdjustment::changed signal when setting
* multiple adjustment properties.
*
* Params:
* pageSize = the new page size
*
* Since: 2.14
*/
public void setPageSize(double pageSize)
{
gtk_adjustment_set_page_size(gtkAdjustment, pageSize);
}
/**
* Sets the step increment of the adjustment.
*
* See gtk_adjustment_set_lower() about how to compress multiple
* emissions of the #GtkAdjustment::changed signal when setting
* multiple adjustment properties.
*
* Params:
* stepIncrement = the new step increment
*
* Since: 2.14
*/
public void setStepIncrement(double stepIncrement)
{
gtk_adjustment_set_step_increment(gtkAdjustment, stepIncrement);
}
/**
* Sets the maximum value of the adjustment.
*
* Note that values will be restricted by `upper - page-size`
* if the page-size property is nonzero.
*
* See gtk_adjustment_set_lower() about how to compress multiple
* emissions of the #GtkAdjustment::changed signal when setting
* multiple adjustment properties.
*
* Params:
* upper = the new maximum value
*
* Since: 2.14
*/
public void setUpper(double upper)
{
gtk_adjustment_set_upper(gtkAdjustment, upper);
}
/**
* Sets the #GtkAdjustment value. The value is clamped to lie between
* #GtkAdjustment:lower and #GtkAdjustment:upper.
*
* Note that for adjustments which are used in a #GtkScrollbar, the
* effective range of allowed values goes from #GtkAdjustment:lower to
* #GtkAdjustment:upper - #GtkAdjustment:page-size.
*
* Params:
* value = the new value
*/
public void setValue(double value)
{
gtk_adjustment_set_value(gtkAdjustment, value);
}
/**
* Emits a #GtkAdjustment::value-changed signal from the #GtkAdjustment.
* This is typically called by the owner of the #GtkAdjustment after it has
* changed the #GtkAdjustment:value property.
*
* Deprecated: GTK+ emits #GtkAdjustment::value-changed itself whenever
* the value changes
*/
public void valueChanged()
{
gtk_adjustment_value_changed(gtkAdjustment);
}
protected class OnChangedDelegateWrapper
{
void delegate(Adjustment) dlg;
gulong handlerId;
this(void delegate(Adjustment) dlg)
{
this.dlg = dlg;
onChangedListeners ~= this;
}
void remove(OnChangedDelegateWrapper source)
{
foreach(index, wrapper; onChangedListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onChangedListeners[index] = null;
onChangedListeners = std.algorithm.remove(onChangedListeners, index);
break;
}
}
}
}
OnChangedDelegateWrapper[] onChangedListeners;
/**
* Emitted when one or more of the #GtkAdjustment properties have been
* changed, other than the #GtkAdjustment:value property.
*/
gulong addOnChanged(void delegate(Adjustment) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnChangedDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"changed",
cast(GCallback)&callBackChanged,
cast(void*)wrapper,
cast(GClosureNotify)&callBackChangedDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackChanged(GtkAdjustment* adjustmentStruct, OnChangedDelegateWrapper wrapper)
{
wrapper.dlg(wrapper.outer);
}
extern(C) static void callBackChangedDestroy(OnChangedDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnValueChangedDelegateWrapper
{
void delegate(Adjustment) dlg;
gulong handlerId;
this(void delegate(Adjustment) dlg)
{
this.dlg = dlg;
onValueChangedListeners ~= this;
}
void remove(OnValueChangedDelegateWrapper source)
{
foreach(index, wrapper; onValueChangedListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onValueChangedListeners[index] = null;
onValueChangedListeners = std.algorithm.remove(onValueChangedListeners, index);
break;
}
}
}
}
OnValueChangedDelegateWrapper[] onValueChangedListeners;
/**
* Emitted when the #GtkAdjustment:value property has been changed.
*/
gulong addOnValueChanged(void delegate(Adjustment) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnValueChangedDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"value-changed",
cast(GCallback)&callBackValueChanged,
cast(void*)wrapper,
cast(GClosureNotify)&callBackValueChangedDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackValueChanged(GtkAdjustment* adjustmentStruct, OnValueChangedDelegateWrapper wrapper)
{
wrapper.dlg(wrapper.outer);
}
extern(C) static void callBackValueChangedDestroy(OnValueChangedDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
}
|