Beispiel #1
0
            static void Main(string[] args)
            {
                Rabbit NewRabbit = new Rabbit("Squeak squeak", 10, "Napo");

                Console.Write("Me type is Herbivore");
                NewRabbit.Voice();
                NewRabbit.Age();
                NewRabbit.Name();

                Lion NewLion = new Lion("Roar Roar", 15, "King");

                Console.Write("Me type is Carnivore");
                NewLion.Voice();
                NewLion.Age();
                NewLion.NameLion();

                Hyena NewHyena = new Hyena("kay kay", 12, "Boreni");

                NewHyena.Voice();
                NewHyena.Age();
                NewHyena.NameHyena();

                Man NewMan = new Man("speak", 150, "Arman");

                NewMan.Voice();
                NewMan.Age();
                NewMan.NameMan();

                Console.ReadKey();
            }
Beispiel #2
0
 protected override void ClippedRender (Hyena.Data.Gui.CellContext context)
 {
     foreach (var child in Children) {
         if (child.Visible) {
             child.Render (context);
         }
     }
 }
		public static ResourceReference ParseJson (Hyena.Json.JsonObject jsonObj)
		{
			if (jsonObj == null)
				throw new ArgumentNullException ("jsonObj");

			// TODO: Casting checks?
			ResourceReference resourceRef = new ResourceReference ();
			object uri;
			if (jsonObj.TryGetValue ("api-ref", out uri))
				resourceRef.ApiRef = (string) uri;
			if (jsonObj.TryGetValue ("href", out uri))
				resourceRef.Href = (string) uri;
			
			return resourceRef;
		}
Beispiel #4
0
		public static NoteInfo ParseJson (Hyena.Json.JsonObject jsonObj)
		{
			if (jsonObj == null)
				throw new ArgumentException ("jsonObj does not contain a valid NoteInfo representation");

			// TODO: Checks
			NoteInfo note = new NoteInfo ();
			note.Guid = (string) jsonObj ["guid"];

			// TODO: Decide how much is required
			object val;

			if (jsonObj.TryGetValue (TitleElementName, out val))
				note.Title = (string) val;
			if (jsonObj.TryGetValue (NoteContentElementName, out val))
				note.NoteContent = (string) val;
			if (jsonObj.TryGetValue (NoteContentVersionElementName, out val))
				note.NoteContentVersion = (double) val;
			
			if (jsonObj.TryGetValue (LastChangeDateElementName, out val))
				note.LastChangeDate = DateTime.Parse ((string) val);
			if (jsonObj.TryGetValue (LastMetadataChangeDateElementName, out val))
				note.LastMetadataChangeDate = DateTime.Parse ((string) val);
			if (jsonObj.TryGetValue (CreateDateElementName, out val))
				note.CreateDate = DateTime.Parse ((string) val);
			
			if (jsonObj.TryGetValue (LastSyncRevisionElementName, out val))
				note.LastSyncRevision = (int) val;
			if (jsonObj.TryGetValue (OpenOnStartupElementName, out val))
				note.OpenOnStartup = (bool) val;
			if (jsonObj.TryGetValue (PinnedElementName, out val))
				note.Pinned = (bool) val;
			
			if (jsonObj.TryGetValue (TagsElementName, out val)) {
				Hyena.Json.JsonArray tagsJsonArray =
					(Hyena.Json.JsonArray) val;
				note.Tags = new List<string> (tagsJsonArray.Count);
				foreach (string tag in tagsJsonArray)
					note.Tags.Add (tag);
			}

			if (jsonObj.TryGetValue (ResourceReferenceElementName, out val))
				note.ResourceReference =
					ResourceReference.ParseJson ((Hyena.Json.JsonObject) val);

			return note;
		}
Beispiel #5
0
 public abstract void DrawArrow (Cairo.Context cr, Gdk.Rectangle alloc, Hyena.Data.SortType type);
 public void RemoveTracks(Hyena.Collections.Selection selection)
 {
 }
 public void DeleteTracks(Hyena.Collections.Selection selection)
 {
 }
Beispiel #8
0
 void HandleServiceManagerPlaybackControllerShuffleModeChanged (object sender, Hyena.EventArgs<string> e)
 {
     if (_queue == null) {
         return;
     }
     if (e.Value == "off") {
         _queue.Unshuffle(new object());
     }
     else {
         _queue.Shuffle(new object());
     }
 }
        protected virtual bool NeedsReloadWhenFieldChanged (Hyena.Query.QueryField field)
        {
            if (field == null)
                return true;

            // If it's the artist or album name, then we care, since it affects the browser
            // FIXME this should be based on what filters (aka browsers) are active.  InternetRadio,
            // for example, has only a Genre filter.
            if (field == Banshee.Query.BansheeQuery.ArtistField || field == Banshee.Query.BansheeQuery.AlbumField) {
                return true;
            }

            if (DatabaseTrackModel == null) {
                Log.Error ("DatabaseTrackModel should not be null in DatabaseSource.NeedsReloadWhenFieldChanged");
                return false;
            }

            // If it's the field we're sorting by, then yes, we care
            var sort_column = DatabaseTrackModel.SortColumn;
            if (sort_column != null && sort_column.Field == field) {
                return true;
            }

            // Make sure the query isn't dependent on this field
            QueryNode query = DatabaseTrackModel.Query;
            if (query != null) {
                if (query != last_query) {
                    query_fields = new List<QueryField> (query.GetFields ());
                    last_query = query;
                }

                if (query_fields.Contains (field))
                    return true;
            }

            return false;
        }
Beispiel #10
0
 protected virtual void ClippedRender (Hyena.Data.Gui.CellContext context)
 {
     ClippedRender (context.Context);
 }
Beispiel #11
0
 public void DrawArrow(Cairo.Context cr, Gdk.Rectangle alloc, Hyena.Data.SortType type)
 {
     DrawArrow (cr, alloc, Math.PI / 2.0 * (type == Hyena.Data.SortType.Ascending ? 1 : -1));
 }
Beispiel #12
0
 public void QueueRender (Hyena.Gui.Canvas.CanvasItem item, Rect rect)
 {
     QueueDirtyRegion (rect);
 }
Beispiel #13
0
        public override void DrawArrow (Context cr, Gdk.Rectangle alloc, Hyena.Data.SortType type)
        {
            cr.LineWidth = 1;
            cr.Translate (0.5, 0.5);
            double x1 = alloc.X;
            double x3 = alloc.X + alloc.Width / 2.0;
            double x2 = x3 + (x3 - x1);
            double y1 = alloc.Y;
            double y2 = alloc.Bottom;

            if (type == Hyena.Data.SortType.Ascending) {
                cr.MoveTo (x1, y1);
                cr.LineTo (x2, y1);
                cr.LineTo (x3, y2);
                cr.LineTo (x1, y1);
            } else {
                cr.MoveTo (x3, y1);
                cr.LineTo (x2, y2);
                cr.LineTo (x1, y2);
                cr.LineTo (x3, y1);
            }

            cr.Color = Colors.GetWidgetColor (GtkColorClass.Base, StateType.Normal);
            cr.FillPreserve ();
            cr.Color = Colors.GetWidgetColor (GtkColorClass.Text, StateType.Normal);
            cr.Stroke ();
            cr.Translate (-0.5, -0.5);
        }
Beispiel #14
0
 public void Merge(Hyena.IUndoAction action)
 {
 }
Beispiel #15
0
 public bool CanMerge(Hyena.IUndoAction action)
 {
     return false;
 }
Beispiel #16
0
		public IList<NoteInfo> ParseJsonNoteArray (Hyena.Json.JsonArray jsonArray)
		{
			if (jsonArray == null)
				throw new ArgumentNullException ("jsonArray does not contain a valid NoteInfo array representation");

			// TODO: Checks
			List<NoteInfo> noteList = new List<NoteInfo> ();
			foreach (Hyena.Json.JsonObject jsonObj in jsonArray)
				noteList.Add (NoteInfo.ParseJson (jsonObj));
			return noteList;
		}
Beispiel #17
0
 public void QueueDirtyRegion (Hyena.Gui.Canvas.Rect region)
 {
     QueueDirtyRegion ((Gdk.Rectangle)region);
 }
Beispiel #18
0
        protected bool NeedsReloadWhenFieldsChanged (Hyena.Query.QueryField [] fields)
        {
            if (fields == null) {
                return true;
            }

            foreach (QueryField field in fields)
                if (NeedsReloadWhenFieldChanged (field))
                    return true;

            return false;
        }
Beispiel #19
0
        protected override void ClippedRender(Hyena.Data.Gui.CellContext context)
        {
            if (!EnsureLayout ()) {
                return;
            }

            var cr = context.Context;
            context.Theme.Widget.StyleContext.Save ();
            if (context.TextAsForeground) {
                context.Theme.Widget.StyleContext.AddClass ("button");
            } else {
                context.Theme.Widget.StyleContext.AddClass ("entry");
            }
            Foreground = new Brush (context.Theme.Widget.StyleContext.GetColor (context.State));

            Brush foreground = Foreground;
            if (!foreground.IsValid) {
                return;
            }

            cr.Rectangle (0, 0, RenderSize.Width, RenderSize.Height);
            cr.Clip ();

            bool fade = Fade && text_alloc.Width > RenderSize.Width;

            if (fade) {
                cr.PushGroup ();
            }

            Foreground.Apply (cr);
            UpdateLayout (GetText (), RenderSize.Width, RenderSize.Height, true);
            if (Hyena.PlatformDetection.IsWindows) {
              // FIXME windows; working around some unknown issue with ShowLayout; bgo#644311

              cr.Antialias = Cairo.Antialias.None;
              PangoCairoHelper.LayoutPath (cr, layout, true);
            } else {
              PangoCairoHelper.ShowLayout (cr, layout);
            }

            TooltipMarkup = layout.IsEllipsized ? last_formatted_text : null;

            if (fade) {
                LinearGradient mask = new LinearGradient (RenderSize.Width - 20, 0, RenderSize.Width, 0);
                mask.AddColorStop (0, new Color (0, 0, 0, 1));
                mask.AddColorStop (1, new Color (0, 0, 0, 0));

                cr.PopGroupToSource ();
                cr.Mask (mask);
                mask.Destroy ();
            }

            cr.ResetClip ();
            context.Theme.Widget.StyleContext.Restore ();
        }
Beispiel #20
0
        public void Render (Hyena.Data.Gui.CellContext context)
        {
            var alloc = ContentAllocation;
            var cr = context.Context;
            double opacity = Opacity;

            if (alloc.Width <= 0 || alloc.Height <= 0 || opacity <= 0) {
                return;
            }

            cr.Save ();

            if (opacity < 1.0) {
                cr.PushGroup ();
            }

            MarginStyle margin_style = MarginStyle;
            if (margin_style != null && margin_style != MarginStyle.None) {
                cr.Translate (Math.Round (Allocation.X), Math.Round (Allocation.Y));
                cr.Save ();
                margin_style.Apply (this, cr);
                cr.Restore ();
                cr.Translate (Math.Round (Margin.Left), Math.Round (Margin.Top));
            } else {
                cr.Translate (Math.Round (alloc.X), Math.Round (alloc.Y));
            }

            cr.Antialias = Cairo.Antialias.Default;

            //cr.Rectangle (0, 0, alloc.Width, alloc.Height);
            //cr.Clip ();

            ClippedRender (context);

            if (PrelightRenderer != null && prelight_opacity > 0) {
                PrelightRenderer (context.Context, context.Theme, new Rect (0, 0, ContentAllocation.Width, ContentAllocation.Height), prelight_opacity);
            }

            //cr.ResetClip ();

            if (opacity < 1.0) {
                cr.PopGroupToSource ();
                cr.PaintWithAlpha (Opacity);
            }

            cr.Restore ();
        }